Linux

100+ Linux Commands Cheat Sheet List With Examples

In this article, we have listed more than 100 Linux commands that you need to know and there are countless commands but we’re listing some of the important commands here.






















We have explained in detail all of the above-listed commands below with examples. You can find the actual description of each Linux command on their manual page which you can access like this:

$ man command-name

adduser or useradd / addgroup Command

adduser/useradd and addgroup are the default command to add users and the group for the users to the system and generally located at /etc folder.

$ sudo adduser cbspost
$ sudo addgroup cbspost

agetty Command

agetty is a substitute for getty Linux command and it is used to manage the physical and virtual terminals by invoking init. It opens tty port and prompts for login name and invokes the /bin/login command.

$ agetty [options] port [baud_rate...] [term]
$ agetty -s 90 9600 vt112

alias Command

alias is a shell built-in command to create assumed-name/nickname to a Linux command. You can create a custom command if the original command is lengthy.

$ alias website='cd /home/cbspost/public_html'

The above command will create a shortcut for and next time you just need to type “website” to go “/home/cbspost/public_html” directory.

anacron Command

anacron is used to run commands periodically in the frequency in days, weeks, months. It runs once if the scheduled job is due when the machine is not running.

apt Command

apt (Advanced Package Tool) is a new high-level core package manager for Debian/Ubuntu system.

$ sudo apt update

apt-get Command

apt-get is a Linux command used to install, remove and perform various operations on the installed packages.

$ sudo apt-get update

aptitude Command

Linux command aptitude is a text-based front-end for the apt package management system like apt, apt-get to install, remove, update software packages on a system.

$ sudo aptitude update

arch Command

arch command is used to simply display the system architecture or hardware name.

$ arch

arp Command

ARP (Address Resolution Protocol) is a protocol that maps IP network addresses of a network neighbor with the hardware (MAC) addresses in an IPv4 network.

$ arp [-v] [-i if] [-H type] -a [hostname]

at Command

The AT command schedules tasks and programs to run in the future at a specified time and date.

$ at [OPTION...] runtime

atq Command

atq displays the list of pending jobs that are scheduled by the user. A superuser can see the pending jobs of all users.

$ atq

atrm Command

atrm command is used to delete/remove particular jobs identified by their number. A user can only delete jobs that belong to him but a superuser can delete all user’s jobs.

$ atrm [job number]

awk Command

awk is a general-purpose programming language that is used for text processing. Mostly used for data extraction and reporting purposes.

$ awk '//{print}'/etc/hosts

batch Command

batch read commands from standard input or a specified file which are to be executed at a later time. it is more or less the same as at command.

$ batch

basename Commanad

basename strips directory information and suffixes from file names and only prints the file name.

$basename NAME [SUFFIX]
$basename OPTION NAME

bc Command

bc command is a command-line calculator same as the basic calculator that can do basic mathematics calculator as shown below.

$ echo 3+2 | bc

bg Command

bg is a job control command and it sends the jobs to the background.

$ bg [job]

bzip2 Command

bzip2 in Linux is used to compress and decompress the files.

$ bzip2 filename.txt

cal

cal command is used to print the calendar of the current month in the standard output.

$ cal

cat Command

cat command is used to view contents of a file or concatenate files, or data provided on standard input, and display it on the standard output.

$ cat filename.txt

chgrp Command

The chgrp command changes the ownership of a directory or file in Linux. Each file is associated with an owning user or a group and has rules defining which users or groups can read, write, or execute the file.

$ chgrp cbspost users.txt

chmod Command

The Linux chmod command is used to change or update the access permission type of a file/folder.

$ chmod 775 [filename]

chown Command

This command is used the change/update the ownership of a file or folder in Linux OS.

$ chown username [filename/foldername]

cksum Command

cksum command is used to display a CRC(Cyclic Redundancy Check) value, the byte size of the file, and the name of the file to standard output.

$ cksum [filename]

clear Command

clear command will simply clear the terminal. Just type “clear” in the terminal.

$ clear

cmp Command

cmp command is used to compare two files byte-by-byte in the Linux OS

$ cmp [filename1] [filename2]

comm Command

comm command performs the comparison between two sorted files line-by-line.

$ comm [filename1] [filename2]

cp Command

You can use the cp command to copy one or multiple files from one location to another location.

$ cp /etc/cbspost/filename1 /etc/cbspost/myfolder/

date Command

date command will display or used to set the date of a system.

$ date
$ date --set="23 DEC 2025 21:10:00"

dd Command

dd command is used to copy files, convert, and format according to flags provided on the command line.

$ dd [option]

df Command

Show information about the file system on which each FILE resides, or all file systems by default.

$ df -h

diff Command

diff command is used to compare two files/folders line by line in Linux OS.

$ diff [filename1] [filename2]

dir Command

dir command will display the files/folders of the current directory.

$ dir

dmidecode Command

dmidecode command is used to retrieve the system’s hardware-related information such as Processor, RAM(DIMMs), BIOS detail, Memory, Serial numbers, etc.

$ dmidecode [option]

du Command

this command is used to display the disk usage of a file as well as its sub-directory.

$ du /home/filename.txt

echo Command

echo command is used to print a string that is passed to its argument.

$ eacho "Hello World!"

eject Command

eject remove the removable media (typically a CD-ROM, floppy disk, tape, JAZ, ZIP, or USB disk).

$ eject /mnt/cdrom/

env Command

env command is used to print all lists of current environment variables.

$ env

exit Command

exit command is used to exit the current shell.

$ exit

expr Command

expr command is used to calculate an expression as shown below.

$ expr 5 + 7

factor Command

This command is used to print the prime factor of a number.

$ factor [number]

find Command

It searches for files and directories in a directory hierarchy based on a user given expression.

$ find ./ngt -name filename.txt

free Command

free command is used to display the system memory usage (free, used, swapped, cached, etc.). Use the -h option to display output in human friendly format.

$ free -h

grep Command

grep command searches for a specified pattern in a file (or files) and displays in output lines containing that pattern.

$ grep ‘cbspost’ country.txt

groups

This command will display the list of all groups of the system.

$ groups

gzip Command

If you want to compress a file, you can use gzip. It will replace with .gz extension.

$ gzip hugefile.txt

gunzip Command

gunzip command expands or restores files that are compressed by gzip command.

$ gunzip filename.gz

head command is used to show first lines of the specified file or stdin to the screen. It will show 10 lines by default.

$ head [option]... [filename]...

history Command

This command will display previously performed task on Linux OS.

$ history

hostname Command

This command is used to print/set system hostname in Linux operating system.

$ hostname
$ hostname [new_hostname]

hostnamectl Command

hostnamectl command is used to query or change system hostname.

$ hostnamectl
$ hostnamectl set-hostname [new_hostname]

hwclock Command

hwclock command can print or set the system hardware clock.

$ hwclock
$ hwclock --set --date 7/02/2025

hwinfo Command

The hwinfo command is a very handy command line tool that can be used to check details about hardware components.

$ hwinfo

id Command

id command will print the user/group information of the current user or specified users.

$ id [option]... [user]

ifconfig Command

ifconfig command is used to configure a Linux systems network interfaces. It is used to configure, view and control network interfaces.

$ ifconfig

ionice Command

This command is used to set/query process I/O scheduling class and priority of the specified process.

$ ionice [optoin] -p [pid]...

iostat Command

The iostat command in Linux is used for monitoring system input/output statistics for devices and partitions.

$ iostat

ip Command

ip command is used to print or manage routing, devices, policy routing and tunnels. It also works as a replacement for well known ifconfig command.

$ ip [ OPTIONS ] OBJECT { COMMAND | help }

iptables Command

iptables is a command line interface used to set up and maintain tables for the Netfilter firewall for IPv4, included in the Linux kernel.

$ iptables -[ACD] chain rule-specification [options]

iw Command

iw command is used to manage wireless devices and their configuration.

$ iw [ OPTIONS ] { help | OBJECT COMMAND }

iwlist Command

iwlist command displays detailed wireless information from a wireless interface. 

$ iwlist [interface] frequency

kill Command

This command is used to kill a process by its process ID. The command kill sends the specified signal to the specified processes or process groups. If no signal is specified, the TERM signal is sent.

$ kill -p 7600
$ kill -SIGTERM -p 7600

killall Command

killall command will kill a process by its name.

$ killall FileZilla

kmod Command

kmod comman is used to Manage kernel modules: list, load, unload, etc.

$ kmod unload

last Command

last command is used to list the last logged-in users.

$ last

ln Command

ln command is used to create a soft link between files using the -s flag like this.

$ ln -s /usr/share/anylink target_link

locate Command

This command is simply used to find the file by name and locate command is faster and better than the find command.

$ locate [option] pattern...

login Command

the login command is used to begin a new session on the system. You need to enter your username and password.

$ login

ls Command

This command List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is specified.

$ ls [OPTION]... [FILE]...

lshw Command

This command will list down the detailed information on the hardware configuration of the machine. If invoked with superuser, you’ll get more comprehensive results.

$ lshw

lscpu Command

lscpu command displays the system’s CPU architecture information (such as number of CPUs, threads, cores, sockets, and more).

$ lscpu

lsof Command

This command provides a list of files that are opened. Basically, it gives the information to find out the files which are opened by which process.

$ lsof -u [FILENAME]

lsusb Command

lsusb command shows information about USB buses in the system and the devices connected to them like this.

$ lsusb

man Command

man is the system’s manual pager. Each page argument given to man is normally the name of a program, utility, or function.

$ man cmp
$ man hostname

md5sum Command

The md5sum is designed to verify data integrity using MD5 (Message-Digest Algorithm 5) and it is 128-bit cryptographic.

$ md5sum [OPTION]... [FILE]...

mkdir Command

mkdir command is used to create one or more than one file and if the file already exists, it can be overwritten.

$ mkdir [FILENAME]

more Command

more command is used to view the text files in the command prompt, displaying one screen at a time in case the file is large.

$ more [FILENAME]

mv Command

mv is used to move one or more files or directories from one place to another. If both filenames are on the same filesystem, this results in a simple file rename.

$ mv [FILENAME1] [FILENAME2]

nano Command

nano is a popular small, free and friendly text editor for Linux, a clone of Pico. The default editor is included in the non-free Pine package.

$ nano [FILENAME]

nc/netcat Command

netcat is a computer networking utility for reading from and writing to network connections using TCP or UDP.

$ nc -zv 192.168.1.21 22

netstat Command

netstat is a command-line utility that can be used to list out all the network (socket) connections on a system.

$ netstat -a | more

nice Command

nice command in Linux helps in the execution of a program/process with modified scheduling priority. It launches a process with a user-defined scheduling priority.

$ nice [OPTION] [COMMAND [ARG]...]

nmap Command

nmap is a free open source tool, employed to discover hosts and services on a computer network by sending packets and analyzing the retrieved responses.

$ nmap cbspost.com

nproc Command

Print the number of processing units available to the current process, which may be less than the number of online processors.

$ nproc [OPTION]...

openssl Command

OpenSSL is an open-source command-line tool that is commonly used to generate private keys, create CSRs, install your SSL/TLS certificate, and identify certificate information.

$ openssl command [ command_opts ] [ command_args ]

passwd Command

The passwd utility is used to update the user’s authentication token(s). You can create/update an existing user’s passwords.

$ passwd [USERNAME]

pidof Command

pidof finds the processes id’s (pids) of the named programs. It prints that id’s on the standard output.

$ pidof sshf

ping Command

PING (Packet Internet Groper) command is used to check the network connectivity between host and server/host.

$ ping cbspost.com

ps Command

ps displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information, use top(1) instead.

$ ps [OPTION]

pstree Command

pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.

$ pstree

pwd Command

The pwd (print working directory) command will print the name of the current working directory.

$ pwd

rdiff-backup

rdiff-backup is a powerful local/remote incremental backup script written in Python. It works on any POSIX operating system such as Linux, Mac OS X.

$ rdiff-backup ./backup_folder ./backup_folder.backup

reboot Command

reboot command is used to restart or reboot the system. In a Linux system administration, there comes a need to restart the server after the completion of some network and other major updates.

$ reboot

rename Command

the rename command is used to rename one or more than one file at a time.

$ rename [Old_FileName] [New_FileName]

rm Command

rm command is used to remove files/directories from the specified location. By default, it doesn’t remove directories.

$ rm [FileName]

rmdir Command

rmdir command is used to remove empty directories.

$ rmdir /backup/mydata

scp Command

This command is used to securely copy the files/folders from one location to another location over the network.

$ scp ~/filename.txt root@192.168.21.10:/root/filename.txt

shutdown Command

The shutdown command brings the system down securely. You can set a time to shut down the system as well.

$ shutdown [OPTIONS...] [TIME] [WALL...]

sleep Command

the sleep command is used to delay or pause (specifically the execution of a command) for a specified amount of time.

$ sleep NUMBER[SUFFIX]...

sort Command

The sort command will sort the lines of text of the specified file.

$ sort [FileName]

split Command

the split command is used to split the large file into small pieces. Output pieces of FILE to PREFIXaa, PREFIXab, …; default size is 1000 lines, and default PREFIX is ‘x’.

$ split [OPTION]... [FILE [PREFIX]]

ssh Command

ssh is a powerful application to access and run commands on a remote system. It offers a secure and encrypted connection between two hosts over an insecure network.

$ ssh cbspost@23.81.0.59

stat Command

This command is simply used to display file or file system status.

$ stat [FileName]

su Command

su command is used to switch to another user ID or become root during a login session. Note that when su is invoked without a username, it defaults to becoming root.

$ su
$ su cbspost

sudo Command

sudo command allows a permitted system user to run a command as root or another user, as defined by the security policy.

$ sudo adduser [UserName]

sum Command

sum command is used to show the checksum and block counts for each specified file on the command line.

$ sum [OPTION]... [FILE]...

tac Command

tac command concatenates and displays files in reverse. It simply prints each file to standard output, showing last line first.

$ tac [FileName]

tail Command

tail command is used to display the last lines (10 lines by default) of each file to standard output. If they’re more than one file, precede each with a header giving the file name. Use it as follow (specify more lines to display using the -n option).

$ tail long-file
$ tail -n 19 long-file

talk Command

talk command is used to talk to another system/network user. To talk to a user on the same machine, use their login name, however, to talk to a user on another machine using ‘user@host’.

$ talk person [ttyname]
$ talk‘user@host’ [ttyname]

tar Command

The Linux ‘tar’ stands for tape archive, which is used to create an Archive and extract the archive files.

$ tar cvf file.tar *.php

tee Command

Copy standard input to each file, and also to standard output.

$ tee [OPTION]... [FILE]...

tree Command

The tree command is a tiny, cross-platform command-line program used to recursively list or display the content of a directory in a tree-like format.

$ tree

time Command

time command in Linux is used to execute a command and prints a summary of real-time, user CPU time, and system CPU time spent by executing a command when it terminates.

$ time

top Command

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel.

$ top

touch Command

touch command changes file timestamps, it can also be used to create a file

$ touch [OPTION]... FILE...

tr Command

The tr command will translate, squeeze, and/or delete characters from standard input, writing to standard output.

$ tr [OPTION] SET1 [SET2]

uname Command

The uname command is used to print certain system information. With no OPTION, same as -s.

$ uname

uniq Command

The uniq command will filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).

$ uniq [OPTION]... [INPUT [OUTPUT]]

uptime Command

uptime gives a one-line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

$ uptime

users Command

The users command is used to print the user names of users currently logged in to the current host.

$ users

vim/vi Command

vim (Vi Improved version) is a popular text editor that can edit any text file or program file.

$ vi [FileName]

w Command

This command is used to display system uptime, load averages, and information about the users currently on the machine, what are their processes are doing.

$ w

wall Command

The wall displays a message, or the contents of a file, or otherwise its standard input, on the terminals of all currently logged-in users.

$ wall "Hello Linux World"

watch Command

watch command runs a program repeatedly while displaying its output on fullscreen. It can also be used to watch changes to a file/directory.

$ watch [options] command

wc Command

The wc command will print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified.

$ wc [FileName]

wget Command

wget command is a simple utility used to download files from the Web in a non-interactive (can work in the background) way.

$ wget [options] [url]

whatis Command

whatis command searches and shows a short or one-line manual page description of the provided command name.

$ whatis vi

which Command

which command takes one or more arguments. For each of its arguments, it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt.

$ which [options] [--] programname [...]

who Command

The who command is used to print information about users who are currently logged in.

$ who

whereis Command

This command is used to locate the binary, source, and manual page files for a command.

$ whereis vi

xargs Command

xargs is a useful command that reads streams of data from standard input, then generates and executes command lines; meaning it can take the output of a command and passes it as an argument of another command.

$ echo 'folder1 folder2 folder3' | xargs mkdir

yes Command

yes command is used to display a string repeatedly until when terminated or killed using [ctrl + c].

$ yes "Hello Linux World"

youtube-dl Command

youtube-dl is a lightweight command-line program to download videos and also extract MP3 tracks from YouTube.com.

$ youtube-dl --list-formats [YouTube video URL]

zcmp/zdiff Command

zcmp and zdiff are used to invoke the cmp or the diff program on files compressed via gzip. All options specified are passed directly to cmp or diff. If only file1 is specified, it is compared to the uncompressed contents of file1.gz.

$ zcmp file1.txt.zip file2.txt.zip
$ zdiff file1.txt.zip file2.txt.zip 

zip Command

zip command is simply used to pack or compress files/folders.

$zip file.zip filename.txt

There are countless Linux commands. With new tools every day, we get new commands and we’ve listed very limited commands here. You all are very welcome to comment if you think there are other Linux commands that need to be listed in this article.

You Might Also Like

More Similar Posts

Tags

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Menu
0
Would love your thoughts, please comment.x
()
x