The Ultimate Linux Command Cheat Sheet for Software Developers

Trushang SutharTrushang Suthar
3 min read

As a software developer, especially when managing remote servers or backend systems, Linux commands are essential tools in your daily workflow. Whether you're connecting to servers, transferring code, working with databases, or managing backups, mastering these commands will save you hours of effort.


πŸ” 1. SSH (Secure Server Access)

Basic SSH Connection

ssh username@your.server.ip

Using SSH Key

ssh -i ~/.ssh/your-key.pem username@your.server.ip

Keep Long SSH Sessions Alive

# Start a screen session
screen

# Or use tmux
tmux
  • Detach: Ctrl+A then D

  • Reattach: screen -r or tmux attach

Server-to-Server File Transfer

Using scp

scp file.txt user@remote:/path/
scp -r folder/ user@remote:/path/
scp user@remote:/path/file.txt .              # Download from server

Using rsync (faster for large/multiple files)

rsync -avz /source/ user@remote:/destination/

πŸ“ 2. Linux File Operations (Move, Copy, Zip)

πŸ“‚ Navigating the Filesystem

cd /path/to/directory
ls
ls -alh
pwd

πŸ”„ Move and Copy Files

mv source.txt /destination/
cp source.txt /destination/
cp -r folder/ /destination/

πŸ“¦ Zip & Unzip

zip -r archive.zip .
zip -r folder.zip /path/to/folder
zip images.zip *.jpg
zip -r logs.zip *.log
zip -r backup.zip folder1 folder2 file1.txt
unzip archive.zip
unzip archive.zip -d /target/

πŸ“… Download Files with curl

curl -O https://example.com/file.zip
curl -o custom.zip https://example.com/file.zip

πŸ” File Permissions & Ownership

chmod 755 script.sh
chmod +x deploy.sh
chown user:group file.txt
ln -s /actual/path /shortcut/path

πŸ“„ Useful Shortcuts with Aliases

alias devserver='ssh user@192.168.1.2'
alias dbexport='mysqldump -u root -p mydb > ~/backup.sql'
alias reloadshell='source ~/.bashrc'

πŸ” File Search & Text Filtering

find . -name "*.log"
grep -rnw '.' -e 'search-term'
grep -i 'error' /var/log/nginx/error.log
awk '{print $1, $3}' filename.txt
cut -d ':' -f1 /etc/passwd

βœ‚ Directory Cleanup Examples

rm -rf /path/to/folder
rm *.log
rm -f *.tmp

πŸ“‚ 3. MySQL: Import, Export, Backup

Export Entire Database

mysqldump -u user -p db_name > backup.sql

Export Specific Table

mysqldump -u user -p db_name table_name > table.sql

Export Multiple Tables

mysqldump -u user -p db_name table1 table2 > partial_backup.sql

Import SQL File

mysql -u user -p db_name < backup.sql

Create Database Before Import

mysql -u user -p -e "CREATE DATABASE new_db;"
mysql -u user -p new_db < backup.sql

⏰ Automate Backups with cron

crontab -e

Example: Daily backup at 2 AM

0 2 * * * /usr/bin/mysqldump -u user -p'password' db > /home/user/db.sql

πŸ“Š 4. Monitor Server Performance & Logs

πŸ”Ž System Health

top             # Live processes
htop            # (if installed)
df -h           # Disk usage
free -m         # Memory
uptime          # Load average & uptime
vmstat          # System performance

πŸ“ Logs

tail -f /var/log/syslog
tail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log
journalctl -u nginx.service

βš™ System Services

systemctl status nginx
systemctl restart nginx
systemctl enable nginx

πŸ”’ Network and Ports

netstat -tuln
ss -tuln
lsof -i :80
ping google.com
traceroute google.com

βœ… Final Thoughts

This guide equips you with practical Linux commands for development, deployment, and server maintenance. From connecting via SSH to importing databases and monitoring server health, these tools are indispensable for backend and DevOps workflows.

Let me know if you'd like a downloadable PDF or Markdown version. Happy coding! πŸ’»

0
Subscribe to my newsletter

Read articles from Trushang Suthar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Trushang Suthar
Trushang Suthar

Code is like a puzzleβ€”sometimes you just need to step back, take a breath, and the solution clicks.