How to unset / undefine environment variable:

unset myvar

Using single quotes disable shell expansion.

The '!' character is the history expansion character, which bash normally replaces with a previously-typed command.

CTRL+z:  Suspend current process
CTRL+d:  End of input
CTRL+s:  Stop terminal output
CTRL+q:  Start terminal output

Command History:

history      // display a list of most recent command
!!           // repeat the entire last command at any point in the current command line
!n           // repeat command line n
!string      // command beginning with string
!*           // repeat all arguments to previous command
!string:p    // print the matching command to screen, add it to history, without executing it
Ctrl+r string // look through the history for matching command.  
             // Hit ENTER to execute matching command.
             // Hit Ctrl+j or ESC to edit the command.
             // Hit Ctrl+g to abort
Ctrl+r Ctrl+r // search using previous search string
Ctrl+r Ctrl+r // cycle through previous search string
!$           // last part of previous command
!*           // all arguments of previous command
Ctrl+w       // erase word
Ctrl+u       // erase to the beginning of line
Ctrl+a       // move to beginning of line
Ctrl+e       // move to the end of line
Ctrl+_       // undo last editing command
Ctrl+x Ctrl+u // undo the last editing command
Alt+f         // move forward a word
Alt+b         // move backward a word
Ctrl+l        // clear the screen
Ctrl+f        // move forward one character
Ctrl+k        // delete to the end of line
Alt+d         // delete to end of word
Ctrl+y        // paste the text most recently deleted
Alt+1 0 Ctrl+d // delete the next 10 characters
Ctrl+x Ctrl+r // re-read the .inputrc file See
Ctrl+p        // display previous command (same as the arrow up key)
Ctrl+n        // display next command
Alt+Ctrl+y    // paste the first argument of previous command
Alt+. or Alt+_ // paste the last argument of previous command
Ctrl+t         // drag the character before the cursor forward.  If at the end of line, transpose the last two characters
Alt+t          // transpose words
Alt+u          // uppercase word
Alt+l          // lowercase word
Alt+c          // capitalize word
Crtl+k         // delete to the end of line
Ctrl+x         // delete to beginning of line
Ctrl+u         // delete to beginning of line
Alt+d          // delete word
Ctrl+w         // delete word
Ctrl+y         // paste deleted text
Alt+y          // rotate the deleted text buffer and paste from the top
Alt+num        // specify a numeric argument for other command
Alt+-num       // specify a negative numeric argument for other command
CTRL -                 // decrease the font (zoom out)
CTRL +                // increase the font (zoom in)
CTRL 0                // normal size

If the menu bar disappear, right click on the terminal, and select "Show Menubar".

Job Control:

Ctrl+Z      // suspend
Ctrl+D      // end of input
Ctrl+S      // stop terminal output
Ctrl+Q      // start terminal output
jobs        // list job number
bg n        // run job number n in background
fg n        // run job number n in foreground
%n          // connect to job number n
kill -9 %n  // kill job number n
bg           // run a suspended job in the background
fg           // resume suspended job in the forground

Bash History

history     // display history
!n          // repeat command n
!!          // enter the last line
savehist    // save history

man -k keyword

sort -n

%n connect to job number n

kill -9 %n kill job number n
!n repeat command n
!! enter last command

Using Bash's History Effectively

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License