Terminal Security Commands - Information Security
File System Security
ls -al
- List all files with permissions, owner, and size
chmod (Change Mode)
- Modify file or directory permissions (e.g.,
chmod 700 secret.txt)
chown (Change Owner)
- Change the user and/or group ownership of a file
chattr (Change Attribute)
- Set immutable bits to prevent file deletion even by root
Network Security & Monitoring
netstat -tulpn
- Display active network connections and listening ports
ss -lntu
- Modern alternative to netstat for socket statistics
nmap (Network Mapper)
- Scan for open ports and identify services running on a host
tcpdump
- Capture and analyze network traffic (packet sniffing)
Process & System Security
ps aux
- View all running processes to identify suspicious activities
top / htop
- Interactive process viewer to monitor real-time resource usage
kill / pkill
- Terminate unauthorized or malicious processes
who / w / last
- Check who is currently logged in and view login history
Logging & Analysis
grep / egrep
- Search through log files for specific patterns or anomalies
tail -f /var/log/auth.log
- Monitor authentication logs in real-time for failed login attempts
find / -perm -4000
- Search for files with SUID bit set (potential privilege escalation vectors)
Privacy & Cleanup
history -c
- Clear the current terminal command history
shred
- Overwrite a file to make it unrecoverable before deletion