System | |
---|---|
cat /etc/os-release | Distro Information |
top | Live processes |
ps aux | List processes |
kill pid | Kill process |
Linux Essentials
Most used Linux commands for daily tasks.
Navigation | |
---|---|
ls | List files |
cd directory | Change directory |
pwd | Print working dir |
Files | |
---|---|
cp source dest | Copy file/dir |
mv source dest | Move / rename |
rm file | Remove file |
rm -r directory | Remove directory tree |
touch file | Create file/update timestamp |
cat file | Show file content |
grep 'text' file | Search in file |
grep -i 'text' file | Case-insensitive search |
grep -n 'text' file | Show line numbers |
grep -r 'text' directory | Recursive search |
grep -E 'regex' file | Extended regex |
grep -v 'text' file | Invert match |
grep -A 3 -B 2 'text' file | Context lines (after 3 / before 2) |
find /path -name 'pattern' | Find files by name |
find /path -type f -size +10M | Find large files (>10MB) |
locate filename | Search indexed database |
which command | Executable path |
Permissions | |
---|---|
chmod +x file | Make executable |
sudo command | Run as superuser |