Linux Commands
Linux Commands
The Linux command is a utility of the Linux operating system. All basic and advanced tasks can be done by
executing commands. The commands are executed on the Linux terminal. The terminal is a command-line
interface to interact with the system, which is similar to the command prompt in the Windows OS. Commands
in Linux are case-sensitive.
Linux terminal is a user-friendly terminal as it provides various support options. To open the Linux terminal,
press "CTRL + ALT + T" keys together, and execute a command by pressing the 'ENTER' key.
The pwd command is used to display the location of the current working directory.
Syntax:
pwd
Output:
2. mkdir Command
The mkdir command is used to create a new directory under any directory.
Syntax:
Output:
3. rmdir Command
Syntax:
Output:
4. ls Command
Syntax:
ls
Output:
5. cd Command
Syntax:
1. cd <directory name>
Output:
The touch command is used to create empty files. We can create multiple empty files by
executing it once.
Syntax:
Output:
7. cat Command
The cat command is a multi-purpose utility in the Linux system. It can be used to create a
file, display content of the file, copy the content of one file to another file, and more.
Syntax:
Press "CTRL+ D" keys to save the file. To display the content of the file, execute it as
follows:
Output:
8. rm Command
Syntax:
rm <file name>
Output:
9. cp Command
Output:
Output:
10. mv Command
The mv command is used to move a file or a directory form one location to another
location.
Syntax:
Output:
use the following syntax to rename a file in Linux with the mv command:
mv old_filename.txt new_filename.txt
The head command is used to display the content of a file. It displays the first 10 lines of a
file.
Syntax:
The tail command is similar to the head command. The difference between both
commands is that it displays the last ten lines of the file content.
Syntax:
Output:
The tac command is the reverse of cat command, as its name specified. It displays the file
content in reverse order (from the last line).
Syntax:
Output:
Linux User Commands
14. su Command
The su command provides administrative access to another user. In other words, it allows
access of the Linux shell to another user.
Syntax:
su <user name>
Output:
Syntax:
useradd username
Output:
The passwd command is used to create and change the password for a user.
Syntax:
passwd <username>
Output: