readline shortcuts / bash commands:
default
Esc = ALT
(esc + b = alt +b) (in case you can't use alt / mod1)
set -o vi
put readline in vi mode
set -o emacs
put readline in emacs/default mode
Tab
Autocompletes from the cursor position.
alt+bksp
delete one word back non-alphanumerically delimited
^|
(that's a pipe) sends SIGQUIT.
^_
undo typing
alt+_
Insert last argument
alt+.
insert the final argument to the last command at the cursor point
^a
cursor to beginning of line (home-key)
^b
move back one character.
alt+b
cursor one word back
^c
Sending signal SIGINT the current process you run (usually the process will be killed)
alt+c
capitalizes the character under the cursor and moves to the end of the word.
^d
delete char under cursor. If blank line send EOF, Exit/logout shell.
alt+d
cut one word after the cursor
alt+Del
cuts the word before the cursor
^e
cursor to end of line (end-key)
^f
move forward one character.
alt+f
cursor one word forward
^g
cancel history search
^h
clear one character before the cursor. (backspace)
^j
select command from history search ^r ^s
^k
cut all characters after the cursor.
^l
cLear screen
alt+l
Lowercases one word in front of the cursor
^n
scroll next command (downArrow-key)
^o
executes the found command from ^r or ^s
^p
scroll up previous commands (upArrow-key).
^r
recall history from previously used commands. (each ^r next corresponding command)
alt+r
cancels changes and put back the line as it was (revert)
^s
back to the next recent command of the search
(careful no to execute it from a terminal because this command also launches its XOFF).
If you changed that XOFF setting, use Ctrl+q to return.
^t
swap the last two characters before the cursor.
alt+t
swap the last two words before the cursor
^u
cut all characters before the cursor.
alt+u
uppercase one word after the cursor
^v tab/enter (or any char)
insert a tab, or ^M ,etc
^w
cut one word before the cursor
^x ^e
edits the current line in the $EDITOR program, or vi
^x ^x
jump cursor to last position
^y
paste the last cut characters by CTRL+u or CTRL+k or ALT+d (yank clipboard to cursor)
^alt+y
insert first argument of previous command, (ALT + 2-9, CNTRL + ALT +y : insert nth argument)
^z
put current process into background process with signal SIGTSTP.
To restore it, use command fg [process name or job id]
misc
----
PROMPT_COMMAND='history -a && history -n'
collects history from current open terminals
cp ./test.txt{,.bak}
copies test.txt to test.txt.bak
echo $
echos last arguemnet passed to console
add() (IFS=+; echo $(($*))
add 2 4 2
creates a function called add
adds 2 4 2 together
default