50 Linux Commands List With Examples
50 Linux Commands List With Examples
Advertisement
Linux Tutorial
Linux Tutorial
Advantages of Linux
Linux History
Linux Features
Linux Bash *
Unix vs Linux
Linux vs Windows
Linux Distributions
Linux Licensing
Linux Directories
Advertisement
Linux Directories
Linux pwd
Advertisement
Linux cd
Linux ls
Linux mkdir
Linux rmdir
c) mkdir -m -mode=MODE
Linux Commands
https://www.javatpoint.com/linux-commands 1/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Linux Users
Advertisement
Li U
← prev next →
Advertisement
Linux provides a powerful command-line interface compared to other operating systems such as Windows and MacOS.
We can do basic work and advanced work through its terminal. We can do some basic tasks such as creating a file,
deleting a file, moving a file, and more. In addition, we can also perform advanced tasks such as administrative tasks
(including package installation, user management), networking tasks (ssh connection), security tasks, and many more.
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.
In this topic, we will discuss the top 50 most frequently used Linux commands with their examples. These commands
are very useful for a beginner and professional both. We have divided these commands into following sections so that
Advertisement
you can easily identify their usage:
Advertisement
https://www.javatpoint.com/linux-commands 2/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
The pwd command is used to display the location of the current working directory.
Syntax:
Advertisement
pwd
Output:
2. mkdir Command
Advertisement
India ✈ Dubai
from Rs14,332
View
India ✈ Malaysia
from Rs5,164
View
Advertisement
The mkdir command is used to create a new directory under any directory.
Syntax:
Advertisement
mkdir <directory name>
Output:
3. rmdir Command
Syntax:
Output:
https://www.javatpoint.com/linux-commands 3/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
4. ls Command
Syntax: Advertisement
Advertisement
ls
Output:
Advertisement
Advertisement
5. cd Command
Advertisement
Syntax:
https://www.javatpoint.com/linux-commands 4/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
cd <directory name>
Output:
Advertisement
The touch command is used to create empty files. We can create multiple empty files by executing it once.
Advertisement
Syntax:
Advertisement
India ✈ Dubai
*
Output:
Advertisement
7. cat Command
Advertisement
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:
https://www.javatpoint.com/linux-commands 5/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
*
8. rm Command
Syntax:
rm <file name>
Output:
9. cp Command
Advertisement
Advertisement
India ✈ Dubai
from Rs14,332
India ✈ Malaysia
India ✈ Thailand
from Rs11,682
*
Syntax:
Output:
10. mv Command
The mv command is used to move a file or a directory form one location to another location.
https://www.javatpoint.com/linux-commands 6/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Syntax:
Output:
Advertisement
The rename command is used to rename files. It is useful for renaming a large group of files.
Syntax: Advertisement
For example, to convert all the text files into pdf files, execute the below command:
Output:
Advertisement
Advertisement
The head command is used to display the content of a file. It displays the first 10 lines of a file.
Syntax:
Output:
https://www.javatpoint.com/linux-commands 7/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
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. It is useful for reading the error message.
Syntax:
Advertisement
Output:
Advertisement
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:
https://www.javatpoint.com/linux-commands 8/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
The more command is quite similar to the cat command, as it is used to display the file content in the same way that the
Advertisement
cat command does. The only difference between both commands is that, in case of larger files, the more command
displays screenful output at a time.
In more command, the following keys are used to scroll the page:
Syntax:
Output:
Advertisement
Advertisement
The less command is similar to the more command. It also includes some extra features such as 'adjustment in width
and height of the terminal.' Comparatively, the more command cuts the output in the width of the terminal.
Syntax:
https://www.javatpoint.com/linux-commands 9/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Output:
Advertisement
Advertisement
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:
Advertisement
18. id Command
The id command is used to display the user ID (UID) and group ID (GID).
Syntax: Advertisement
id
Output:
Syntax:
useradd username
Output:
https://www.javatpoint.com/linux-commands 10/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
The passwd command is used to create and change the password for a user.
Advertisement
Syntax:
passwd <username>
Output: Advertisement
Syntax:
Output:
The cat command is also used as a filter. To filter a file, it is used inside pipes.
Syntax:
Advertisement
cat <fileName> | cat or tac | cat or tac |. . .
Output:
The cut command is used to select a specific column of a file. The '-d' option is used as a delimiter, and it can be a space
(' '), a slash (/), a hyphen (-), or anything else. And, the '-f' option is used to specify a column number.
Syntax:
https://www.javatpoint.com/linux-commands 11/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Output:
Advertisement
Advertisement
The grep is the most powerful and used filter in a Linux system. The 'grep' stands for "global regular expression print." It
is useful for searching the content from a file. Generally, it is used with the pipe.
Syntax:
Output:
The 'comm' command is used to compare two files or streams. By default, it displays three columns, first displays non-
matching items of the first file, second indicates the non-matching item of the second file, and the third column displays
Advertisement
the matching items of both files.
Syntax:
Output:
The sed command is also known as stream editor. It is used to edit files using a regular expression. It does not
permanently edit files; instead, the edited content remains only on display. It does not affect the actual file.
https://www.javatpoint.com/linux-commands 12/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Syntax:
Output:
Advertisement
Syntax:
Output:
Advertisement
28. tr Command
The tr command is used to translate the file content like from lower case to upper case.
Syntax:
Advertisement
Output:
The uniq command is used to form a sorted list in which every word will occur only once.
Syntax:
Output:
https://www.javatpoint.com/linux-commands 13/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
30. wc Command
Advertisement
The wc command is used to count the lines, words, and characters in a file.
Syntax:
wc <file name>
Advertisement
Output:
31. od Command
The od command is used to display the content of a file in different s, such as hexadecimal, octal, and ASCII characters.
Syntax:
Output:
Advertisement
Advertisement
Syntax:
Output:
https://www.javatpoint.com/linux-commands 14/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
The gzip command is used to truncate the file size. It is a compressing tool. It replaces the original file by the compressed
file having '.gz' extension.
Syntax:
Advertisement
Output:
The gunzip command is used to decompress a file. It is a reverse operation of gzip command.
Syntax:
Output:
Advertisement
The find command is used to find a particular file within a directory. It also supports various options to find a file such as
byname, by type, by date, and more.
Syntax:
https://www.javatpoint.com/linux-commands 15/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Output:
Advertisement
Advertisement
The locate command is used to search a file by file name. It is quite similar to find command; the difference is that it is a
background process. It searches the file in the database, whereas the find command searches in the file system. It is
faster than the find command. To find the file with the locates command, keep your database updated.
Syntax:
Output:
Advertisement
Advertisement
37. date Command
The date command is used to display date, time, time zone, and more.
Syntax:
date
Output:
The cal command is used to display the current month's calendar with the current date highlighted.
Syntax:
cal<
Output:
https://www.javatpoint.com/linux-commands 16/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
The sleep command is used to hold the terminal by the specified amount of time. By default, it takes time in seconds.
Syntax:
Advertisement
sleep <time>
Output:
Syntax:
time
Output:
Advertisement
Syntax: Advertisement
Output:
42. df Command
https://www.javatpoint.com/linux-commands 17/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
The df command is used to display the disk space used in the file system. It displays the output as in the number of used
blocks, available blocks, and the mounted directory.
Syntax:
df Advertisement
Output:
Advertisement
The mount command is used to connect an external device file system to the system's file system.
Syntax:
Output:
Advertisement
Advertisement
Linux exit command is used to exit from the current shell. It takes a parameter as a number and exits the shell with a
return of status number.
Syntax:
exit
Output:
Syntax:
https://www.javatpoint.com/linux-commands 18/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
clear
Output:
Advertisement
Advertisement
After pressing the ENTER key, it will clear the terminal screen.
Linux ip command is an updated version of the ipconfig command. It is used to assign an IP address, initialize an
interface, disable an interface.
Syntax:
ip a or ip addr
Output:
Advertisement
Advertisement
Linux ssh command is used to create a remote connection through the ssh protocol.
Syntax:
ssh user_name@host(IP/Domain_name)</p>
The mail command is used to send emails from the command line.
Syntax:
https://www.javatpoint.com/linux-commands 19/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Output:
The ping command is used to check the connectivity between two nodes, that is whether the server is connected. It is a
short form of "Packet Internet Groper."
Syntax:
Advertisement
ping <destination>
Output:
The host command is used to display the IP address for a given domain name and vice versa. It performs the DNS
lookups for the DNS Query.
Syntax:
Output:
Advertisement
← prev next →
https://www.javatpoint.com/linux-commands 20/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Related Posts
Advertisement
Advertisement
Python Java
Javascript HTML
Database PHP
https://www.javatpoint.com/linux-commands 21/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
C++ React
B.Tech / MCA
Advertisement
Data
Advertisement DBMS
Structures
Operating
DAA
System
Computer Compiler
Network Design
Advertisement
Computer Discrete
Organization Mathematics
Advertisement
Ethical Computer
Hacking Graphics
Web Software
Technology Engineering
https://www.javatpoint.com/linux-commands 22/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Cyber Automata
Security
Advertisement
C
C++
Programming
Advertisement
Java .Net
Python Programs
Control Data
System Warehouse
Advertisement
Preparation
Advertisement
Aptitude Reasoning
Verbal Interview
Ability Questions
Company
Questions
https://www.javatpoint.com/linux-commands 23/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement *
Home Python Java JavaScript HTML SQL PHP C# C++ DS
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 24/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 25/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 26/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 27/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 28/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 29/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 30/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 31/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 32/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 33/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 34/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 35/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 36/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 37/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 38/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 39/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 40/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 41/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 42/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 43/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Advertisement
https://www.javatpoint.com/linux-commands 44/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
https://www.javatpoint.com/linux-commands 45/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Advertisement
Contact info
Follow us
Latest Post
PRIVACY POLICY
Tutorials
Java
Data Structures
C Programming
C++ Tutorial
C# Tutorial
PHP Tutorial
HTML Tutorial
JavaScript Tutorial
jQuery Tutorial
Spring Tutorial
Interview Questions
Tcs
Intuit
https://www.javatpoint.com/linux-commands 46/47
1/27/25, 10:49 AM 50 Linux Commands List with Examples - javatpoint
Wipro
Adobe
Infosys
Amazon
Advertisement
Accenture
Cognizant
Capgemini
Microsoft
Online Compiler
C
R
C++
Php
Java
Html
Swift
Python
JavaScript
TypeScript
https://www.javatpoint.com/linux-commands 47/47