🐧 Linux Essentials Cheatsheet

🔧 1. Basic Commands

CommandDescription
pwdPrint current directory
lsList files and directories
cd [dir]Change directory
mkdir [dir]Create a directory
touch [file]Create an empty file
rm [file/dir]Delete file or directory (-r for recursive)
cp [src] [dst]Copy file/directory
mv [src] [dst]Move or rename file
cat [file]Display file contents
nano, vim, viText editors

🔎 2. File Permissions

SymbolMeaning
rRead
wWrite
xExecute
bashCopyEditchmod 755 file    # Set read/write/execute for owner, read/execute for group/others
chown user:group file  # Change owner and group
ls -l             # Show detailed list with permissions

📁 3. File System Structure

DirectoryDescription
/Root directory
/homeUser home directories
/etcConfiguration files
/varLog files, spool files
/binEssential user binaries
/sbinSystem binaries
/usrUser applications and utilities
/tmpTemporary files

🛠️ 4. Package Management

Debian/Ubuntu:

bashCopyEditsudo apt update
sudo apt install [package]
sudo apt remove [package]

RHEL/CentOS:

bashCopyEditsudo yum install [package]
sudo yum remove [package]

🔄 5. Process Management

CommandDescription
ps auxList running processes
top or htopLive process monitoring
kill [PID]Terminate a process
kill -9 [PID]Force terminate
&Run process in background
fg, bgForeground/background a job

🌐 6. Networking Commands

CommandDescription
ifconfig or ip aShow IP addresses
ping [host]Check connectivity
netstat -tulnList open ports
curl [url]Fetch URL content
scp [src] [user@host]:[dst]Secure file copy
ssh user@hostSecure shell login

🔐 10. Security Basics

CommandDescription
sudoRun command as superuser
ufw enableEnable firewall (Ubuntu)
ufw allow 22Allow SSH
chmod/chownFile access control

🗃 Bonus: Log Files

Log FileDescription
/var/log/syslogSystem logs
/var/log/auth.logAuthentication logs
/var/log/kern.logKernel logs
/var/log/nginx/Web server logs

✅ Recommended Learning Resources


Share with