Skip to content
Skatterbrainz edited this page Dec 28, 2025 · 2 revisions

🐧 Linux Commands Reference Guide

Table of Contents

πŸ“ File System Operations

Command Examples
ls ls -la
ls -lh /home
ls *.txt
cp cp file1.txt file2.txt
cp -r /source/dir /dest/dir
cp *.jpg /backup/
mv mv oldfile.txt newfile.txt
mv file.txt /new/location/
mv *.log /logs/
rm rm file.txt
rm -rf directory/
rm -i *.tmp
touch touch newfile.txt
touch file1 file2 file3
touch -t 202301011200 file.txt
ln ln -s /path/to/file symlink
ln file.txt hardlink.txt
ln -sf /usr/bin/python3 /usr/bin/python

🧭 Navigation & Directory

Command Examples
cd cd /home/user
cd ..
cd ~/Documents
pwd pwd
pwd -P
mkdir mkdir newdir
mkdir -p path/to/nested/dir
mkdir -m 755 secure_dir
rmdir rmdir empty_dir
rmdir -p dir1/dir2/dir3
tree tree
tree -L 2
tree -a -I '.git'

πŸ” File Permissions

Command Examples
chmod chmod 755 script.sh
chmod u+x file.sh
chmod -R 644 /var/www/
chown chown user:group file.txt
chown -R www-data:www-data /var/www
chown root file.txt
chgrp chgrp staff file.txt
chgrp -R developers /project
umask umask 022
umask -S

πŸ” Search & Find

Command Examples
find find /home -name "*.txt"
find . -type f -mtime -7
find /var -size +100M
grep grep "pattern" file.txt
grep -r "error" /var/log/
grep -i "warning" *.log
locate locate nginx.conf
locate -i "*.PDF"
which which python3
which -a gcc
whereis whereis nginx
whereis -b python

πŸ“ Text Processing

Command Examples
cat cat file.txt
cat file1 file2 > combined.txt
cat -n script.sh
less less largefile.log
less +G file.txt
head head -10 file.txt
head -c 100 binary.dat
tail tail -f /var/log/syslog
tail -20 error.log
tail -n +10 file.txt
sort sort names.txt
sort -n numbers.txt
sort -r -k2 data.csv
uniq sort file.txt | uniq
uniq -c sorted.txt
cut cut -d',' -f1,3 data.csv
cut -c1-10 file.txt
awk awk '{print $1}' file.txt
awk -F',' '{print $2}' data.csv
sed sed 's/old/new/g' file.txt
sed -i '1d' file.txt

πŸ“¦ Archive & Compression

Command Examples
tar tar -czf archive.tar.gz folder/
tar -xzf archive.tar.gz
tar -tzf archive.tar.gz
zip zip -r archive.zip folder/
zip archive.zip file1 file2
unzip unzip archive.zip
unzip -l archive.zip
unzip archive.zip -d /target/
gzip gzip file.txt
gzip -d file.txt.gz

🌐 Network Operations

Command Examples
ping ping google.com
ping -c 4 ***********
wget wget https://example.com/file.zip
wget -r -np https://site.com/dir/
curl curl https://api.example.com/data
curl -X POST -d "data" url.com
curl -o file.html https://site.com
ssh ssh user@server.com
ssh -i key.pem user@host
scp scp file.txt user@host:/path/
scp -r folder/ user@host:~
netstat netstat -tulpn
netstat -i
ss ss -tulpn
ss -s

βš™οΈ Process Management

Command Examples
ps ps aux
ps -ef | grep nginx
ps --forest
top top
top -u username
htop htop
htop -u user
kill kill 1234
kill -9 1234
kill -TERM 1234
killall killall firefox
killall -9 chrome
jobs jobs
jobs -l
nohup nohup ./script.sh &
nohup python app.py > app.log &

πŸ’» System Information

Command Examples
uname uname -a
uname -r
whoami whoami
id id
id username
uptime uptime
uptime -p
free free -h
free -m
lscpu lscpu
lscpu | grep "Model name"
lsblk lsblk
lsblk -f

πŸ’Ύ Disk Usage & Management

Command Examples
df df -h
df -i
du du -sh /home/user
du -ah . | sort -hr
du -d 1 /var/
mount mount /dev/sdb1 /mnt
mount -t ext4 /dev/sdc1 /backup
umount umount /mnt
umount /dev/sdb1
fdisk fdisk -l
fdisk /dev/sdb

πŸ“¦ Package Management

Command Examples
apt apt update && apt upgrade
apt install nginx
apt search python
apt-get apt-get update
apt-get install -y git
apt-get remove package
dpkg dpkg -i package.deb
dpkg -l | grep nginx
dpkg -r package
snap snap install code --classic
snap list
snap refresh

🌍 Environment & Variables

Command Examples
env env
env | grep PATH
export export PATH=$PATH:/new/path
export API_KEY="secret123"
echo echo $HOME
echo "Hello World"
echo $PATH | tr ':' '\n'
alias alias ll='ls -la'
alias
unalias ll
history history
history | grep git
!42

πŸ’‘ Pro Tips:

  • Use man command for detailed documentation
  • Press Tab for auto-completion
  • Use Ctrl+C to stop running commands
  • Combine commands with pipes (|) and redirections (>, >>)
  • Use --help flag for quick command options

Generated for Linux enthusiasts 🐧 | Remember: with great power comes great responsibility!