Top 40 Linux Commands with Examples, Definitions and descriptions
I have tried my best to explain the below-listed top 40 linux commands with examples to let you understand. Here are some of the top 40 Linux commands and examples, along with their definitions and descriptions.
ls command in linux:
Definition: Lists directory contents.
Description: Displays the files and directories in the current directory.
Example:
$ ls
Desktop Downloads Music Videos
cd command in linux:
Definition: Change directory.
Description: Changes the current working directory.
Example:
$ cd Documents
pwd command in linux:
Definition: Print working directory.
Description: Displays the current working directory.
Example:
$ pwd
/home/user/Documents
mkdir command in linux:
Definition: Make directory.
Description: Creates a new directory.
Example:
$ mkdir new_directory
rm command in linux:
Definition: Remove files or directories.
Description: Deletes files or directories.
Example:
$ rm file.bkp
cp command in linux:
Definition: Copy files or directories.
Description: Copies files or directories from one location to another.
Example:
$ cp file.bkp /path/to/destination
mv command in linux:
Definition: Move or rename files or directories.
Description: Moves files or directories to a new location or renames them.
Example:
$ mv file.bkp /path/to/destination
touch command in linux:
Definition: Create an empty file.
Description: Creates a new empty file or updates the access and modification times of an existing file.
Example:
$ touch new_file.bkp
cat command in linux:
Definition: Concatenate and display files.
Description: Displays the contents of one or more files.
Example:
$ cat file.bkp
grep command in linux:
Definition: Search for patterns in files.
Description: Searches for lines matching a specified pattern in one or more files.
Example:
$ grep “pattern” file.bkp
head command in linux:
Definition: Display the beginning of a file.
Description: Displays the first few lines of a file.
Example:
$ head file.bkp
tail command in linux:
Definition: Display the end of a file.
Description: Displays the last few lines of a file.
Example:
$ tail file.bkp
chmod command in linux:
Definition: Change file or directory permissions.
Description: Changes the permissions of a file or directory.
Example:
$ chmod 775 file.bkp
chown command in linux:
Definition: Change file ownership.
Description: Changes the owner and group of a file or directory.
Example:
$ chown user:group file.bkp
sudo command in linux:
Definition: Execute a command as the superuser.
Description: Executes a command with superuser (root) privileges.
Example:
$ sudo apt-get install package
su command in linux:
Definition: Switch user or become superuser.
Description: Switches to another user account or becomes the superuser.
Example:
$ su username
apt-get command in linux:
Definition: Package handling utility for Debian-based systems.
Description: Installs, removes, and manages 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: Installs, removes, and manages software packages on RPM-based systems.
Example:
$ sudo yum install package
tar command in linux:
Definition: Manipulate archive files.
Description: Creates, views, extracts, and manipulates tar archives.
Example:
$ tar -cvf archive.tar files
df command in linux:
Definition: Display disk space usage.
Description: This shows the amount of disk space used and available on the file system.
Example:
$ df -h
du command in linux:
Definition: Estimate file space usage.
Description: It estimates 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: This shows 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: Displays system activity, including 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: Reports a snapshot of the current processes running on the system.
Example:
$ ps aux
kill command in linux:
Definition: Terminate a process.
Description: Terminates a process by sending a signal to the process.
Example:
$ kill PID
ping command in linux:
Definition: Test a network connection.
Description: Tests 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: Displays and configures network interface parameters.
Example:
$ ifconfig
scp command in linux:
Definition: Securely copy files between hosts.
Description: Securely copy files between hosts over a network.
Example:
$ scp file.bkp user@remote_host:/path/destination
ssh command in linux:
Definition: Secure shell client.
Description: Allows 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: Downloads files from the web using HTTP, HTTPS, or FTP protocols.
Example:
$ wget http://example.com/file.bkp
uname command in linux:
Definition: Print system information.
Description: Displays 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: Displays or sets the system date and time.
Example:
$ date
history command in linux:
Definition: Display command history.
Description: Displays a list of previously executed commands.
Example:
$ history
find command in linux:
Definition: Search for files in a directory hierarchy.
Description: Searches for files in a directory hierarchy based on various criteria.
Example:
$ find /path/to/directory -name “*.bkp”
locate command in linux:
Definition: Find files by name.
Description: Searches for files by name using a pre-built index of file names.
Example:
$ locate file.bkp
grep command in linux:
Definition: Search for patterns in files.
Description: Searches for lines matching a specified pattern in one or more files.
Example:
$ grep “pattern” file.bkp
sed command in linux:
Definition: Stream editor for filtering and transforming text.
Description: Processes text files and performs text transformations.
Example:
$ sed ‘s/old_text/new_text/g’ file.bkp
awk command in linux:
Definition: Pattern scanning and processing language.
Description: Processes text files by scanning input for patterns and performing specified actions.
Example:
$ awk ‘{print $1}’ file.bkp
tar command in linux:
Definition: Manipulate archive files.
Description: Creates, views, extracts, and manipulates tar archives.
Example:
$ tar -cvf archive.tar files
zip command in linux:
Definition: Package and compress files.
Description: Creates zip archives to package and compress files.
Example:
$ zip archive.zip files
These top 40 Linux commands with examples, definitions, and descriptions (linux commands) cover a wide range of tasks and are essential for managing and troubleshooting Linux systems. Let me know if you need further commands, explanations or examples.
Learn More
Best Linux Commands For Beginners
Top 10 Linux Commands with Examples