What are your favorite BASH shortcuts?

As a SysAdmin/DevOps, I spend a lot of my day in the terminal.

Here are my favorite shortcuts!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The below two are particularly useful if you have a very long command.

  • Delete everything from the cursor to the end of the line:
Ctrl + k
  • Delete everything from the cursor to the start of the line:
Ctrl + u
  • Delete one worked backwards from cursor:
Ctrl + w
  • Search your history backwards, this is probably the one that I use the most, it is really handy and speeds up my work-flow a lot:
Ctrl + r
  • Clear the screen, I use this instead of typing the clear command:
Ctrl + l
  • Stops the output to the screen:
Ctrl + s
  • Enable the output to the screen in case that previously stopped by Ctrl + s:
Ctrl + q
  • Terminate the current command
Ctrl + c
  • Throw the current command to background:
Ctrl + z

I use those constantly every day and it saves me a lot of time.

If I’ve missed any feel free to share them in the comments below!

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

To go back to the [char] character in the current line.

ctrl + alt + ] + [char]

To go forward to the [char] character on the current line.

ctrl + ] + [char]

To swap two char around the cursor position.

ctrl + t