Movement
ALT+Fto jump Forward by a word.ALT+Bto jump Backward by a word.CTRL+Fto move forward by a charCTRL+Bto move backward by a charCTRL+Ato jump to start of the lineCTRL+Eto jump to end of the lineCTRL+Kto kill the line starting from the cursor positionALT+Dto delete a word starting from the current cursor positionCTRL+Wto remove the word backwards from cursor positionCTRL+Rto reverse search for commands you typed in the past from your history.CTRL+Sto forward search (works in ZSH for me but not bash)

Scripting
-
To assign a variable, use = without space
-
To use a variable, simply add $ before it
-
set -xShow what’s executed -
set -eIf the return code of one command is not 0 and the caller does not check it, the shell script will exit. This feature make shell script robust. -
$0- Name of the script -
$1to$9- Arguments to the script.$1is the first argument and so on. -
$@- All the arguments -
$#- Number of arguments -
$?- Return code of the previous command -
$$- Process identification number (PID) for the current script -
!!- Entire last command, including arguments. A common pattern is to execute a command only for it to fail due to missing permissions; you can quickly re-execute the command with sudo by doingsudo !! -
$_- Last argument from the last command. If you are in an interactive shell, you can also quickly get this value by typingEscfollowed by.orAlt+.