Keyboard Shortcuts While Using Terminal (Linux or Macos)

Spread the love

The default command line shell language Bash is well known between the coders. To all the coders and geeks out there, are you aware of the shortcuts that can be used while coding in Bash? Well, if not, here are some for your help.

Keyboard Shortcuts While Using Terminal (Linux or Macos)

While coding for Processes

Ctrl+C: Interrupt (kill) the current foreground process running in the terminal. This sends the SIGINT signal to the process, which is technically just a request.

Ctrl+Z: Suspend the current foreground process running in bash. This sends the SIGTSTP signal to the process. To return the process to the foreground later, use the fg process_name command.

Ctrl+D: Close the bash shell. This sends an EOF (End-of-file) marker to bash, and bash exits when it receives this marker. This is similar to running the exit command.

While controlling the screen

Ctrl+L: Clear the screen. This is similar to running the “clear” command.

Ctrl+S: Stop all output to the screen. This is particularly useful when running commands with lot of long and verbose output, but you don’t want to stop the command itself with Ctrl+C.

Ctrl+Q: Resume output to the screen after stopping it with Ctrl+S.

While moving the cursor

Ctrl+A or Home: Go to the beginning of the line.

Ctrl+E or End: Go to the end of the line.

Alt+B: Go left one word.

Ctrl+B: Go left one character.

Alt+F: Go right one word.

Ctrl+F: Go right one character.

Ctrl+XX: Move between the beginning of the line and the current position of the cursor. Press Ctrl+XX to return to the start of the line, change something, and then press Ctrl+XX to go back to your original cursor position. To use this shortcut, hold the Ctrl key and tap the X key twice.

Well friends, hope this was helpful for you. Do let us know your thoughts in the comments below.


Be the first to comment

Leave a Reply

Your email address will not be published.