📂 File and Directory Commands
man
— Skim through manual for better understanding
vi
— Available by default and Lightweight editor, but has a steep learning curve. Not a beginner friendly.
nano
— Often available, Simple and intuitive, great for quick edits.
vim
— Not a pre-installed, "Vi Improved" — powerful, customizable, widely used by developers
ls -l
— List files with permissions and sizes, detailed info
cd /path/to/dir
— Change directory
mkdir folder
— Create a new folder
rm -rf folder
— Delete a folder and contents recursively Destructive command
cp file1 file2
— Copy file1 to file2
mv old new
— Rename or move a file
🔍 Searching & Filtering
grep 'text' file
— Search for text in a file
find . -name "*.sh"
— Find all shell scripts recursively
grep -r 'pattern' ./
— Recursive grep from current directory
📊 Disk and System Info
df -h
— Show disk usage in human-readable format
du -sh *
— Show folder sizes in current directory
free -m
— Show memory usage in MB
top
— Real-time process monitor
uname -a
— Show kernel and system info
🛠️ Permissions & Ownership
chmod +x script.sh
— Make a script executable
chown user:group file
— Change file owner
chmod 755 file
— Set permissions (rwxr-xr-x)
📦 Package Management
🟢 Debian / Ubuntu (APT)
sudo apt update
— Refresh package database
sudo apt upgrade
— Install available updates
sudo apt install packagename
— Install a package
dpkg -l
— List all installed packages
sudo dpkg -i file.deb
— Install a downloaded .deb package
🔴 RHEL / CentOS / Fedora (RPM/YUM)
sudo yum update
— Update all installed packages (RHEL 7 and below)
sudo dnf update
— For newer systems (RHEL 8+ / Fedora)
sudo yum install packagename
— Install a package
sudo rpm -ivh file.rpm
— Install a local .rpm file
rpm -qa
— List all installed RPM packages
rpm -ql packagename
— Show installed files of a package
⚙️ Process Management
ps aux
— List all running processes
kill -9 PID
— Force kill a process by PID
htop
— Interactive process viewer (if installed)