Ctrl + a, move to the beginning of the lineCtrl + e, move to the end of the lineCtrl + b, move back one characterCtrl + f, move forward one characterCtrl + k, Cut the Line after the cursor to the clipboard.Ctrl + u, Cut the Line before the cursor to the clipboard.Ctrl + a then Ctrl + k to jump to the beginning and delete the lineCtrl + y, paste last value in clipboardMeta + y, cycle through previous values in clipboardCtrl + d, delete character after cursorCtrl + h, delete character before the cursor (backspace)Alt/Meta + b, Alt + f, move back and forward a word at a timeCtrl + w, delete the word before the cursorAlt + d, delete the word after the cursorAlt/Meta + w, delete the word in front of the cursorCtrl + _ or Ctrl + Shift + _, undo last change
Use Ctrl + r to reverse search command history and Ctrl + s to forward search. Esc selects the current line and restores it to the active command line. Ctrl + g cancels the history search without recalling a line to the active command line.
Add the following to the bashrc to disable the flow control function of Ctrl + s
stty -ixon # enabled forward search with Ctrl+s by disabling XON/XOFF flow control
export EDITOR=/bin/vi to make vi the default editorCtrl+x+e to edit current command in default text editor.vi you can exit with :cq to cancel the command.fc, fixed command opens the last command in the editorhistory -a, append the current session history to the history filehistory -s <cmd line>, save the specified command line to history without executing it. Alternatively, prefix a line with the comment character (#) and it will be saved to history as a comment.history -d <line number/range>, delete line or range of lines from historyAutomatically run a command after every command ran in the shell that prints a line that includes the current time. It makes it easier to spot commands being ran when scrolling back in the terminal.
PROMPT_COMMAND='printf "\e[32m---------------------------$(date +%Y-%m-%dT%H:%M:%S%z)---------------------------\n\e[0m"'
Example output
---------------------------2023-04-07T21:12:28+0000---------------------------