Useful Linux Terminal Shortcuts.

This is the collection of Linux Terminal shortcuts that might be useful for you.


Shortcuts' List:

Up/Down Arrows: The up and down arrows on your keyboard move through your last used commands. So, if you wanted to run the second to last command you ran, just hit the up arrow twice and hit Enter. You can also edit the command before you run it.


Home or Ctrl + A move the cursor to the beginning of the line. End or Ctrl + E moves you back to the end.


Shift + PageUp and Shift + PageDown: These are used for scrolling.


Ctrl+U: This clears the entire line so you can type in a completely new command.


CTRL+SHIFT+C: To copy selected text.


CTRL+SHIFT+V: To paste you last copied 

Pressing Tab completes the name of the current command or directory.
Let’s imagine you’re navigating to your downloads folder using this line:
cd /home/user/Downloads
You can hit tab once you’re at cd /home/user/Dow to automatically finish the word.
Say you want to install a bunch of apps using apt-get install. You can type apt-get ins and hit tab.
When the terminal can’t predict what you’re trying to say, it typically lets you know with a beep.
If you type a part of the command and press Tab twice, it'll show you all the commands that have the written part in the start.


Let’s say you’re looking to repeat a command you just issued, but with root privileges. Chances are you forgot to begin the line with sudo. In that case, rather than retyping the entire command, you can simply enter:
sudo !!
The double exclamation(!!) points tell the terminal that you want to re-enter the previous line.



Sometimes typos happen. In the terminal, they stop commands from working.
Suppose you want to see the man page of sudo. You open your terminal and type:
man sudp
To correct this you can enter ^sudp^sudo


Ctrl+C: Interrupt (kill) the current foreground process running in in the terminal. This sends the SIGINT signal to the process, which is technically just a request—most processes will honor it, but some may ignore it.


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.


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 a lot of long, 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.


Comments