Linux Bash Terminal Keyboard Shortcuts
August 7, 2022 ยท View on GitHub
Shortcut & Action
-
Bash Navigation
Ctrl + AMove to the start of the command lineCtrl + EMove to the end of the command lineCtrl + FMove one character forwardCtrl + BMove one character backwardCtrl + XXSwitch cursor position between start of the command line and the current positionCtrl + ] + xMoves the cursor forward to next occurrence of xAlt + F / Esc + FMoves the cursor one word forwardAlt + B / Esc + BMoves the cursor one word backwardAlt + Ctrl + ] + xMoves cursor to the previous occurrence of x
-
Bash Control/Process
Ctrl + LSimilar to clear command, clears the terminal screenCtrl + SStops command output to the screenCtrl + ZSuspends current command execution and moves it to the backgroundCtrl + QResumes suspended commandCtrl + CSends SIGI signal and kills currently executing commandCtrl + DCloses the current terminal
-
Bash History
Ctrl + RIncremental reverse search of bash historyAlt + PNon-incremental reverse search of bash historyCtrl + JEnds history search at current commandCtrl + _Undo previous commandCtrl + P / Up arrowMoves to previous commandCtrl + N / Down arrowMoves to next commandCtrl + SGets the next most recent commandCtrl + ORuns and re-enters the command found via Ctrl + S and Ctrl + RCtrl + GExits history search mode!!Runs last command!*Runs previous command except its first word!*:pDisplays what !* substitutes!xRuns recent command in the bash history that begins with x!x:pDisplays the x command and adds it as the recent command in history!$Same as OPTION+., brings forth last argument of the previous command!^Substitutes first argument of last command in the current command!$:pDisplays the word that !$ substitutes^123^abcReplaces 123 with abc!n:mRepeats argument within a range (i.e, m 2-3)!fiRepeats latest command in history that begins with fi!nRun nth command from the bash history!n:pPrints the command !n executes!n:$Repeat arguments from the last command (i.e, from argument n to $)
-
Bash Editing
Ctrl + UDeletes before the cursor until the start of the commandCtrl + KDeletes after the cursor until the end of the commandCtrl + WRemoves the command/argument before the cursorCtrl + DRemoves the character under the cursorCtrl + HRemoves character before the cursorAlt + DRemoves from the character until the end of the wordAlt + BackspaceRemoves from the character until the start of the wordAlt + . / Esc+.Uses last argument of previous commandAlt + <Moves to the first line of the bash historyAlt + >Moves to the last line of the bash historyEsc + TSwitch between last two words before cursorAlt + TSwitches current word with the previous
-
Bash Information
TABAutocompletes the command or file/directory name~TAB TABList all Linux usersCtrl + ICompletes the command like TABAlt + ?Display files/folders in the current path for helpAlt + *Display files/folders in the current path as parameter
Bash shortcuts
Arrow keys(left, right) move inside the commandCtrl + Amove to beginning of commandCtrl + Emove to the end of commandCtrl + Lclear screenAlt + Bmove to previous wordAlt + Fmove to next wordCtrl + Left/Right arrowmove between wordsTabtab completion