| Both sides previous revision Previous revision Next revision | Previous revision |
| linux:general_bash-ery [2023/04/10 11:26] – mgupton | linux:general_bash-ery [2026/02/18 20:47] (current) – [General Bash-ery] mgupton |
|---|
| * ''Ctrl + a'', move to the beginning of the line | * ''Ctrl + a'', move to the beginning of the line |
| * ''Ctrl + e'', move to the end of the line | * ''Ctrl + e'', move to the end of the line |
| | |
| | * ''Ctrl + b'', move back one character |
| | * ''Ctrl + f'', move forward one character |
| | |
| * ''Ctrl + k'', Cut the Line after the cursor to the clipboard. | * ''Ctrl + k'', Cut the Line after the cursor to the clipboard. |
| * ''Ctrl + u'', Cut the Line before 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 line |
| * ''Ctrl + y'', paste last value in clipboard | * ''Ctrl + y'', paste last value in clipboard |
| * ''Meta + y'', cycle through previous values in clipboard | * ''Meta + y'', cycle through previous values in clipboard |
| | * ''Ctrl + d'', delete character after cursor |
| | * ''Ctrl + h'', delete character before the cursor (backspace) |
| | * ''Alt/Meta + b'', ''Alt + f'', move back and forward a word at a time |
| | * ''Ctrl + w'', delete the word before the cursor |
| | * ''Alt + d'', delete the word after the cursor |
| | * ''Alt/Meta + w'', delete the word in front of the cursor |
| | |
| | * ''Ctrl + _'' or ''Ctrl + Shift + _'', undo last change |
| |
| === Command Line History Search === | === Command Line History Search === |
| * ''history -a'', append the current session history to the history file | * ''history -a'', append the current session history to the history file |
| * ''history -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 -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 history |
| |
| ====== Command Delimiter ====== | ====== Command Delimiter ====== |
| Automatically run a command after every command ran in the shell that prints a line includes that includes the current time. It makes it easier to spot commands being ran when scrolling back in the terminal. | Automatically 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. |
| <code bash> | <code bash> |
| PROMPT_COMMAND='printf "\e[32m---------------------------$(date +%Y-%m-%dT%H:%M:%S%z)---------------------------\n\e[0m"' | PROMPT_COMMAND='printf "\e[32m---------------------------$(date +%Y-%m-%dT%H:%M:%S%z)---------------------------\n\e[0m"' |