Skip to main content

Command Palette

Search for a command to run...

The Ultimate Linux Command Cheat Sheet for Software Developers

Updated
โ€ข3 min readโ€ขView as Markdown
The Ultimate Linux Command Cheat Sheet for Software Developers
T
Team Lead building scalable backend systems and DevOps pipelines. Experienced in AWS, Laravel, and automation workflows. I write about real-world engineering problems and solutions.

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! ๐Ÿ’ป

More from this blog

T

Trushang DevOps | AWS, Backend & Scalable Systems

25 posts

Real-world backend engineering and DevOps insights from building scalable systems on AWS. I share practical solutions, automation workflows, and production-ready architectures.