Linux Basics for Developers: Commands You Use Every Day

Learn the Linux commands every developer needs. File permissions, package management, process control, and server management covered clearly.

Key Takeaways

  • File permissions (chmod, chown) control who can read, write, and execute files
  • Package managers (apt, yum, brew) install and update software from the terminal
  • Cron jobs schedule automated tasks to run at specified intervals
  • Systemd manages services — start, stop, enable, and check status with systemctl
  • Understanding Linux is essential for cloud servers, Docker, and DevOps work

Whether you're deploying on AWS, running Docker containers, or writing Python scripts, you're almost certainly running on Linux. The cloud runs on Linux. AI training runs on Linux. Knowing how to navigate a Linux system isn't optional for any serious developer. This guide covers the fundamentals you'll use daily — not the history of Unix, just the commands and concepts that actually matter.

File Permissions: Who Can Do What

Every Linux file has three permission sets: owner, group, and others. Each set has three permissions: read (r=4), write (w=2), execute (x=1). ls -la shows permissions like -rwxr-xr--: first character is file type (- for file, d for directory), then owner/group/others permissions. Change permissions with chmod: chmod 755 script.sh (owner: rwx, group: r-x, others: r-x). Common values: 644 for regular files (owner can write, others read-only), 755 for executables and directories, 600 for private files (SSH keys). Change ownership: chown user:group file. sudo chown -R www-data:www-data /var/www recursively sets web server ownership.

Package Management: Installing and Updating Software

Different Linux distributions use different package managers. Ubuntu/Debian: apt. CentOS/RHEL: yum or dnf. macOS: brew (Homebrew). Essential apt commands: sudo apt update (refresh package index), sudo apt upgrade (upgrade all installed packages), sudo apt install package-name (install), sudo apt remove package-name (uninstall), apt search keyword (search available packages). For Python packages use pip install. For system-wide Python environment management, pyenv lets you switch between Python versions. Always use virtual environments (python -m venv venv) to isolate project dependencies.

System and Process Information

Understanding what your system is doing: top — interactive process viewer showing CPU/memory usage. htop — better version of top (install separately). df -h — disk usage by partition (human-readable). du -sh folder — size of a specific folder. free -h — RAM usage. uname -a — kernel and OS info. uptime — how long the system has been running and load averages. who — who is logged in. last — recent logins. For cloud servers, checking disk space and memory before running large jobs is a habit that prevents many frustrating out-of-memory crashes mid-training-run.

Services and Systemd: Managing Long-Running Processes

Modern Linux uses systemd to manage services (web servers, databases, custom applications). Essential commands: sudo systemctl start service, sudo systemctl stop service, sudo systemctl restart service, sudo systemctl status service (shows if running and recent logs), sudo systemctl enable service (start on boot), sudo systemctl disable service. Check logs: journalctl -u service-name -f (follow logs in real time), journalctl -u service-name --since '1 hour ago'. Running your own Python app as a service is straightforward — create a .service file in /etc/systemd/system/ defining ExecStart and restart behavior.

Cron Jobs: Schedule Automated Tasks

Cron schedules commands to run automatically. Edit crontab: crontab -e. Crontab syntax: minute hour day month weekday command. Examples:

# Run at midnight every day
0 0 * * * /usr/bin/python3 /home/user/backup.py

# Run every 5 minutes
*/5 * * * * /home/user/check_status.sh

# Run at 9 AM every weekday
0 9 * * 1-5 /home/user/reports.py

# Log output
0 0 * * * /home/user/job.sh >> /var/log/job.log 2>&1

Use crontab.guru to verify cron expressions visually before deploying. Always use absolute paths in cron jobs — the environment is minimal and relative paths fail.

Environment Variables and Configuration

Environment variables store configuration that programs read at runtime. View all: env or printenv. Set temporarily: export API_KEY='abc123' (lasts for the session). Set permanently: add the export line to ~/.bashrc or ~/.zshrc, then source ~/.bashrc to reload. In Python: import os; key = os.getenv('API_KEY'). For production servers, never hardcode secrets in code or config files. Use environment variables, or a secrets manager like AWS Secrets Manager or HashiCorp Vault. The .env file pattern (with python-dotenv) is common for development — add .env to .gitignore immediately.

Frequently Asked Questions

Do I need to learn Linux if I use macOS?
macOS is Unix-based, so most Linux commands work on macOS. But cloud servers, Docker containers, and CI/CD systems run Linux, so knowing Linux-specific tools like apt, systemctl, and Linux filesystem conventions is important for real-world development.
What Linux distribution should a developer use?
Ubuntu LTS (Long Term Support) is the most widely used for servers and is beginner-friendly. For local development on non-macOS, Ubuntu Desktop or Fedora are solid choices. The distribution matters less than learning the core commands — they transfer across distributions.
Is Linux required for AI and machine learning work?
Effectively yes for serious work. GPU training typically runs on Linux servers. Cloud ML instances run Linux. Docker containers are Linux-based. Even if you develop locally on macOS or Windows, you'll interact with Linux servers constantly.
How do I connect to a Linux server?
SSH (Secure Shell) is the standard: ssh user@server-ip. You'll need either a password or an SSH key pair. Generate a key pair with ssh-keygen, then add your public key (~/.ssh/id_rsa.pub) to the server's ~/.ssh/authorized_keys file for passwordless login.

Ready to Level Up Your Skills?

Linux, Python, cloud tools, and AI development — covered in depth at our 3-day hands-on bootcamp. 400+ professionals trained. Next cohorts October 2026 in Denver, NYC, Dallas, LA, and Chicago. Only $1,490.

View Bootcamp Details

About the Author

Bo Peng is an AI Instructor and Founder of Precision AI Academy. He has trained 400+ professionals in AI, machine learning, and cloud technologies. His bootcamps run in Denver, NYC, Dallas, LA, and Chicago.