Scideas Solutions Pvt. Ltd. Salesforce Best Keyboard Shortcuts for Bash Terminal

Best Keyboard Shortcuts for Bash Terminal

0 Comment

Best Keyboard Shortcuts for Bash Terminal

1. Use tab for auto completion

Tab: Automatically complete the file, directory, or command you’re typing.

2. Switch back to the last working directory
scideas@scideas-Aspire-E5-553:~$ cd –

3. Go back to home directory
scideas@scideas-Aspire-E5-553:~$ cd ~

or

scideas@scideas-Aspire-E5-553:~$ cd

4. List the contents of a directory
scideas@scideas-Aspire-E5-553:~$ ll

5. Running multiple commands in one single command
command_1; command_2; command_3

Running multiple commands in one single command only if the previous command was successful
command_1 && command_2

Running multiple command

 

6. Easily search and use the commands that you had used in the past scideas@scideas-Aspire-E5-553:~$ ctrl+r search_term

7. Unfreeze your Linux terminal from accidental Ctrl+S (after pressing Ctrl+s every typed character store in buffer)

scideas@scideas-Aspire-E5-553:~$ ctrl+Q

8. Move to beginning or end of line on terminal
Ctrl+A to go to the beginning of the line and Ctrl+E to go to the end.

9. Reading a log file in real time

scideas@scideas-Aspire-E5-553:~$tail -f path_to_Log

scideas@scideas-Aspire-E5-553:~$tail -f path_to_log | grep search_term

10. Copy Paste in Linux terminal
Ctrl+Shift+C for copy and Ctrl+Shift+V for paste

11. Stop a running command/process
Ctrl+C

12. Empty a file without deleting it

scideas@scideas-Aspire-E5-553:~$ > filename

13. Clear terminal screen

Ctrl+l

14. repeat your last command

scideas@scideas-Aspire-E5-553:~$ !!

15. clears the content you’ve typed already. Try this when you want to clear the password field in the command line.

CTRL-u moves all the string since the begin of the line (until cursor position) to a buffer. You can paste it from the buffer using CTRL-Y. Try! It’s nice!
Ctrl+u

16. give us user information

scideas@scideas-Aspire-E5-553:~$ w

17. closing terminal with key combination (ubuntu)

Ctrl+d

18. Opening new terminal tab with key combination (ubuntu)

Ctrl+alt+t

 

19. Terminate an application with xkill.

Process stop responding and after clicking on closing button application not closed then we have option to kill that process explicitly with kill command passing it that process id but we have a cool utility in Ubuntu xkill which easy to kill a process with pointing a mouse over that process and click right mouse button. Below video is an example of xkill.

 

19. Open a process in background

We can run a command in background after appending simply  ‘&’ at last of that command and it start running in background.

However in some case when we open an application with terminal then it process state start dumping it’s output on terminal and it’s become impossible to work on same terminal due to verbose output of application.

In this case we can press Ctrl+z and our application process stop running but process not terminated and terminal return back to us for accepting other commands. We can check it with process command (ps), which return process list as output with their process id and terminal details.

if you want to resume previous application then we can simply make it foreground process with (fg) command and application process resume.

you can use Ctrl+c combination key to close running process from terminal.

 

Leave a Reply

Your email address will not be published. Required fields are marked *