Skip to content

Instantly share code, notes, and snippets.

@fengjing
Forked from tuxfight3r/01.bash_shortcuts_v2.md
Created February 7, 2024 07:45
Show Gist options
  • Save fengjing/7509a05d34362338499cea6554ad2db7 to your computer and use it in GitHub Desktop.
Save fengjing/7509a05d34362338499cea6554ad2db7 to your computer and use it in GitHub Desktop.

Revisions

  1. @tuxfight3r tuxfight3r revised this gist May 12, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ Bash Shortcuts
    | ctrl + i | command completion like Tab
    | ctrl + l | Clear the screen (same as clear command) |
    | ctrl + c | kill whatever is running |
    | ctrl + d | Exit shell (same as exit command) |
    | ctrl + d | Exit shell (same as exit command when cursor line is empty) |
    | ctrl + z | Place current process in background |
    | ctrl + _ | Undo |
    | ctrl + x ctrl + u | Undo the last changes. ctrl+ _ does the same |
  2. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -23,36 +23,36 @@ Bash Shortcuts
    |----------|--------------------------------|
    | ctrl + d | Delete the character under the cursor |
    | ctrl + h | Delete the previous character before cursor |
    | ctrl + u | Clear all BEFORE cursor |
    | ctrl + k | Clear all AFTER cursor |
    | ctrl + u | Clear all / cut BEFORE cursor |
    | ctrl + k | Clear all / cut AFTER cursor |
    | ctrl + w | delete the word BEFORE the cursor |
    | alt + d | delete the word FROM the cursor |
    | ctrl + y | paste (if you used a previous command to delete) |
    | ctrl + i | command completion like Tab
    | ctrl + l | Clear the screen (same as clear command) |
    | ctrl + c | kill whatever is running |
    | ctrl + d | Exit shell (same as exit command) |
    | ctrl + y | paste (if you used a previous command to delete) |
    | ctrl + z | Place current process in background |
    | ctrl + _ | Undo |
    | ctrl + x ctrl + u | Undo the last changes. ctrl+ _ does the same |
    | ctrl + t | Swap the last two characters before the cursor |
    | esc + t | Swap last two words before the cursor |
    | alt + t | swap current word with previous |
    | esc + . | |
    | esc + _ | |
    | alt + [Backspace] | delete PREVIOUS word |
    | alt + < | Move to the first line in the history |
    | alt + > | Move to the end of the input history, i.e., the line currently being entered |
    | alt + ? | |
    | alt + * | |
    | alt + ? | display the file/folder names in the current path as help |
    | alt + * | print all the file/folder names in the current path as parameter |
    | alt + . | print the LAST ARGUMENT (ie "vim file1.txt file2.txt" will yield "file2.txt") |
    | alt + c | capitalize the first character to end of word starting at cursor (whole word if cursor is at the beginning of word)|
    | alt + l | |
    | alt + u | make uppercase from cursor to end of word |
    | alt + l | make lowercase from cursor to end of word |
    | alt + n | |
    | alt + p | Non-incremental reverse search of history. |
    | alt + r |Undo all changes to the line|
    | alt + ctl + e |Expand command line. |
    | alt + t | |
    | alt + u | |
    | ~[TAB][TAB] | List all users |
    | $[TAB][TAB] | List all system variables |
    | @[TAB][TAB] | List all entries in your /etc/hosts file |
  3. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ Bash Shortcuts
    | alt + ? | |
    | alt + * | |
    | alt + . | print the LAST ARGUMENT (ie "vim file1.txt file2.txt" will yield "file2.txt") |
    | alt + c | |
    | alt + c | capitalize the first character to end of word starting at cursor (whole word if cursor is at the beginning of word)|
    | alt + l | |
    | alt + n | |
    | alt + p | Non-incremental reverse search of history. |
  4. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -94,3 +94,4 @@ kill %1
    ## References

    1. http://cnswww.cns.cwru.edu/php/chet/readline/readline.html
    2. https://github.com/fliptheweb/bash-shortcuts-cheat-sheet/blob/master/README.md
  5. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Bash
    ====
    Bash Shortcuts
    ==============

    ![visual cheetsheet](https://raw.githubusercontent.com/fliptheweb/bash-shortcuts-cheat-sheet/master/moving_cli.png)

  6. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -13,10 +13,11 @@ Bash
    | ctrl + f | move forward one character |
    | alt + f | move cursor FORWARD one word |
    | alt + b | move cursor BACK one word |
    | ctrl + xx | Toggle between the start of line and current cursor position |
    | ctrl + ] + x | Where x is any character, moves the cursor forward to the next occurance of x |
    | alt + ctrl + ] + x | Where x is any character, moves the cursor backwards to the previous occurance of x |

    ## Other
    ## Edit / Other

    | command | description |
    |----------|--------------------------------|
  7. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Bash
    ====

    ![visual cheetsheet](https://github.com/fliptheweb/bash-shortcuts-cheat-sheet/blob/master/moving_cli.png?raw=true)
    ![visual cheetsheet](https://raw.githubusercontent.com/fliptheweb/bash-shortcuts-cheat-sheet/master/moving_cli.png)

    ## Moving

  8. @tuxfight3r tuxfight3r revised this gist Mar 2, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    Bash
    ====

    ![visual cheetsheet](https://github.com/fliptheweb/bash-shortcuts-cheat-sheet/blob/master/moving_cli.png?raw=true)

    ## Moving

    | command | description |
  9. @tuxfight3r tuxfight3r revised this gist Feb 1, 2021. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -24,14 +24,15 @@ Bash
    | ctrl + k | Clear all AFTER cursor |
    | ctrl + w | delete the word BEFORE the cursor |
    | alt + d | delete the word FROM the cursor |
    | ctrl + i | command completion like Tab
    | ctrl + l | Clear the screen (same as clear command) |
    | ctrl + c | kill whatever is running |
    | ctrl + d | Exit shell (same as exit command) |
    | ctrl + t | swap the last two characters before the cursor |
    | ctrl + y | paste (if you used a previous command to delete) |
    | ctrl + z | Place current process in background |
    | ctrl + _ | undo |
    | ctrl + _ | Undo |
    | ctrl + x ctrl + u | Undo the last changes. ctrl+ _ does the same |
    | ctrl + t | Swap the last two characters before the cursor |
    | esc + t | Swap last two words before the cursor |
    | esc + . | |
    | esc + _ | |
  10. @tuxfight3r tuxfight3r revised this gist Nov 18, 2020. 1 changed file with 0 additions and 27 deletions.
    27 changes: 0 additions & 27 deletions 02.bash_shortcuts.txt
    Original file line number Diff line number Diff line change
    @@ -1,27 +0,0 @@

    Ctrl-a Move to the start of the line.
    Ctrl-e Move to the end of the line.
    Ctrl-b Move back one character.
    Alt-b Move back one word.
    Ctrl-f Move forward one character.
    Alt-f Move forward one word.
    Ctrl-] x Where x is any character, moves the cursor forward to the next occurance of x.
    Alt-Ctrl-] x Where x is any character, moves the cursor backwards to the previous occurance of x.
    Ctrl-u Delete from the cursor to the beginning of the line.
    Ctrl-k Delete from the cursor to the end of the line.
    Ctrl-w Delete from the cursor to the start of the word.
    Esc-Del Delete previous word (may not work, instead try Esc followed by Backspace)
    Ctrl-y Pastes text from the clipboard.
    Ctrl-l Clear the screen leaving the current line at the top of the screen.
    Ctrl-x Ctrl-u Undo the last changes. Ctrl-_ does the same
    Alt-r Undo all changes to the line.
    Alt-Ctrl-e Expand command line.
    Ctrl-r Incremental reverse search of history.
    Alt-p Non-incremental reverse search of history.
    !! Execute last command in history
    !abc Execute last command in history beginning with abc
    !abc:p Print last command in history beginning with abc
    !n Execute nth command in history
    !$ Last argument of last command
    !^ First argument of last command
    ^abc^xyz Replace first occurance of abc with xyz in last command and execute it
  11. @tuxfight3r tuxfight3r revised this gist Nov 18, 2020. 1 changed file with 14 additions and 6 deletions.
    20 changes: 14 additions & 6 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -11,8 +11,8 @@ Bash
    | ctrl + f | move forward one character |
    | alt + f | move cursor FORWARD one word |
    | alt + b | move cursor BACK one word |
    | ctrl-] + x | Where x is any character, moves the cursor forward to the next occurance of x |
    | alt-ctrl-] + x | Where x is any character, moves the cursor backwards to the previous occurance of x |
    | ctrl + ] + x | Where x is any character, moves the cursor forward to the next occurance of x |
    | alt + ctrl + ] + x | Where x is any character, moves the cursor backwards to the previous occurance of x |

    ## Other

    @@ -31,6 +31,7 @@ Bash
    | ctrl + y | paste (if you used a previous command to delete) |
    | ctrl + z | Place current process in background |
    | ctrl + _ | undo |
    | ctrl + x ctrl + u | Undo the last changes. ctrl+ _ does the same |
    | esc + t | Swap last two words before the cursor |
    | esc + . | |
    | esc + _ | |
    @@ -43,19 +44,19 @@ Bash
    | alt + c | |
    | alt + l | |
    | alt + n | |
    | alt + p | |
    | alt + r | |
    | alt + p | Non-incremental reverse search of history. |
    | alt + r |Undo all changes to the line|
    | alt + ctl + e |Expand command line. |
    | alt + t | |
    | alt + u | |
    | ~[TAB][TAB] | List all users |
    | $[TAB][TAB] | List all system variables |
    | @[TAB][TAB] | List all entries in your /etc/hosts file |
    | [TAB] | Auto complete |
    | !! | Run PREVIOUS command (ie `sudo !!`) |
    | !vi | Run PREVIOUS command that BEGINS with vi |
    | cd - | change to PREVIOUS working directory |

    ## History

    | command | description |
    |----------|--------------------------------|
    | ctrl + r | Search backward starting at the current line and moving 'up' through the history as necessary |
    @@ -64,6 +65,13 @@ Bash
    | ctrl + n | Fetch the next command from the history list, moving forward in the list (same as down arrow) |
    | ctrl + o | Execute the command found via Ctrl+r or Ctrl+s |
    | ctrl + g | Escape from history searching mode |
    | !! | Run PREVIOUS command (ie `sudo !!`) |
    | !vi | Run PREVIOUS command that BEGINS with vi |
    | !vi:p | Print previously run command that BEGINS with vi |
    | !n | Execute nth command in history |
    | !$ | Last argument of last command |
    | !^ | First argument of last command |
    | ^abc^xyz | Replace first occurance of abc with xyz in last command and execute it |

    # Kill a job

  12. @tuxfight3r tuxfight3r revised this gist Nov 18, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,8 @@ Bash
    | ctrl + f | move forward one character |
    | alt + f | move cursor FORWARD one word |
    | alt + b | move cursor BACK one word |
    | ctrl-] + x | Where x is any character, moves the cursor forward to the next occurance of x |
    | alt-ctrl-] + x | Where x is any character, moves the cursor backwards to the previous occurance of x |

    ## Other

  13. @tuxfight3r tuxfight3r revised this gist Nov 18, 2020. 1 changed file with 15 additions and 8 deletions.
    23 changes: 15 additions & 8 deletions 01.bash_shortcuts_v2.md
    Original file line number Diff line number Diff line change
    @@ -17,16 +17,14 @@ Bash
    | command | description |
    |----------|--------------------------------|
    | ctrl + d | Delete the character under the cursor |
    | ctrl + l | Clear the screen (same as clear command) |
    | ctrl + p | Fetch the previous command from the history list, moving back in the list (same as up arrow) |
    | ctrl + n | Fetch the next command from the history list, moving forward in the list (same as down arrow) |
    | ctrl + h | Delete the previous character before cursor |
    | ctrl + u | Clear all BEFORE cursor |
    | ctrl + k | Clear all AFTER cursor |
    | ctrl + r | Search backward starting at the current line and moving 'up' through the history as necessary |
    | crtl + s | Search forward starting at the current line and moving 'down' through the history as necessary |
    | ctrl + w | delete the word BEFORE the cursor |
    | alt + d | delete the word FROM the cursor |
    | ctrl + l | Clear the screen (same as clear command) |
    | ctrl + c | kill whatever is running |
    | ctrl + d | Exit shell (same as exit command) |
    | ctrl + w | delete the word BEFORE the cursor |
    | ctrl + t | swap the last two characters before the cursor |
    | ctrl + y | paste (if you used a previous command to delete) |
    | ctrl + z | Place current process in background |
    @@ -41,7 +39,6 @@ Bash
    | alt + * | |
    | alt + . | print the LAST ARGUMENT (ie "vim file1.txt file2.txt" will yield "file2.txt") |
    | alt + c | |
    | alt + d | |
    | alt + l | |
    | alt + n | |
    | alt + p | |
    @@ -55,7 +52,17 @@ Bash
    | !! | Run PREVIOUS command (ie `sudo !!`) |
    | !vi | Run PREVIOUS command that BEGINS with vi |
    | cd - | change to PREVIOUS working directory |


    ## History
    | command | description |
    |----------|--------------------------------|
    | ctrl + r | Search backward starting at the current line and moving 'up' through the history as necessary |
    | crtl + s | Search forward starting at the current line and moving 'down' through the history as necessary |
    | ctrl + p | Fetch the previous command from the history list, moving back in the list (same as up arrow) |
    | ctrl + n | Fetch the next command from the history list, moving forward in the list (same as down arrow) |
    | ctrl + o | Execute the command found via Ctrl+r or Ctrl+s |
    | ctrl + g | Escape from history searching mode |

    # Kill a job

    n = job number, to list jobs, run `jobs`
  14. @tuxfight3r tuxfight3r revised this gist May 5, 2016. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  15. @tuxfight3r tuxfight3r renamed this gist May 5, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  16. @tuxfight3r tuxfight3r renamed this gist May 5, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  17. @tuxfight3r tuxfight3r revised this gist May 5, 2016. 1 changed file with 75 additions and 0 deletions.
    75 changes: 75 additions & 0 deletions bash_shortcuts_v2.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    Bash
    ====

    ## Moving

    | command | description |
    |----------|--------------------------------|
    | ctrl + a | Goto BEGINNING of command line |
    | ctrl + e | Goto END of command line |
    | ctrl + b | move back one character |
    | ctrl + f | move forward one character |
    | alt + f | move cursor FORWARD one word |
    | alt + b | move cursor BACK one word |

    ## Other

    | command | description |
    |----------|--------------------------------|
    | ctrl + d | Delete the character under the cursor |
    | ctrl + l | Clear the screen (same as clear command) |
    | ctrl + p | Fetch the previous command from the history list, moving back in the list (same as up arrow) |
    | ctrl + n | Fetch the next command from the history list, moving forward in the list (same as down arrow) |
    | ctrl + u | Clear all BEFORE cursor |
    | ctrl + k | Clear all AFTER cursor |
    | ctrl + r | Search backward starting at the current line and moving 'up' through the history as necessary |
    | crtl + s | Search forward starting at the current line and moving 'down' through the history as necessary |
    | ctrl + c | kill whatever is running |
    | ctrl + d | Exit shell (same as exit command) |
    | ctrl + w | delete the word BEFORE the cursor |
    | ctrl + t | swap the last two characters before the cursor |
    | ctrl + y | paste (if you used a previous command to delete) |
    | ctrl + z | Place current process in background |
    | ctrl + _ | undo |
    | esc + t | Swap last two words before the cursor |
    | esc + . | |
    | esc + _ | |
    | alt + [Backspace] | delete PREVIOUS word |
    | alt + < | Move to the first line in the history |
    | alt + > | Move to the end of the input history, i.e., the line currently being entered |
    | alt + ? | |
    | alt + * | |
    | alt + . | print the LAST ARGUMENT (ie "vim file1.txt file2.txt" will yield "file2.txt") |
    | alt + c | |
    | alt + d | |
    | alt + l | |
    | alt + n | |
    | alt + p | |
    | alt + r | |
    | alt + t | |
    | alt + u | |
    | ~[TAB][TAB] | List all users |
    | $[TAB][TAB] | List all system variables |
    | @[TAB][TAB] | List all entries in your /etc/hosts file |
    | [TAB] | Auto complete |
    | !! | Run PREVIOUS command (ie `sudo !!`) |
    | !vi | Run PREVIOUS command that BEGINS with vi |
    | cd - | change to PREVIOUS working directory |

    # Kill a job

    n = job number, to list jobs, run `jobs`

    ```bash
    kill %n
    ```

    Example:

    ```bash
    kill %1
    ```

    ## References

    1. http://cnswww.cns.cwru.edu/php/chet/readline/readline.html
  18. @tuxfight3r tuxfight3r created this gist Dec 17, 2014.
    27 changes: 27 additions & 0 deletions bash_keyboard_shortcuts.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@

    Ctrl-a Move to the start of the line.
    Ctrl-e Move to the end of the line.
    Ctrl-b Move back one character.
    Alt-b Move back one word.
    Ctrl-f Move forward one character.
    Alt-f Move forward one word.
    Ctrl-] x Where x is any character, moves the cursor forward to the next occurance of x.
    Alt-Ctrl-] x Where x is any character, moves the cursor backwards to the previous occurance of x.
    Ctrl-u Delete from the cursor to the beginning of the line.
    Ctrl-k Delete from the cursor to the end of the line.
    Ctrl-w Delete from the cursor to the start of the word.
    Esc-Del Delete previous word (may not work, instead try Esc followed by Backspace)
    Ctrl-y Pastes text from the clipboard.
    Ctrl-l Clear the screen leaving the current line at the top of the screen.
    Ctrl-x Ctrl-u Undo the last changes. Ctrl-_ does the same
    Alt-r Undo all changes to the line.
    Alt-Ctrl-e Expand command line.
    Ctrl-r Incremental reverse search of history.
    Alt-p Non-incremental reverse search of history.
    !! Execute last command in history
    !abc Execute last command in history beginning with abc
    !abc:p Print last command in history beginning with abc
    !n Execute nth command in history
    !$ Last argument of last command
    !^ First argument of last command
    ^abc^xyz Replace first occurance of abc with xyz in last command and execute it