Linux Tricks
Bash
Ctrl+L - clear screen
Ctrl+A - go to the beginning of the line
Ctrl+E - go to the end of the line
Ctrl+U - delete from the cursor to the beginning of the line
Ctrl+K - delete from the cursor to the end of the line
Ctrl+left (Alt-B) - jump next word backward
Ctrl+right (Alt-F) - jump next word forward
Alt-D - delete the word after the cursor
vi
i - insert text before the cursor
I - insert text at the beginning of the line
a - append text after the cursor
A - append text at the end of the line
R - replace mode until ESC
^ - go to the beginning of the line
$ - go to the end of the line
d2w - delete 2 words
d2d - delete 2 lines
D - clear the line
d$ - delete to the end of the line
d^ - delete to the beginning of the line
[from],[to]d - delete range of lines
.,$d - delete from the current line to the end of the file
dG - deletes all lines to the end of the file
dgg - delete from the current line to the beginning of the file
:g /word/d - delete all lines that content word
g!/word/d - delete all lines that don't content word
u - undo
11G - go to line number 11
gg - go to the first line
G - go to the last line
%s/old/new/g - substitute - change every occurrence in the file
set ic - set ignore case
set noic - unset ignore case
set number - show line numbers
r filename - insert text from a file
6,8w file99 - writes lines from 6 to 8 to a new file.
Git
git commit -a -m "Message"
git push
Last updated
Was this helpful?