🔍
Artificial Intelligence Cybersecurity Windows Mac Android iPhone Software How-To Guides Reviews Comparisons Productivity Internet Apps Cloud Business Software About Contact

20 Linux Commands Every Programmer Should Know

The Linux command line is the most powerful tool in a developer's arsenal. GUI tools are convenient but limited. The terminal gives you unlimited access to every aspect of the system. These 20 commands cover what you need for daily development work.

File and Directory Commands

ls lists files and directories. ls -la shows all files including hidden with detailed info. cd changes directory. pwd prints the current path. mkdir -p creates directories including parent directories. rm -rf removes files and directories recursively (dangerous, use with caution). cp -r copies recursively. mv moves or renames.

find searches for files: find . -name "*.js" -type f. grep searches file contents: grep -r "function" src/. touch creates empty files or updates timestamps. chmod changes permissions: chmod +x script.sh. chown changes ownership.

Process and System Commands

ps shows running processes. ps aux shows all processes with details. top or htop shows real-time process info and system resource usage. kill terminates processes: kill -9 PID. killall terminates by name. systemctl manages systemd services: systemctl start nginx, systemctl enable nginx.

df -h shows disk usage in human-readable format. du -sh * shows size of each file/directory in the current folder. free -h shows memory usage. uname -a shows system information. lscpu shows CPU details.

Networking Commands

ping tests connectivity: ping google.com. curl makes HTTP requests: curl -I https://example.com. wget downloads files. ss or netstat shows network connections: ss -tuln shows listening ports. ifconfig or ip addr shows network interfaces. nslookup or dig resolves DNS names to IP addresses.

ssh connects to remote servers: ssh user@host. scp transfers files: scp file.txt user@host:/path/. rsync syncs files efficiently: rsync -avz source/ user@host:/destination/. nc (netcat) reads and writes network connections.

Text Processing Commands

head and tail show the beginning or end of files: head -n 20 file.txt, tail -f log.txt (follow mode). less pages through files interactively. wc counts lines, words, and characters: wc -l file.txt. sort sorts lines: sort -n file.txt (numeric sort). uniq removes duplicates: sort file.txt | uniq. cut extracts columns: cut -d',' -f1,3 data.csv.

sed edits text non-interactively: sed 's/old/new/g' file.txt. awk processes structured text: awk '{print $1}' file.txt. xargs builds and executes command lines from input: find . -name "*.tmp" | xargs rm. tee writes to file and stdout simultaneously: command | tee output.log.