Basic Commands
The Linux command line is a text interface to your computer
ls
List files and directories
ls -l
List files and directories with long format - shows permissions
ls -lh
Shows file sizes in human readable format
ls -a
List files and directories including hidden
ls -t
sort by time & date
lsblk
Listing block devices on a Linux system
pwd
Check current working directory
cd
Change current working directory
clear
Clear terminal screen
mkdir
Create directories
mv
Move or rename files and directories
cp
Copy files and directories
rmdir
Remove Empty Directories in Linux
rm
Delete Files and Directories in Linux
touch
Change or Modify Timestamps of File or Directory
cat
Print or View Contents of File
echo
Print Line of Text or String
less
Read Contents of Text File
tar
Create and Extract Tar Archive Files
gzip
Use the Gzip Command
grep
Search Text or String in Files
head
Print First 10 Lines of Files
tail
Print Last 10 Lines
cut
Cut Sections of Line in File
tee
Use ‘tee’ Command
sort
Sort Files Based on Sizes
uniq
Remove Duplicate Lines
service
Linux command to start and stop services
ps
List currently nunning Linux processes
kill
and killall
Kill active processes by process ID or namerocess
chown
Change File Owner and Group
chgrp
Change the group ownership of files and directories
chmod
Change the access permissions of files and directories
ifconfig
Configure Network Interface
ip
Configure Network Interface
netstat
Check Network Listening Ports in Linux
nmap
A Network and Security Auditing Tool for Linux
traceroute
Trace all the network hops to reach the destination
dig
Query DNS in Linux
nslookup
Query Internet Domain Name Servers
ufw
Firewall command
iptables
Base firewall for all other firewall utilities to interface with
wget
Download Files from Network
curl
Transfer Data From or To a Server
apt
Install Packages in Debian-based Systems
apt-get
Manage Packages in Debian-based Systems
yum
Install Software Packages in RHEL-based Systems
dnf
Install Software Packages in Fedora
rpm
Install RPM Packages in RHEL-based Systems
alias
Create and Use Alias Command in Linux
top
Monitor Running Linux Processes
useradd
Create New Users in Linux
usermod
Change existing user data
passwd
Create or update passwords for existing users
chage
Manage User Password Expiration and Aging in Linux
sleep
Use “sleep” Command in Linux
screen
Getting Started with Linux Screen Command
pv
Monitor Progress of Data in Linux
fgrep
Search for Strings in Linux
dir
Create New Directories in Linux
egrep
Search Patterns in Files in Linux
ssh
Basic SSH Command Usage and Configuration in Linux
fd
A Simple and Fast Alternative to Find Command
lsof
List Open Files in Linux
dd
Learn dd Command in Linux
df
Check Disk Usage of Linux File System
du
Find Disk Usage of Files and Directories
tree
List Directory in Tree-like Format in Linux
ss
Monitor Network Connection Statistics in Linux
partx
List Disk Partitions in Linux
uptime
Check the Running Time of Linux System
tr
Translate or Delete Characters in Linux
ping
Check Network Connectivity Between Hosts in Linux
zcat
View Contents of Compressed File in Linux
xargs
Build and Execute Commands from Standard Input
stat
Check File or File System Status in Linux
who
Print information about users who are currently logged in
whoami
Print effective username of the user who ran whoami
whereis
Locate the binary, source, and manual pages for a command
whatis
Find what a command is used for
locate
Find Files by Name in Linux
host
Find IP Address of Domain Name in Linux
find
Find Files and Directories in Linux
fuser
Find PIDs of Processes Using Files or Sockets in Linux
at
Schedule a Command on Particular Time in Linux
fdisk
Create and Manage Disk Partitions in Linux
parted
Create, Resize, and Rescue Disk Partitions in Linux
wc
Count Number of Lines, Words, Characters in Linux
dpkg
Manage .deb Packages in Debian-based Systems
dmesg
Troubleshoot and Collect Information of Linux Systems
chattr
Make Important Files IMMUTABLE in Linux
free
Check Memory Usage in Linux
cron
Schedule tasks to run automatically at specific times or intervals
systemctl
Powerful utility in Linux used to manage the systemd
system and service manager
mysql
Backup and Restore MySQL Databases in Linux
sdiff
Check Difference Between Two Files in Linux
history
View Previously Executed Linux Command
sftp
Securely Transfer Files Between Linux Systems
tcpdump
Analyzer Network Packets in Linux
scp
Copy Files and Directories Between Remote Linux
rsync
Sync Files and Directories Between Remote Linux
fsck
Repair File System Errors in Linux
bc
Do Basic Calculations in Linux
ffmpeg
Convert Video, Audio, and Image in Linux
mknod
Create Device Files in Linux
nano
A user-friendly, command-line text editor
vim
A powerful text editor in Linux, primarily used for creating and editing files
Last updated