MinhCyber
🐧linux

Linux Commands Cheatsheet

1 min read
#linux#commands#terminal#bash

💡 Tip: Click the copy button on any code block to copy the command to your clipboard.

Linux Commands Cheatsheet

A quick reference for commonly used Linux commands in security work.

File Operations

Navigation

bash
# Change directory
cd /path/to/directory

# List files with details
ls -la

# Show current directory
pwd

File Manipulation

bash
# Copy file
cp source.txt destination.txt

# Move/rename file
mv oldname.txt newname.txt

# Remove file
rm filename.txt

# Remove directory recursively
rm -rf directory/

Network Commands

Information Gathering

bash
# Show IP addresses
ip addr show

# Show routing table
ip route

# DNS lookup
nslookup domain.com
dig domain.com

Connections

bash
# Show active connections
netstat -tulpn
ss -tulpn

# Test connectivity
ping -c 4 target.com

# Trace route
traceroute target.com

Process Management

bash
# List processes
ps aux

# Find process by name
pgrep -a processname

# Kill process
kill -9 PID

# Monitor system resources
top
htop

Permissions

bash
# Change file permissions
chmod 755 script.sh
chmod +x script.sh

# Change ownership
chown user:group file.txt

# View permissions
ls -l file.txt

Search

bash
# Find files
find / -name "*.txt" 2>/dev/null

# Search in files
grep -r "pattern" /path/

# Locate files (requires updatedb)
locate filename