Top 50 Linux Commands with Examples, Definitions, and descriptions.
In this post, Top 50 Linux Commands with Examples, we have tried our best to explain each and every command with an example to make it easy to understand.
Here are the top 50 Linux commands with examples, along with definitions and descriptions:
ls command in linux:
Definition: To list all directory contents.
Description: To display the files and directories in the present directory.
Example:
$ ls
Desktop Downloads Music Videos
cd command in linux:
Definition: Change directory.
Description: To change the present working directory.
Example:
$ cd Documents
Top 50 Linux Commands with Examples
pwd command in linux:
Definition: Print working directory.
Description: To display the present working directory.
Example:
$ pwd
/home/user/Documents
mkdir command in linux:
Definition: Make a directory.
Description: To create a new directory.
Example:
$ mkdir new_directory
rm command in linux:
Definition: Remove files or directories.
Description: To delete files or directories.
Example:
$ rm file.sh
cp command in linux:
Definition: Copy files and directories.
Description: To copy files or directories from one location to another.
Example:
$ cp file.sh /path/destination
mv command in linux:
Definition: Move or rename files or directories.
Description: To move files or directories to a new location or rename them.
Example:
$ mv file.sh /path/destination
touch command in linux:
Definition: Create an empty file.
Description: To create a new empty file or update the access and modification times of an existing file.
Example:
$ touch new_file.sh
cat command in linux:
Definition: Concatenate and display files.
Description: To display the contents of one or more files.
Example:
$ cat file.sh
grep command in linux:
Definition: Search for patterns in files.
Description: To search for lines matching a specified pattern in one or more files.
Example:
$ grep “pattern” file.sh
head command in linux:
Definition: Display the beginning of a file.
Description: To display the first few lines of a file or directory.
Example:
$ head file.sh
tail command in linux:
Definition: Display the end of a file.
Description: To display the last few lines of a file or directory.
Example:
$ tail file.sh
chmod command in linux:
Definition: Change file permissions.
Description: To change the permissions of a file or directory.
Example:
$ chmod 755 file.sh
chown command in linux:
Definition: Change file ownership.
Description: To change the owner and group of a file or directory.
Example:
$ chown user:group file.sh
sudo command in linux:
Definition: Execute a command as the superuser.
Description: To execute a command with root (superuser) privileges.
Example:
$ sudo apt-get install package
su command in linux:
Definition: Switch user or become superuser.
Description: To switch to another user account or become the superuser.
Example:
$ su username
apt-get command in linux:
Definition: Package handling utility for Debian-based systems.
Description: To install, remove, and manage software packages on Debian-based systems.
Example:
$ sudo apt-get install package
yum command in linux:
Definition: Package handling utility for RPM-based systems.
Description: To install, remove, and manage software packages on RPM-based systems.
Example:
$ sudo yum install package
tar command in linux:
Definition: Manipulate archive files.
Description: To create, view, extract, and manipulate a tar archive.
Example:
$ tar -cvf archive.tar files
df command in linux:
Definition: Display disk space usage.
Description: To show the free and used disk space on the file system.
Example:
$ df -h
du command in linux:
Definition: Estimate file space usage.
Description: To estimate the file space usage of directories or files.
Example:
$ du -sh directory
free command in linux:
Definition: Display amount of free and used memory in the system.
Description: To show the amount of free and used memory in the system.
Example:
$ free -h
top command in linux:
Definition: Display system activity in real time.
Description: To display system activities like CPU usage, memory usage, and running processes, in real time.
Example:
$ top
ps command in linux:
Definition: Report a snapshot of the current processes.
Description: To report a snapshot of the current processes running on the system.
Example:
$ ps aux
kill command in linux:
Definition: Terminate a process.
Description: To terminate a process by sending a signal to the process.
Example:
$ kill PID
ping command in linux:
Definition: Test a network connection.
Description: To test a network connection by sending ICMP echo request packets to a target host.
Example:
$ ping example.com
ifconfig command in linux:
Definition: Configure network interfaces.
Description: To display and configure network interface parameters.
Example:
$ ifconfig
scp command in linux:
Definition: Securely copy files between hosts.
Description: To securely copy files between hosts over a network.
Example:
$ scp file.sh user@remote_host:/path/destination
ssh command in linux:
Definition: Secure shell client.
Description: To allow users to securely connect to a remote server over a network.
Example:
$ ssh user@remote_host
wget command in linux:
Definition: Download files from the web.
Description: To download the files from the web using HTTP, HTTPS, or FTP protocols.
Example:
$ wget http://tutorialwale.com/file.sh
uname command in linux:
Definition: Print system information.
Description: To display system information such as kernel version, hostname, and processor architecture.
Example:
$ uname -a
date command in linux:
Definition: Display or set the system date and time.
Description: To display or set the system date and time.
Example:
$ date
history command in linux:
Definition: Display command history.
Description: To display a list of previously executed commands.
Example:
$ history
find command in linux:
Definition: Search for files in a directory hierarchy.
Description: To search the files in a directory hierarchy based on various criteria.
Example:
$ find /path/to/directory -name “*.sh”
locate command in linux:
Definition: Find files by name.
Description: To search the files by name using a pre-built index of file names.
Example:
$ locate file.sh
grep command in linux:
Definition: Search for patterns in files.
Description: To search the lines matching a specified pattern in one or more files.
Example:
$ grep “pattern” file.sh
sed command in linux:
Definition: Stream editor for filtering and transforming text.
Description: To process text files and perform text transformations.
Example:
$ sed ‘s/old_text/new_text/g’ file.sh
awk command in linux:
Definition: Pattern scanning and processing language.
Description: To process text files by scanning input for patterns and performing specified actions.
Example:
$ awk ‘{print $1}’ file.sh
tar command in linux:
Definition: Manipulate archive files.
Description: To create, view, extract, and manipulate tar archives.
Example:
$ tar -cvf archive.tar files
zip command in linux:
Definition: Package and compress files.
Description: To create a zip archive to package and compress files.
Example:
$ zip archive.zip files
cut command in linux:
Definition: Cut out selected portions of each line of a file.
Description: To select the specific fields or columns from each line of a file.
Example:
$ cut -d’,’ -f1,3 file.csv
sort command in linux:
Definition: Sort lines of text files.
Description: To sort the lines of text files in ascending or descending order.
Example:
$ sort file.sh
uniq command in linux:
Definition: Report or omit repeated lines.
Description: To filter adjacent matching lines from input.
Example:
$ uniq file.sh
wc command in linux:
Definition: Print newline, word, and byte counts for each file.
Description: To count the number of lines, words, and bytes in a file.
Example:
$ wc file.sh
echo command in linux:
Definition: Display a line of text.
Description: To Print the specified text to the standard output.
Example:
$ echo “Hello, world!”
expr command in linux:
Definition: Evaluate expressions.
Description: To evaluate the mathematical expressions.
Example:
$ expr 5 + 3
tee command in linux:
Definition: To read the input and write to the output files.
Description: To copy the input to the output files.
Example:
$ command | tee output.sh
watch command in linux:
Definition: Execute a program periodically, showing output in full screen.
Description: To execute a command repeatedly and display its output on a full screen.
Example:
$ watch -n 1 command
curl command in linux:
Definition: Transfer data from or to a server.
Description: To transfer the data to or from a server using various protocols.
Example:
$ curl https://tutorialwale.com
rsync command in linux:
Definition: Remote file copy and synchronization.
Description: To copy and synchronize the files and directories locally or to/from a remote host.
Example:
$ rsync -avz /path/to/source user@remote_host:/path/destination
These top 50 linux commands with examples, definitions, and descriptions, cover a wide range of tasks and are essential for managing and troubleshooting linux systems. Let me know if you need further explanations!
Read More.
Best Linux Commands For Beginners
Top 10 Linux Commands with Examples
Top 20 Linux Commands with Examples