Linux command line basics every developer needs
The commands you will actually use: moving around, working with files, permissions, pipes and grep, processes and ports, packages and SSH, plus the safety habits that prevent disasters.
The Linux command line lets you control a computer by typing commands instead of clicking, and most servers, cloud machines and developer tools run on it. Every developer needs a core set: moving between folders, managing files, reading permissions, combining commands with pipes, searching with grep, managing processes, installing packages and connecting to servers with SSH.
You do not need to memorise hundreds of commands. About twenty-five cover most daily work. This guide explains them in the order you will need them, with examples to try, and ends with the habits that keep you from deleting the wrong thing.
Why do developers need the terminal?
How do you get a terminal?
On Linux and macOS, open the Terminal app; macOS uses a very similar Unix command line. On Windows, the easiest route is the Windows Subsystem for Linux, which runs a real Linux environment inside Windows; Microsoft’s WSL installation guide walks you through it.
How do you move around?
The terminal always has a current folder, called the working directory. These commands let you see where you are and move:
pwd # print where you are ls # list files ls -la # list all files, including hidden ones, with details cd projects # move into a folder cd .. # move up one level cd ~ # go to your home folder
Press Tab to auto-complete file and folder names. It saves typing and prevents typos, and it is the single most useful habit to build early.
Which commands work with files?
tail -f deserves a special mention: it follows a log file live as new lines are written, which is how you watch a server while testing it.
What do file permissions mean?
Run ls -l and you will see strings such as -rwxr-xr--. After the first character, they come in three groups of three: permissions for the owner, the group and everyone else. r is read, w is write and x is execute.
chmod +x deploy.sh # make a script executable chmod 600 secrets.env # only the owner can read and write sudo apt update # run a command as administrator
Use sudo only when a task genuinely needs administrator rights, and read the command before pressing Enter. Never paste commands from the internet with sudo unless you understand exactly what they do.
How do pipes, redirection and grep work?
The real power of the command line is combining small commands. The pipe | sends one command’s output into another. Redirection > writes output to a file, and >> appends to it. grep searches text.
grep "ERROR" server.log # lines containing ERROR grep -i "timeout" server.log | wc -l # count them, ignoring case grep -rn "API_KEY" src/ # search a whole folder, with line numbers ls -la > files.txt # save a listing to a file history | grep git # find git commands you ran earlier
Once pipes click, you start seeing everyday tasks as small chains of commands.
How do you manage processes and ports?
Every running program is a process. When a server will not start because “the port is already in use”, these help:
ps aux | grep node # find running node processes top # live view of CPU and memory (q to quit) kill 12345 # stop a process by its ID ss -tulpn # see which ports are in use (Linux)
Press Ctrl+C to stop the program currently running in your terminal.
How do you install software and reach servers?
Linux distributions install software through package managers. On Ubuntu and Debian, that is apt:
sudo apt update sudo apt install git curl
SSH lets you open a terminal on a remote machine securely, which is how you manage cloud servers:
ssh-keygen -t ed25519 # create a key pair once ssh [email protected] # connect to a server scp report.csv [email protected]:~/ # copy a file to it
Use SSH keys rather than passwords, and never share your private key file.
Can you automate tasks with scripts?
Any sequence of commands can become a shell script. Save this as backup.sh, make it executable, and run it:
#!/bin/bash # Back up the project folder with today's date tar -czf "backup-$(date +%F).tar.gz" ~/projects/my-app echo "Backup done"
Small scripts like this are the start of the automation that DevOps and MLOps are built on. Program Zero’s explainer on what MLOps is shows where these skills lead when models go into production.
How do you find files and check disk space?
Two situations come up constantly: “where is that file?” and “why is the disk full?”. These commands answer both:
find . -name "*.log" # find log files below the current folder find . -name "*.py" -mtime -1 # Python files changed in the last day df -h # free space on each disk, human-readable du -sh * # size of each item in the current folder
On servers, full disks are a common cause of mysterious failures: databases stop writing, uploads fail and logs vanish. Running df -h early when something breaks often saves an hour of guessing. If du shows a huge logs folder, the fix is usually log rotation rather than deleting files by hand.
Environment variables are the other thing worth knowing early. echo $PATH shows where the shell looks for programs, and export NAME=value sets a variable for the current session. Many “command not found” errors are really PATH problems.
Which safety habits matter most?
pwd before deleting anything, and ls the files you are about to delete.rm -r and never run it with sudo on a path you have not checked.For a structured, free reference, William Shotts’s book The Linux Command Line is excellent, and the GNU Coreutils manual documents the standard commands in detail. Once you are comfortable here, our guide to Git and GitHub for beginners is the natural next step.
The command line is where Program Zero begins: Phase 0 covers how computers work, Linux fundamentals, the command line and bash scripting, Git and how the internet works, before any programming language.
Want to learn this live, with mentors?
Program Zero starts from the ground up, with Linux, the command line and Git, then builds to full-stack development and AI over 18 months of live, mentor-led classes. ₹5,999 for all 18 months; the batch starts 9 January 2027.
Frequently asked questions
Related reading
We teach this, live
Every article here comes from something we teach. Sit in on a free masterclass and judge the mentors yourself.