Last Updated : 11 Jul, 2025
Anyone using Linux should become an expert in the essential shell commands, as they form the backbone of working with the Linux terminal. These commands enable you to navigate the system, manage files, handle processes, and configure settings effectively.
The Linux shell serves as an interface for users to interact with the operating system. Mastering its commands can greatly enhance your efficiency, whether you’re a system administrator or a developer. In this guide, we’ll introduce some of the most fundamental Linux commands, covering file management, system monitoring, and command syntax, along with practical examples. By the end, you’ll have the knowledge needed to perform everyday tasks confidently in the Linux command-line environment.
Basic Shell Commands in Linux What are Shell Commands in Linux?A shell in Linux is a program that serves as an interface between the user and the operating system. It accepts commands from the user, interprets them, and passes them to the operating system for execution. The commands can be used for a wide range of tasks, from file manipulation to system management.
Some of the essential basic shell commands in Linux for different operations are:
ls
Lists files and directories ls
cd
Changes the current directory cd /home/user/Documents
pwd
Displays the current directory path pwd
mkdir
Creates a new directory mkdir new_directory
rm
Removes files or directories rm file.txt
cp
Copies files or directories cp file1.txt file2.txt
mv
Moves or renames files and directories mv old_name new_name
touch
Creates an empty file or updates file timestamps touch newfile.txt
Examples: 1. List files in a directory:
ls2. Change directory:
cd/home/user3. Create a new directory:
mkdir new_directory4. Copy a file from one location to another:
cp source.txt destination.txt5. Remove a file:
rm file.txtText Processing Commands in Linux Command Description Example
cat
Displays the contents of a file cat file.txt
grep
Searches for a pattern in a file grep "error" log.txt
sort
Sorts the contents of a file sort file.txt
head
Displays the first few lines of a file head file.txt
tail
Displays the last few lines of a file tail file.txt
wc
Counts the lines, words, and characters in a file wc file.txt
Examples: 1. Display the contents of a file:
cat file.txt2. Search for a pattern in a file:
grep "error" file.txt3. Sort the contents of a file:
sort file.txt4. Display the first 10 lines of a file:
head file.txt5. Display the last 10 lines of a file:
tail file.txtFile Permissions and Ownership Commands Command Description Example
chmod
Changes file permissions chmod 755 file.txt
chown
Changes file owner and group chown user:group file.txt
chgrp
Changes file group ownership chgrp group file.txt
Examples: 1. Change permissions of a file:
chmod 755 file.txt2. Change the owner of a file:
chown user:group file.txtSystem Monitoring and Process Management Commands Command Description Example
top
Displays real-time system information (CPU, memory) top
ps
Displays the list of running processes ps aux
kill
Terminates a process by its ID kill 1234
df
Displays disk space usage df -h
Examples: 1. View running processes:
ps aux2. Display real-time system statistics:
top3. Kill a process by its ID:
kill 12344. Check disk space usage:
df -hNetworking Shell Commands Command Description Example
ping
Checks the network connection to a server ping example.com
wget
Retrieves files from the web wget http://example.com///file.zip
curl
Transfers data from or to a server curl http://example.com//
ssh
Opens SSH client (remote login program) ssh user@example.com
scp
Securely copies files between hosts scp file.txt user@example.com:/path/
ftp
Transfers files using the File Transfer Protocol ftp ftp.example.com
Examples
1. Check the network connection to a server:
2. Retrieve files from the web:
3. Transfer data from or to a server:
4. Open SSH client (remote login program):
5. Securely copy files between hosts:
6. Transfer files using the File Transfer Protocol:
find
Searches for files and directories find /home/user -name "*.txt"
tar
Archives files into a tarball (.tar) or extracts them tar -cvf archive.tar file1.txt file2.txt
ssh
Connects to a remote machine via SSH ssh user@remote_host
Examples: 1. Find files in a directory:
find /home/user -name "*.txt"2. Create a tarball archive:
tar -cvf archive.tar file1.txt file2.txt3. Connect to a remote machine using SSH:
ssh user@remote_hostUsing Shell Command Piping
You can combine multiple commands by piping their output. In short, it allows the output of one command to be used as the input for another command.
Examples: 1. View the top 10 processes:ps aux | head -n 102. Search and sort a log file:
grep "error" log.txt | sortConclusion
Mastering the basic shell commands in Linuxis among the essential things to know so that you can perform a seamless system navigation, learn how to manage files efficiently, and perform other operations. By learning these commands, you can easily enhance your Linux skills and get a better insight over the system.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4