Handy commands
ctrl-l
: Clear the screen
Navigating the command line
ctrl-a
: Go to the beginning of a linectrl-e
: Go to the end of the linectrl-k
: Delete everything to the rightctrl-w
: Delete the previous wordESC-b
: Go back one wordESC-f
: Go forward one word!!
: Reuse the last executed command. Great for when you need to rerun a command with sudo, e.g.sudo !!
!$
: Contains the last argument of the previous command. Great for saving retyping, e.g.touch README.txt
thencat !$
history
: View previously executed commands!560
: Will re-run the command at line 560 in the history list!echo
: Will re-run the last history command that starts with echoctrl-r
: Interactive pick of history commands (enter to run the command or ⌃ g to abandon it)⌃ from ⌃ to
: Search and replace the first occurrence of a command in history and rerunmv readme.{txt,md}
: Replace txt with md
Aliases and Functions
Add aliases and functions should be added to /.bash_rc
To activate added aliases use:
. ~/.bash_rc
alias ss="./script/server"
alias tu='top -o cpu' #cpu sorted
alias tm='top -o vsize' # memory