File Operations
| Command | Description |
|---|---|
ls | List files |
ls -la | Detailed list (including hidden files) |
cd <dir> | Change directory |
pwd | Print working directory |
mkdir <dir> | Create directory |
mkdir -p <path> | Create parent directories too |
rm <file> | Remove file |
rm -r <dir> | Remove directory recursively |
cp <src> <dest> | Copy file |
cp -r <src> <dest> | Copy directory |
mv <src> <dest> | Move/rename file |
touch <file> | Create empty file |
cat <file> | Display file contents |
less <file> | View file with pagination |
head <file> | Show first 10 lines |
tail <file> | Show last 10 lines |
tail -f <file> | Follow file in real-time |
File Search
| Command | Description |
|---|---|
find . -name "*.txt" | Find files by name |
find . -type f | Find files only |
find . -type d | Find directories only |
grep "pattern" <file> | Search for pattern |
grep -r "pattern" . | Search recursively |
grep -i "pattern" <file> | Case-insensitive search |
Process Management
| Command | Description |
|---|---|
ps | List processes |
ps aux | List all processes in detail |
top | Real-time process viewer |
htop | Enhanced top |
kill <pid> | Terminate process |
kill -9 <pid> | Force terminate |
killall <name> | Kill processes by name |
Permissions
| Command | Description |
|---|---|
chmod 755 <file> | Change permissions |
chmod +x <file> | Add execute permission |
chown user:group <file> | Change owner |
sudo <command> | Run as administrator |
Network
| Command | Description |
|---|---|
ping <host> | Check connectivity |
curl <url> | HTTP request |
wget <url> | Download file |
ss -tuln | Show open ports |
ip addr | Show IP addresses |