Skip to content
Related Articles

Related Articles

Few Tips for Fast & Productive Work on a Linux Terminal
  • Last Updated : 11 Oct, 2019

This article is aimed at making you more productive and waste less time on running commands by providing you the information about Linux Terminal’s Shortcut & Tricks. In simple words, less time you take to complete a task the more professional you become!

1. Opening the Linux Terminal (Ubuntu): The Linux terminal can be opened from a window or home screen by pressing:


2. Opening a New Terminal Tab in Existing Terminal: This can be achieved by pressing:


3. Closing a Terminal Window: We can close an existing terminal window by pressing:


Note: Pressing this key combination when only one terminal window is open will result in the closing of the entire terminal window.

4. Spawning Recently Executed Commands by Up-Arrow Key: You can bring recently executed commands into the current cursor line and directly hit enter if you want to execute it again without the need to type it again by pressing the Up-Arrow Key. Press Up-Arrow Key multiple times to keep going further back on the executed commands and press the Down-Arrow Key and Up-Arrow Key on your keyboard to browse through the executed commands.

5. Start Writing from the Top Most Line on an Existing Terminal Again: Sometimes you face a situation where you want to execute a command from a new line to get a fresh look without closing the terminal as it would clear the sequence or history of the commands executed due to debugging reason. This can be achieved by pressing:


6. Deleting Entire Line of Terminal Code: Instead of tiring multiple backspaces to erase the current line of command or code letter by letter, you can delete word by word by pressing:


7. Running Multiple Commands in a Single Line: You can run multiple commands in one single line by writing them in the following manner:

Command 1;Command 2

Why wait for one command to get executed first, then type the next one when they can be run at the same time!

Note: Only two commands are shown here but multiple commands can be run in this manner.

8. Run Multiple Commands in Successions in a Single Line Only if the Previous Commands had Successfully executed: Suppose, you have to run multiple commands in successions to test code for a program but for this you need to make sure that the commands only get executed if the previous command was successful. For this you can use the command in the following manner:


9. Force Stopping a Running Command: Sometimes the program goes into an infinite loop or you want to terminate a program, mid-way of its completion. To force stop a program you can use Keyboard Interrupt:


Or you can also use:


10. Reverse Search Used Commands and Re-Execute them if needed: Commands once executed in a terminal can be reversed searched by pressing:


And, you can hit enter after the commands are searched for and brought onto the current line by pressing the Enter Key or Return key

11. Unfreezing the Linux Terminal: Sometimes the terminal may freeze due to errors while processing a command or some other problems like accidental pressing of Ctrl+S by people who have a habit of pressing Ctrl+S to save their work, which ends up freezing the terminal. To simply solve this, use the following:


Or, the Keyboard Interrupt Key:


Note: In the specific case of a terminal freeze occurring due to accidental Ctrl+S, press


Note: All the 3 key combinations will work for unfreezing the screen from an accidental Ctrl+S press but pressing Ctrl+Q will show commands or key presses that you may have had typed whislt the terminal was frozen due to an accidental Ctrl+S press.

12. Using Aliases: We humans are habitual creatures, sometimes we use “print” instead of “echo” in a terminal or make frequent typos, this can be solved by using aliases. Aliases are like God-Sent for people that have learned multiple computer languages, terminal commands and get confused about what to use where until finally remembering the correct Command.

Example: Suppose a user used to write print instead of ‘echo’ in the Linux terminal since Python, Java and many other languages used ‘print’ to do the same function, thus, he or she solved it by typing:

alias print=echo

Now the terminal will interpret the ‘print’ as an ‘echo’ command.

13. Cutting & Pasting Command Before the Cursor: You can easily cut a text before the cursor by pressing:


and paste them by:

My Personal Notes arrow_drop_up
Recommended Articles
Page :