Introduction to Linux Terminal
In the Linux operating system, The Linux Terminal is a program where users put Linux commands and Terminal gives it to the operating system to process it, after processing output is shown on the terminal window. In simple words, Linux Terminal is an interface in which you can type and execute text-based commands. Linux terminal can be very useful when you are not able to use the graphical user interface application because of any system crash or configuration issue. In such cases, Linux terminal are very useful.
Below are the lists of alternative names for the terminal:
- Command prompt
How to Open Linux Terminal Window?
Option 1) – Search for keyword Terminal then click the relevant icon to open a new terminal session.
Option 2) – The easiest way to open a terminal window is to use the shortcut CTRL+ALT+T or press Alt+F2, type in gnome-terminal, and press enter. Entering this shortcut will instantly open the terminal window.
Option 3) – Right-click anywhere on your desktop wallpaper and select Open Terminal.
Advantages of using Linux Terminal
It is much faster when it comes to completing some task using Terminal than any graphical user interface. Command-Line of Linux is very advanced and for development purpose, we can perform most of our work using the command-line interface. We can install different repositories and packages by using the command-line interface. Another advantage is that with Linux Terminal we have many options with commands and scripts. A simple terminal task of installing an application can be done within a single command, compared to navigating through GUI windows.
Linux Terminal enables you to use Linux in ways that any other GUI cannot, For example in the scripting of repetitive tasks. You can write a script to continuously monitor the system to check disk usage and send mail when it reaches a particular level.
Linux terminal can be used for multi-tasking purpose batch works like printing a large file or downloading a large file then we can concurrently perform other tasks using another terminal window. Linux is good in handling such multitasking and will have no impact on our system.
Basic Concept of Linux Terminal
The first thing that you see in the terminal window is like below:
As per the above screenshot, it is known as the prompt window. It is ready for the user commands or the user inputs. In the above case, the login user name is “linux” and the hostname is “learning”.
- The “@” symbol is used to divide the login user i.e. “linux” and the hostname i.e. “learning”.
- The “:” symbol (colon) is used to separate the “learning” as a hostname from the current login or working directory.
- The “$” symbol will represent that it is a normal user and it is not having the superuser rights. The login user is not a superuser.
- The “#” symbol will represent that it is a superuser and it is having all the superuser rights.
- The Linux shell window or the terminal is straight or direct access of the Linux operating system.
- In the Linux environment, if we will kill the terminal windows then the application running in the same window will also be terminated.
- The terminal is known as the interpreter for the commands. To communicate with the operating system.
- The output of any job or the command returns some value. The same value will print or display on the same output screen.
- On the terminal window, we can pass the input as an argument. The same arguments will provide as an input to the entered command.
Lets us discuss command syntax.
As per the requirement, we can use different commands in the Linux terminal window. The command may vary as per the user, application or job, operating system, etc. Here, we are just using the single command in the Linux terminal.
As per the above command, we are running “ls” command in the terminal window. It will print the “ls” command output.
Command with Argument
In the Linux environment, we are having the functionality to pass or provide the arguments to the command.
As per the above command, we are using the cat command with an argument i.e. file name (test1.txt).
Command with Default Option
In the Linux ecosystem, some of the commands are running with the default argument or the parameters.
As per the above command, we are listing the number of files recursively. It will print the command output on the same terminal window.
Run Multiple Commands
If we need to complete the complex job or complex command, we need to run multiple commands with different combinations. In the Linux terminal, we are having the functionality to run such commands.
grep LINUX test1.txt ;grep Good test2.txt;
As per the above command, we are running the two grep commands at the same time.
Command with Pipe
When you need to use the output from command 1 as the input into command 2, then you would use pipe character ‘|’. Kindly find the below syntax of the pipe.
ls | sort
In the above command, we are using the pipe option in-between is and sort command.
Basic Linux Terminal Commands
- Clear command is used to clear the terminal if it gets accumulated with too many commands.
- To stop any command in the terminal safely Ctrl+Ccan be used. If it doesn’t stop with that, then use Ctrl+Z to force stop it.
- Use the exit command to get exit from the terminal.
- To power off or reboot the computer by using the command line use Sudo halt and sudo reboot.
We have seen the basic concept of “Linux terminal” with the proper example, explanation, and command with different outputs. It is very important to understand all basics of Linux commands. While running the commands on the terminal window is very quick and fast because it is directly communicating with the OS.
This is a guide to Linux Terminal. Here we also discuss the introduction and How to Open Linux Terminal Window? along with commands and advantages. You may also have a look at the following articles to learn more –