Usefull terminal shortcuts
General
Shortcut | Description |
---|---|
Ctrl + A |
Move to the beginning of the line |
Ctrl + E |
Move 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 + W |
Delete from the cursor to the start of the word |
Ctrl + L |
Clear the screen |
Ctrl + R |
Search history |
Ctrl + C |
Kill the current process |
Ctrl + D |
Exit the current shell |
Ctrl + Z |
Suspend the current process |
Up Arrow |
Show the previous command |
Down Arrow |
Show the next command |
Tab |
Autocomplete the command |
Ctrl + T |
Swap the last two characters before the cursor |
Alt + T |
Swap the last two words before the cursor |
Alt + F |
Move forward one word |
Alt + B |
Move backward one word |
Ctrl + XX |
Move between the start of the line and the current cursor position |
Ctrl + _ |
Undo the last change |
Ctrl + H |
Delete the character before the cursor |
Ctrl + D |
Delete the character under the cursor |
!! |
Repeat the last command |
!$ |
Repeat the last argument of the last command |
!^ |
Repeat the first argument of the last command |
!n |
Repeat the n-th command in the history |
!-n |
Repeat the n-th last command in the history |
!string |
Repeat the last command starting with string |
Tab + Tab |
Show all the commands that start with the current word |
Ctrl + Shift + C |
Copy |
Ctrl + Shift + V |
Paste |
Ctrl + Shift + X |
Cut |
Ctrl + Shift + Z |
Undo |
Ctrl + Shift + N |
New terminal |
Ctrl + Shift + T |
New tab |
Ctrl + Shift + W |
Close tab |
Ctrl + Shift + Q |
Close terminal |
Vim
Shortcut | Description |
---|---|
i |
Insert mode |
Esc |
Normal mode |
:w |
Save |
:q |
Quit |
:q! |
Quit without saving |
:wq |
Save and quit |
:x |
Save and quit |
:e |
Reload |
:e! |
Reload without saving |
:wq! |
Save and quit without asking |
:x! |
Save and quit without asking |
:set number |
Show line numbers |
:set nonumber |
Hide line numbers |
:set hlsearch |
Highlight search |
:set nohlsearch |
Disable highlight search |
:set ignorecase |
Ignore case |
:set noignorecase |
Disable ignore case |
:set incsearch |
Incremental search |
:set noincsearch |
Disable incremental search |
:set autoindent |
Auto indent |
:set noautoindent |
Disable auto indent |
:set expandtab |
Expand tab |
:set noexpandtab |
Disable expand tab |
:set tabstop=4 |
Set tab size to 4 |
:set shiftwidth=4 |
Set shift width to 4 |
:set softtabstop=4 |
Set soft tab size to 4 |
:set wrap |
Wrap lines |
:set nowrap |
Disable wrap lines |
:set list |
Show special characters |
:set nolist |
Hide special characters |
:set mouse=a |
Enable mouse |
:set nomouse |
Disable mouse |
:set background=dark |
Set dark background |
:set background=light |
Set light background |
:set syntax=on |
Enable syntax highlighting |
:set syntax=off |
Disable syntax highlighting |
:set ruler |
Show cursor position |
:set noruler |
Hide cursor position |
:set showcmd |
Show command |
:set noshowcmd |
Hide command |
:set showmode |
Show mode |
:set noshowmode |
Hide mode |
:set laststatus=2 |
Show status bar |
:set laststatus=0 |
Hide status bar |
:set statusline=%F%h%m%r%=%l,%c%V%P |
Show file name, modified, read only, line, column, virtual column, percentage |
:set statusline= |
Hide status line |
:set background=dark |
Set dark background |
:set background=light |
Set light background |