Bash shortcuts that let you boost command-line efficiency [FULL VERSION]

Source: Internet
Author: User
Tags clear screen uppercase letter

Living in the Bash shell, memorizing the following shortcuts will greatly improve the efficiency of your command line operations.

Edit command
    • Ctrl + A: Move to the beginning of the command
    • Ctrl + E: Move to the end of the command line
    • Ctrl + F: Move forward by character (right)
    • Ctrl + B: Move back by character (left)
    • Alt + F: Move forward by word (right)
    • Alt + B: Move back by word (left)
    • Ctrl + XX: Moves between the beginning of the command line and the cursor
    • Ctrl + u: Delete from cursor to beginning of command
    • Ctrl + K: delete from cursor to end of command line
    • Ctrl + W: Delete from the cursor to the top of the word
    • Alt + D: Delete from the cursor to the end of the word
    • Ctrl + D: Remove the character at the cursor
    • Ctrl + H: Delete the characters before the cursor
    • Ctrl + y: After pasting to the cursor
    • Alt + C: Change the word from the cursor to the uppercase letter
    • Alt + u: Change from the cursor to all uppercase words
    • Alt + L: Change from cursor to all lowercase words
    • Ctrl + t: Swap cursor and previous characters
    • Alt + t: Swap cursor and previous words
    • Alt + Backspace: Same as Ctrl + W ~ ~ ~ Similar, delimiter some difference [thanks Rezilla]
Re-execute command
    • Ctrl + r: Reverse Search Command History
    • Ctrl + G: Exit from History search mode
    • Ctrl + P: previous command in history
    • Ctrl + N: The next command in history
    • Alt +.: Use last parameter of previous command
Control commands
    • Ctrl + L: Clear screen
    • Ctrl + O: Executes the current command and selects the previous command
    • Ctrl + S: Block screen output
    • Ctrl + Q: Allow screen output
    • Ctrl + C: Terminate command
    • Ctrl + z: Suspend command
Bang (!) command
    • !! : Executes the previous command
    • !blah: Executes the most recent command starting with Blah, such as!ls
    • !blah:p: Print output only, without performing
    • !$: The last parameter of the previous command, with Alt +. Same
    • !$:p: Print out the contents of the!$
    • !*: All parameters of the previous command
    • !*:p: Print out the contents of the!*
    • ^blah: Delete blah from previous command
    • ^blah^foo: Replace blah in the previous command with Foo
    • ^blah^foo^: Replace all blah in the previous command with Foo

_ Friendly Tips _:

    1. Most of the Bash shortcuts described above only work when in Emacs edit mode, and if you configure Bash as VI edit mode, it will follow the VI key bindings. Bash defaults to emacs edit mode. If your Bash is not in Emacs edit mode, you can set -o emacs set it up.

    2. ^s, ^q, ^c, ^z are processed by the terminal equipment, can be set by the stty command.

Source Address: https://linuxtoy.org/archives/bash-shortcuts.html

Bash shortcuts that let you boost command-line efficiency [FULL VERSION]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.