Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Linux is a widely used operating system, but what is the language it follows? How do we pass arguments? How do we give commands? Let us find all these answers through this blog.
What Is A Command Line Interface?
Command-line interfaces are also called CLIs. CLIs take input commands that are entered by the keyboard and run them.
The command line interface in Linux systems is bash. It stands for Bourne again shell. The features of this shell include the characteristics of sh (the original Bourne shell), csh (the C shell), and ksh (the Korn shell).
Commands in Linux
Let us study each command one by one.
echo Command
As the name signifies, it echoes or returns the input we give.
Syntax
echo text
Output
Note that If the parts in the text are separated by white space, it is read as a separate argument. The white space is removed.
type Command
Type command is used to determine whether the given command is an external one or a built-in command.
Syntax
type cd
Output
touch Command
The touch command is used to make new files.
Syntax
touch file_name
Output
cat Command
We use cat to create a file, display the file content, copy the content, etc.
This command moves a file from one location to other.
Syntax
mv file_name path of the directory
Output
tac Command
cat, when reversed, is called tac. It shows the content of the file in a reversed manner.
Syntax
tac file_name
Output
date Command
Use the date command to see the date, time, time zone, and more.
Syntax
date
Output
sleep Command
This command gives rest to the terminal for a few seconds.
Syntax
Sleep time
Output
time Command
Time command tells the time to run a command.
Syntax
time
Output
df Command
If you need to see the disk space used in the file system, use df.
Syntax
df
Output
exit Command
Exit command takes you out of the shell
Syntax
exit
Output
To exit the terminal, you must press the ENTER key on your keyboard.
clear Command
Clear command empties the terminal
Syntax
clear
Output
Press the ENTER key on the keyboard to clear the terminal screen.
Arguments in Linux
The primary feature of a shell is to scan the command line. When we enter an output, it generates an output for the same. It cuts the line in arguments. While the system does the task of scanning, it makes some changes to the typed arguments. We refer to this process as shell expansion.
Syntax
command argument
White Space Elimination
White spaces occupy the space although they are not visible. They get removed while showing results.
Syntax
echo text
Example
Single and Double Quotes
In case you want to include the white spaces, you need to use single and double quotes. In that case, Linux echo will treat them as a single command.
Syntax
echo 'text'
echo "text"
Space and Line
In order to add a tab space or start a new line, use the ‘echo -e’ command. To add a new line use '\n' and '\t' to add a tab space. We can use both single or double quotes.
Syntax:
echo -e ‘text’
echo -e “text”
Frequently Asked Questions
What is the full form of BASH?
BASH stands for Bourne again shell.
State the difference between cat and tac commands.
The Cat command correctly displays the file's content, while the tac command displays it in reverse order.
Which command displays the disk space?
df command displays the disk space.
What is the difference between exit and clear commands?
exit command takes you out of the terminal while the clear command cleans the terminal.
How do we remove a file using some command in the terminal?
We can use the rm command to remove a file.
Conclusion
This article has discussed the commands and arguments in the Linux Operating System. We have studied each command one by one. We hope you got clarity on this topic. To read more about Linux, refer to the following articles-