Linux & Terminal57 entries

Linux Commands

Essential Linux commands for file management, processes, networking, and system administration

1File & Directory Operations

ls -la
List all files with details
cd <dir>
Change directory
pwd
Print working directory
mkdir -p <dir/sub>
Create nested directories
rm -rf <dir>
Remove directory recursively (use with caution)
cp -r <src> <dest>
Copy directory recursively
mv <src> <dest>
Move or rename file/directory
touch <file>
Create empty file or update timestamp
ln -s <target> <link>
Create symbolic link
find . -name "*.log"
Find files by name pattern

2File Content

cat <file>
Display file contents
less <file>
View file with pagination
head -n 20 <file>
Show first 20 lines
tail -f <file>
Follow file updates in real-time
wc -l <file>
Count lines in file
sort <file>
Sort file lines
uniq
Remove duplicate adjacent lines
diff <file1> <file2>
Compare two files

3Search & Filter

grep -r "pattern" .
Search recursively in files
grep -i "pattern" <file>
Case-insensitive search
grep -n "pattern" <file>
Search and show line numbers
grep -v "pattern" <file>
Show lines NOT matching
find . -type f -mtime -7
Files modified in last 7 days
find . -size +100M
Files larger than 100MB
locate <filename>
Fast file search (uses index)
which <command>
Show path of command binary

4Permissions & Ownership

chmod 755 <file>
Set rwxr-xr-x permissions
chmod +x <file>
Make file executable
chmod -R 644 <dir>
Set permissions recursively
chown user:group <file>
Change file owner and group
chown -R user:group <dir>
Change ownership recursively
umask 022
Set default file creation permissions

5Process Management

ps aux
List all running processes
ps aux | grep <name>
Find process by name
top
Real-time process monitor
htop
Interactive process viewer
kill <PID>
Send SIGTERM to process
kill -9 <PID>
Force kill a process
killall <name>
Kill all processes by name
nohup <cmd> &
Run command immune to hangups
bg / fg
Move job to background / foreground

6Networking

curl -X GET <url>
Make HTTP request
wget <url>
Download file from URL
ping <host>
Test network connectivity
netstat -tulpn
Show listening ports
ss -tulpn
Show listening ports (modern)
ip addr show
Show network interfaces
dig <domain>
DNS lookup
ssh user@host
SSH into remote machine
scp <file> user@host:<path>
Copy file to remote machine

7Disk & System Info

df -h
Show disk space usage
du -sh <dir>
Show directory size
free -h
Show memory usage
uname -a
Show system information
uptime
Show system uptime
whoami
Show current user
hostname
Show system hostname