Terminal : it is the most important part of the linux system. it is interface between user and os. it allow user to interact with a shell. when we submit command by pressing enter key from terminal, it gets send to shell for execution. When command complete it’s task. shell give response to terminal and then terminal print that response. terminal is also known as command prompt or command line.
Following are the ways to open terminal
- To open terminal right click on blank space of desktop or directory and select 'Open in Terminal'
- Use shortcut ctrl + alt + t ( open Terminal with path of Home Directory)
Terminal Path or Shell Prompt : whenever you open terminal you will see terminal path on terminal. Here it is “ubuntu@ubuntu-inspiron-3542:~/Desktop$”. following table explain this terminal path.
||this is user name (ls /home/ command prints user name)|
||this is device name (to change/view device name go to Settings > Details)|
||this shows we are using home directory ($HOME command print user home directory)|
||this is the directory where terminal is open|
||this shows that we are using Bash shell|
Terminal Tabs and Window : to open tab click on + on terminal menu. it will open new tab. to close tab click on × button given on that tab. to open new window execute gnome-terminal command or right click on terminal app icon and select new window.
following table shows shortcuts for terminal.
|shift + ctrl + t||open new tab|
|shift + ctrl + w||close tab|
|shift + ctrl + n||open new window|
|shift + ctrl + q||close window|
|shift + ctrl + c||copy the selected content|
|shift + ctrl + v||paste copied content|
|ctrl + a or Home key||move cursor to beginning of line|
|ctrl + e or End key||move cursor to ending of line|
Tab key : tab key is used as auto complete on terminal. in this when we press tab key on terminal one program is executed that try to complete that word. You can auto complete directory (folder) name, command name, file name etc.
type “hist” on terminal and press tab key. Now you will see “ory” is appended so the “hist” this is due to the auto completion by tab key which complete the word “history”.
Now type “hi” on terminal and press tab key. Nothing happened. This is because there are 2 or more entries are available for auto completion. so tab key for auto completion will not work . Now press tab key 2 times you will see 2 or more command that can auto complete the word “hi” on terminal. See following terminal output.
Terminal Location :
pwd (print working directory) command is used to display path of directory (folder) where terminal is open. it print full path from root directory(/).
In following example terminal path/location is “/home/ubuntu/Desktop”
Terminal History : history command is used to display list of previously executed command on terminal. You can use arrow up and down key to see previously executed commands on terminal.
Cleaning Terminal :
clear command is used to clean terminal output.
See following 2 examples.
Terminal before clear command.
Terminal after clear command.
Interrupt key : if command or program is executing and you want to abort or interrupt command or program execution you can use ctrl + c shortcuts.
in following example we find files having "c" extension in root directory but before find command complete it's task we interrupt or abort or cancel execution of find command by pressing ctrl + c. at the end of output ^c means ctrl + c pressed or used.
. and.. : Terminal hold 2 values of. (dot) and ..(Double dot) .dot(.) represents current directory and .. (Double dots) represents parent directory.