Developers live in the terminal more than they expect. Deploying code, inspecting a server, searching logs, checking why a process is stuck, moving files in bulk: these jobs are all faster from the command line than through any graphical tool, once the core commands feel familiar. The good news is that the core is small. Twenty commands cover the overwhelming majority of everyday terminal work, and they behave the same on a laptop, a virtual machine, and a production server.
This list groups the twenty by job: moving around, working with files, searching, managing processes, handling permissions, and checking the network. Each entry gives the command, what it does in plain language, and the form you will actually type. The list pairs naturally with our Git basics guide, since Git work happens in this same terminal, and with the SSH cheat sheet for reaching the machine in the first place.
Moving Around: pwd, ls, and cd
The first three commands answer the most basic questions: where am I, what is here, and how do I go somewhere else. Every terminal session starts in some folder, called the working directory, and every relative file path is interpreted from there. Losing track of the working directory is the root cause of many cannot find file confusions, which these commands prevent.
pwd ls ls -la cd /var/www/html cd .. cd ~
The pwd command prints the working directory, the full path of the folder you are currently in. The ls command lists the contents of the current folder, and with the combined la flags it shows a long listing, the l part, including hidden files whose names begin with a dot, the a part; hidden files matter because configuration often lives in them. The cd command changes directory: followed by a full path it takes you there directly, followed by two dots it moves up one level to the parent folder, and followed by a tilde or by nothing it returns you to your home directory. Together these three are muscle memory within a week. A related habit is using tab completion as you type paths, which fills in names and reveals mistakes before you run anything.
Working With Files: mkdir, touch, cp, mv, and rm
The next five commands create, copy, move, and delete. They are the file manager of the terminal, and they work on servers where no graphical file manager exists. They also work at a scale graphical tools struggle with, such as creating a folder structure or moving a hundred files that match a pattern in one line.
mkdir -p project/src project/tests touch project/src/app.js cp app.js app-backup.js cp -r project project-copy mv old-name.txt new-name.txt rm temp.log rm -r old-project
Take them in order. Mkdir makes directories, and the p flag creates parent folders as needed, so the whole nested structure in the example appears in one command instead of three. Touch creates an empty file if it does not exist, or updates its timestamp if it does; developers use it constantly to create placeholder files quickly. Cp copies: file to file as in the backup example, and with the r flag, which means recursive, it copies whole folders with everything inside them. Mv moves a file, and because moving a file to a new name in the same folder is a rename, mv doubles as the rename command, as the old-name example shows. Rm removes files, and with r it removes folders and their contents. Rm deserves respect: the terminal has no recycle bin, and a removed file is gone. Check your working directory with pwd and list with ls before any recursive remove, and treat any command combining rm with broad patterns as a stop-and-read moment. Safe habits here matter even more on servers reached through remote deployment workflows.
Viewing Content: cat, less, head, and tail
Four commands display file contents, each suited to a different size of file and a different question. Choosing the right one saves you from dumping a ten-thousand-line log into your terminal or opening a heavy editor just to check three lines of configuration.
cat config.json less access.log head -n 20 access.log tail -n 20 error.log tail -f error.log
Cat prints an entire file to the screen at once. It is perfect for short files like the configuration example, and painful for long ones, since the content simply floods past. Less solves that by opening the file in a scrollable viewer: arrow keys or page keys move through it, a slash starts a search inside the file, and q quits back to the prompt. Head shows only the first lines of a file, ten by default or the number you give with the n flag, which suits checking the format of a data file. Tail is its mirror, showing the last lines, which is where the newest log entries live. The f flag on the final line is a developer favourite: follow mode keeps tail running and prints new lines as they are written, so you can watch an error log live while you reproduce a bug in another window. Press control and c together to stop following and return to the prompt.
Searching: grep and find
Two search commands cover text and files respectively. Grep searches inside files for lines matching a pattern. Find searches the directory tree for files matching conditions like name, type, or age. Between them, questions like where is this function used and where did that file go become seconds of work.
grep "function login" app.js grep -rn "TODO" src/ find . -name "*.log" find . -type f -mtime -7
The first grep line prints every line in one file containing the quoted text. The second line is the workhorse form: r searches recursively through a folder, n adds line numbers to the results, and the pattern here finds every TODO comment left in the source tree. Find starts from a location, where the dot means the current folder and everything below it. The name condition with a quoted pattern lists files by name pattern, using the star as a wildcard, in this case every log file. The last example finds regular files, the type f condition, modified within the last seven days, expressed as mtime minus seven. Find output often feeds other commands in real workflows, such as listing the largest files taking space or locating a configuration file whose exact folder you forgot.
Processes and System State: ps, top, and kill
When an application hangs, a port is mysteriously busy, or a server feels slow, three commands diagnose and act. They show what is running, how much it is using, and let you stop a process cleanly or forcefully when there is no alternative.
ps aux top kill 1234 kill -9 1234
The ps command with the aux flags gives a snapshot of every process on the system, with its owner, its process ID, and its CPU and memory usage; developers usually pipe it through grep to find one application by name. Top is the live version, a continuously updating table sorted by resource use, which is where you spot the runaway process eating the processor; q quits it. Kill sends a signal to a process by its ID number: the plain form asks the process to shut down gracefully, giving it the chance to save state and close files, while the dash nine form forces an immediate stop that the process cannot refuse or clean up after. Always try the graceful form first, wait a moment, and reserve the forced form for processes that ignore it. Killing the wrong ID on a shared server ends someone service, so confirm the ID and command name in the ps output before acting.
Permissions: chmod and chown
Linux permissions decide who can read, write, and execute each file, and they cause a familiar class of errors: a web server that cannot read its own files, or a script that refuses to run because it is not marked executable. Two commands control them. These are everyday knowledge for anyone deploying the kind of projects described in our guides to PHP form handling or static sites.
chmod +x deploy.sh chmod 644 index.html chmod 755 uploads/ ls -l sudo chown www-data:www-data uploads/
The first chmod line adds the executable permission to a script, which is the fix when the shell answers permission denied as you try to run your own file. The numeric forms set exact permissions: each digit covers the owner, the group, and everyone else, and each digit is the sum of read as four, write as two, and execute as one. So 644 means the owner can read and write while everyone else can only read, the standard setting for web files, and 755 adds execution, which folders need so their contents can be entered and listed. The ls with the l flag displays current permissions at the start of each line, so you can verify before and after. Chown changes ownership, and because ownership belongs to the system, it normally runs through sudo, which executes one command with administrator rights. The example gives an uploads folder to the web server user so the application can save files into it, the classic fix for upload features that fail silently on a fresh server.
Disk, Network, and Getting Help
Three utility commands round out the twenty. They answer how full is the disk, is that host reachable, and how does this command actually work, which between them cover most remaining daily questions.
df -h du -sh project/ ping -c 4 example.com curl -I https://example.com man grep grep --help
The df command reports free and used space on every mounted filesystem, and the h flag prints sizes in human readable form like gigabytes instead of raw blocks. Its partner du estimates the space a folder and its contents occupy, with s summarising to one total, which is how you hunt down what filled a disk. Ping sends small packets to a host and reports replies, confirming basic reachability, with c limiting the count to four tries instead of running forever. Curl fetches a web address from the terminal, and the capital I flag asks only for the response headers, a quick way to check that a site or API is up and see its status code without a browser. Finally, man opens the full manual page for any command, and the help flag prints a shorter summary; on any system, these built-in references mean an unfamiliar flag is a lookup away rather than a guess. Knowing how to read them is a skill in itself: skim the description, jump to the examples if the manual provides them, and test flags on a harmless file first.
Putting It Together: Pipes and a Real Session
The individual commands become genuinely powerful when combined with pipes, which pass the output of one command as the input of the next using the vertical bar character. Pipes turn the twenty commands into a kit of parts, and most real terminal work is two or three of them chained.
ps aux | grep node cat access.log | grep "404" | wc -l ls -la | less
The first chain filters the full process list down to lines mentioning node, answering is my server process running in one glance. The second counts problems: it reads a web access log, keeps only the lines containing 404 errors, and counts those lines with wc, giving you the number of missing page hits without opening the log at all. The third pages a long directory listing through less so it does not flood the screen. Add redirection with the greater-than symbol to save output into a file instead of printing it, and you can capture reports, filtered logs, and listings for later. These combinations, built from the commands above plus the Git commands in the basics guide, are what a normal debugging or deployment session actually looks like: navigate with cd, inspect with ls, cat, and grep, check processes with ps, and act with confidence because each step was verified by the one before it.
A closing habit worth forming: before running a command you found online, especially one involving rm, chmod, chown, or kill, read its manual entry or help output and make sure you understand every flag. The terminal rewards precision and does exactly what you typed, which is its strength when you are careful and its danger when you paste blindly. Type destructive commands slowly, lean on tab completion and ls checks, and prefer doing a task in two verifiable steps over one clever line you cannot fully explain.
Conclusion
Twenty commands form the working core of Linux for developers: pwd, ls, and cd to navigate; mkdir, touch, cp, mv, and rm to manage files; cat, less, head, and tail to read; grep and find to search; ps, top, and kill for processes; chmod and chown for permissions; and df, ping, and man-style help to understand the system itself. Learned individually they are useful. Combined with pipes and used with the habit of verifying before acting, they handle nearly every terminal task a developer meets, on a laptop or on a server halfway around the world.
Tagged: bash commands command line developer tools linux commands linux for developers terminal basics



One thought on “20 Linux Terminal Commands Every Developer Should Know”