A practical reference for the command line. Commands tested on Arch Linux / systemd systems; most apply to any Linux distro.
Linux Tips ยท Networking Tips ยท Nmap Commands ยท Wireshark Filters ยท Troubleshooting Tips
| # | Tip | Command / Notes |
|---|---|---|
| 1 | Search command history interactively | Ctrl+R โ type to filter, press again to cycle matches |
| 2 | Repeat the last command | !! โ useful as sudo !! when you forgot sudo |
| 3 | Reuse the last argument of the previous command | !$ e.g. mkdir /long/path && cd !$ |
| 4 | Jump to the previous directory | cd - |
| 5 | Directory stack for multi-directory navigation | pushd /path / popd / dirs -v |
| 6 | Search inside a man page | Press /pattern then n / N to cycle results |
| 7 | Search backwards in less | ?pattern inside less |
| 8 | Recursive text search with line numbers | grep -rn "pattern" /path โ add -l for filenames only |
| 9 | Find files modified in the last 7 days | find . -name "*.log" -mtime -7 |
| 10 | Pass command output as arguments to another command | find . -name "*.bak" | xargs rm |
| 11 | Write output to a file and still see it on screen | command | tee output.txt |
| 12 | Extract a specific column from text output | awk '{print $2}' file โ change $2 for the column you need |
| 13 | Global find-and-replace inside a file | sed -i 's/old/new/g' file |
| 14 | Count occurrences, most frequent first | sort | uniq -c | sort -rn |
| 15 | Disk usage of every item in the current directory | du -sh * |
| 16 | Human-readable disk free space | df -h |
| 17 | Find what is using a specific port | lsof -i :8080 or ss -tulnp | grep 8080 |
| 18 | Find a running process by name | pgrep -a nginx or ps aux | grep nginx |
| 19 | Kill a process gracefully, then forcefully if needed | kill PID (SIGTERM first) โ kill -9 PID (SIGKILL) |
| 20 | Keep a session alive after logout | tmux new -s name / tmux attach -t name |
| 21 | Create reusable command shortcuts | alias ll='ls -lh --color=auto' โ add to ~/.zshrc |
| 22 | Search history for a specific command type | history | grep ssh |
| 23 | Suspend a foreground process and background it | Ctrl+Z then bg |
| 24 | List background jobs and bring one to foreground | jobs โ fg %1 |
| 25 | Make a script executable | chmod +x script.sh |
| 26 | Change file owner and group | chown user:group file |
| 27 | Create a symbolic link | ln -s /path/to/target linkname |
| 28 | Compress a directory into a tarball | tar -czf archive.tar.gz dir/ |
| 29 | Extract a tar archive | tar -xzf archive.tar.gz โ add -C /dest for a target directory |
| 30 | Sync files efficiently with progress | rsync -avz --progress src/ dest/ |
| 31 | Generate a modern SSH key pair | ssh-keygen -t ed25519 -C "your@email" |
| 32 | Copy your public key to a remote host | ssh-copy-id user@host |
| 33 | Follow system logs in real time | journalctl -f โ add -u nginx to filter by unit |
| 34 | Manage systemd services | systemctl status|start|stop|restart|enable|disable service |
| 35 | View recent kernel messages with timestamps | sudo dmesg -T | tail -n 50 |
| 36 | Trace system calls of a running process | strace -p PID |
| 37 | Show shared library dependencies of a binary | ldd /usr/bin/binary |
| 38 | Locate where a command lives | which cmd / whereis cmd / type cmd |
| 39 | Abort on any error in bash scripts | set -euo pipefail at the top of every script |
| 40 | Run a command that survives terminal close | nohup command & disown |
| # | Tip | Command / Notes |
|---|---|---|
| 41 | Show all network interfaces and addresses | ip addr (modern replacement for ifconfig) |
| 42 | View the routing table | ip route |
| 43 | List open ports and their processes | ss -tulnp (modern replacement for netstat -tulnp) |
| 44 | Detect service versions on open ports | nmap -sV host |
| 45 | Scan all 65535 ports | nmap -p- host |
| 46 | Limit ping to a fixed count | ping -c 4 host |
| 47 | Trace the route to a host | traceroute host or tracepath host (no root needed) |
| 48 | Fetch only HTTP response headers | curl -I https://example.com |
| 49 | Debug a curl request in full detail | curl -v https://example.com |
| 50 | Resume an interrupted download | wget -c URL |
| 51 | Look up a specific DNS record type | dig domain MX (or A, AAAA, TXT, NS) โ many servers no longer answer ANY in full (RFC 8482), so ask for each type you need |
| 52 | Quick, clean DNS answer | dig +short domain |
| 53 | Query a specific DNS server | dig @8.8.8.8 domain |
| 54 | Domain registration and owner info | whois domain |
| 55 | List current firewall rules | iptables -L -n -v or nft list ruleset (nftables) |
| 56 | Capture live traffic on an interface | tcpdump -i eth0 -n port 80 |
| 57 | Quick port scan with netcat | nc -zv host 20-25 |
| 58 | Simple TCP listener for connectivity testing | nc -l 4444 (server) / nc host 4444 (client) |
| 59 | Forward a local port through SSH | ssh -L 8080:localhost:80 user@host |
| 60 | Create a SOCKS proxy via SSH | ssh -D 1080 user@host โ point browser to localhost:1080 |
| 61 | Real-time traceroute with packet loss stats | mtr host |
| 62 | View the ARP cache | arp -n or ip neigh |
| 63 | Get all local IP addresses | hostname -I |
| 64 | Get your public IP from the terminal | curl -s ifconfig.me |
| 65 | Override DNS for a host locally | Add 1.2.3.4 hostname to /etc/hosts |
| 66 | Check or change the DNS resolver | /etc/resolv.conf โ on systemd: resolvectl status |
| 67 | Manage connections via NetworkManager CLI | nmcli con show / nmcli dev wifi connect SSID password PASS |
| 68 | Scan for nearby WiFi networks | nmcli dev wifi list or iwlist wlan0 scan |
| 69 | Check NIC speed and duplex | ethtool eth0 |
| 70 | Save a packet capture for Wireshark | tcpdump -i eth0 -w capture.pcap |
| # | Use Case | Command |
|---|---|---|
| 1 | Quick ping scan โ discover live hosts on a subnet | nmap -sn 192.168.1.0/24 |
| 2 | Fast scan of the 1000 most common ports | nmap -F host |
| 3 | Scan all 65535 ports | nmap -p- host |
| 4 | Detect service versions on open ports | nmap -sV host |
| 5 | OS detection (requires root) | sudo nmap -O host |
| 6 | Aggressive scan โ OS, version, scripts, traceroute | sudo nmap -A host |
| 7 | SYN stealth scan (half-open, requires root) | sudo nmap -sS host |
| 8 | UDP scan for common services (DNS, SNMP, etc.) | sudo nmap -sU --top-ports 20 host |
| 9 | Run default NSE scripts against a host | nmap -sC host |
| 10 | Save results in all formats (normal, XML, grepable) | nmap -oA scan_output host |
| # | Use Case | Filter |
|---|---|---|
| 1 | Show only HTTP traffic | http |
| 2 | Show only HTTPS / TLS traffic | tls |
| 3 | Filter by source or destination IP | ip.addr == 192.168.1.10 |
| 4 | Filter by source IP only | ip.src == 192.168.1.10 |
| 5 | Filter traffic on a specific port | tcp.port == 443 or udp.port == 53 |
| 6 | Show only DNS queries and responses | dns |
| 7 | Show TCP connection resets (useful for troubleshooting drops) | tcp.flags.reset == 1 |
| 8 | Show TCP SYN packets only (spot connection attempts) | tcp.flags.syn == 1 && tcp.flags.ack == 0 |
| 9 | Filter traffic between two specific hosts | ip.addr == 10.0.0.1 && ip.addr == 10.0.0.2 |
| 10 | Search packet contents for a string (e.g. credentials in cleartext) | frame contains "password" |
| # | Tip | Command / Notes |
|---|---|---|
| 71 | Always start with the logs | journalctl -xe or /var/log/syslog / /var/log/messages |
| 72 | Find kernel errors and warnings | dmesg | grep -i "error\|fail\|warn" |
| 73 | Check available memory | free -h |
| 74 | Real-time CPU, memory, and I/O stats | vmstat 1 โ updates every second |
| 75 | Disk I/O utilization per device | iostat -x 1 |
| 76 | Interactive process monitor | htop (install separately) or top |
| 77 | See which process is hammering the disk | iotop (requires root) |
| 78 | Check system load averages | uptime โ 1/5/15-min averages; above CPU count = overloaded |
| 79 | See recent successful logins | last (Debian 13 and newer: wtmpdb last) |
| 80 | See failed login attempts | lastb (requires root; Debian 13 and newer: lslogins --failed) |
| 81 | Check auth log for brute force activity | grep "Failed password" /var/log/auth.log, or sudo journalctl -g "Failed password" on systems with no auth.log (only the systemd journal, e.g. Debian 12 and newer) |
| 82 | Get a summary of network statistics | ss -s |
| 83 | List all block devices and mount points | lsblk |
| 84 | Get UUIDs of block devices for /etc/fstab | blkid |
| 85 | Check and repair a filesystem | fsck /dev/sdXN โ only on unmounted partitions |
| 86 | Check drive health via SMART | smartctl -a /dev/sda โ install smartmontools |
| 87 | See exactly what a command does at the OS level | strace -e trace=file command |
| 88 | Trace library calls | ltrace command |
| 89 | Check if resource limits are causing failures | ulimit -a โ raise open files with ulimit -n 65535 |
| 90 | See which process owns each network socket | ss -tp |
| 91 | Find what is preventing an unmount | lsof +D /mnt/drive or fuser -m /mnt/drive |
| 92 | View all environment variables | env or printenv VAR for a single variable |
| 93 | Fix a broken or garbled terminal | reset โ or stty sane if reset is also unresponsive |
| 94 | Determine what type of file something is | file /path/to/file |
| 95 | Check the HTTP status code of a URL | curl -o /dev/null -sw "%{http_code}\n" URL |
| 96 | Test if a remote port is reachable | nc -zv host port |
| 97 | Check SSL certificate expiry date | echo | openssl s_client -connect host:443 2>/dev/null | openssl x509 -noout -dates |
| 98 | Find large files consuming disk space | find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -k5 -rh |
| 99 | Verify a file's integrity with a checksum | sha256sum file then compare against the published hash |
| 100 | Always capture verbose output before escalating an issue | command -v 2>&1 | tee debug.log โ attach the log when asking for help |
Disclaimer: Any action and or abuse related to the material contained within this site are solely YOUR RESPONSIBILLTY. The misuse of the information on this website can result in criminal charges brought against the persons in question.