-
Notifications
You must be signed in to change notification settings - Fork 0
Linux
rvan-dev edited this page Jun 24, 2024
·
4 revisions
Linux commands / tipps and tricks / neat stuff will soon follow here
Action | Command | Note |
---|---|---|
Move cursor to start of line | Ctrl+a | - |
Move cursor to end of line | Ctrl+e | - |
Move cursor forward one character | Ctrl+f | - |
Move cursor back one character | Ctrl+b | - |
Move cursor forward one word | Alt+f | Works only with left Alt |
Move cursor back one word | Alt+b | - |
Delete current character | Ctrl+d | - |
Delete character left of cursor | Ctrl+h | - |
Delete word left of cursor | Ctrl+w | - |
Delete everything right of cursor | Ctrl+k | - |
Delete everything left of cursor | Ctrl+u | - |
Clear screen | Ctrl+l | - |
Cancel command | Ctrl+c | - |
Undo | Ctrl+_ | bash only |
Search history | Ctrl+r | Put #important after a command to find it more easily later on Everything after the # will not be interpreted as a command or argument |
Cancel search | Ctrl+g |
There are to modis in VIM 1 is the insert mode and the other is the command mode
By pressing "i" you change into insert mode, here you can edit like with every other text editor like nano for example.
By pressing ESC you get out of insert mode and get back into command mode, here you can run all the commands available in vim, I have put together some of the most important ones down below
:w | Write / saves the changed |
---|---|
:q | Quits / closes the editor |
:wq | Save and close |
:q! | Close and discard changes |
dd | Delete Line |
dg | Deletes from pointer to end of line |
dw | Deletes the word that the pointer is at |
U | Undos the last changes |
STRG+R | Undos the last undo |
:earlier 1m | Jump back 1 minute in the document history |
gg | Goes to the top of the file |
YY | Copys the current line into the buffer |
p | Paste the copy one line under the line the pointer is at |
P | Paste the copy one line above the current pointer position |
0 | Jump to the end of the line |
$ | Jump to the start of the line |
g | Jump to the end of the file |
/ | Search function |
n | Jump to the next element of the search |
N | Jump to the previous element of the search |
:%s/original/replacement | Search and replace=> in this example the word original gets replaced with replacement |
:%s/original/replacement/g | Search and replace every instance in the document |
:%s/original/replacement/gc | Search and replace every instance but only after confirmation |