Linux Command Line – Essential Skills Every Developer Should Have

The command line intimidates newcomers. A blinking cursor on a black screen offers no hints about what to type next. But once you learn a handful of commands, the terminal transforms from an obstacle into your most efficient tool. This guide covers the commands you will actually use every day, with realistic examples drawn from real development work.

The Philosophy of the Command Line

Unix-based systems are built on a simple philosophy: each program should do one thing well, and programs should be combinable. A complex task is not handled by a single complex program but by chaining simple tools together.

This philosophy, articulated in the 1970s, remains powerful today. Commands like grep, sort, and wc each do one thing. Connected with pipes, they handle tasks that would require dozens of lines of code in a traditional program. Learning the command line is partly learning individual commands, but mostly it is learning how to combine them.

These six commands handle 90% of filesystem navigation:

1
2
3
4
5
6
pwd                    # print working directory — where am I?
ls # list files
ls -la # list all files, including hidden, with details
cd projects # change into the projects directory
cd .. # go up one level
cd - # go back to the previous directory

The - in cd - is one of those small tricks that, once learned, becomes muscle memory. You are working deep in a directory tree, you need to briefly check something in another directory, and one command brings you right back.

Tab completion is the most important productivity feature of the shell. Start typing a directory or file name and press Tab. The shell completes it. If there are multiple matches, press Tab twice to see them all. This alone saves thousands of keystrokes per day.

File Operations

1
2
3
4
5
6
7
8
9
10
11
touch README.md        # create an empty file or update timestamp
mkdir new-project # create a directory
mkdir -p src/components # create nested directories
rm file.txt # delete a file (permanently — no trash bin)
rm -rf old-project # delete a directory and everything inside
cp source.txt dest.txt # copy a file
mv old.txt new.txt # rename or move a file
cat file.txt # display file contents
less large-file.log # view a file with scrolling (q to quit)
head -20 file.txt # show first 20 lines
tail -f app.log # follow a log file in real time

A critical safety note about rm: there is no undo. Files deleted with rm do not go to a trash bin. They are gone. This is a feature, not a bug — the command line assumes you know what you are doing. When you run rm -rf on a directory, double-check that you are in the right directory first. A pwd before a destructive command takes half a second and has saved countless people from deleting the wrong thing.

grep searches for patterns in text. It is the command I use more than any other besides cd and ls. The basic usage is simple, but the power comes from its options and its ability to combine with other commands through pipes:

1
2
3
4
5
6
7
8
9
grep "error" app.log                    # find lines containing "error"
grep -i "warning" app.log # case-insensitive search
grep -r "TODO" src/ # search recursively through a directory
grep -c "500" access.log # count matching lines
grep -v "debug" app.log # exclude lines containing "debug"
grep -A 3 "error" app.log # show 3 lines after each match
grep -B 2 "error" app.log # show 2 lines before each match
grep -n "function" utils.js # show line numbers
grep -E "error|warning|critical" log # extended regex for multiple patterns

A realistic scenario: you have a 50-megabyte application log file, and somewhere in it is a stack trace from an error this morning. You know the error involved a database connection. You do not know the exact error message or which line it occurred on.

1
grep -A 20 "database" app.log | less

This finds every line containing “database,” shows 20 lines after each match, and pipes the results into less for scrolling. In ten seconds you find the stack trace. This would take minutes in a text editor and might not be possible at all if the file is too large to open.

Pipes and Redirection

The pipe character | takes the output of one command and feeds it as input to another. This is the superpower of the command line:

1
cat app.log | grep ERROR | wc -l

This reads the log file, filters to lines containing “ERROR,” and counts them. Three commands, each doing one thing, combined to answer “how many errors are in the log?”

1
history | grep "docker" | sort | uniq -c | sort -rn | head -10

This finds the ten Docker commands you use most often. It reads your shell history, filters to commands containing “docker,” sorts them alphabetically, groups duplicates and counts occurrences, sorts by count descending, and shows the top ten. Try doing that with a GUI.

Redirection sends output to a file instead of the terminal:

1
2
3
ls -la > files.txt      # overwrite files.txt with directory listing
echo "done" >> log.txt # append "done" to log.txt
node app.js 2>&1 | tee output.log # see output AND save to file

The tee command is underappreciated. It splits the pipeline, writing to both a file and standard output. This lets you watch a command’s output in real time while also saving it. Useful for long-running builds, test suites, and deployments.

File Permissions

Every file and directory in Linux has three sets of permissions: for the owner, the group, and everyone else. Each set has three possible permissions: read, write, and execute. You will see them displayed like this:

1
2
-rw-r--r--  1 user group  1024 Mar 11 14:30 file.txt
drwxr-xr-x 2 user group 4096 Mar 11 14:31 directory/

The first character indicates type (- for file, d for directory). The next nine characters are three sets of three: owner, group, and others. r is read, w is write, x is execute. A dash means the permission is absent. So rw-r--r-- means the owner can read and write, the group can read, and others can read.

Change permissions with chmod:

1
2
3
chmod +x script.sh       # make executable for everyone
chmod 600 id_rsa # owner read/write only (for SSH keys)
chmod 755 deploy.sh # owner: rwx, group/others: r-x

The numeric mode takes practice to internalize, but the pattern is consistent: read=4, write=2, execute=1. Add them to get the permission set. 7 = 4+2+1 = read+write+execute. 6 = 4+2 = read+write. 5 = 4+1 = read+execute.

Process Management

When a program is running, it occupies your terminal. When it hangs or you need to stop it, you need process management:

  • Ctrl+C sends an interrupt signal, politely asking the program to stop. Most programs respond to this.
  • Ctrl+Z suspends the program and returns you to the shell. The program is paused, not terminated.
  • fg brings the most recently suspended program back to the foreground.
  • bg resumes a suspended program in the background, freeing your terminal.
  • Add & after any command to run it in the background from the start.
1
2
3
4
ps aux | grep node       # find Node.js processes
kill 12345 # terminate process 12345
kill -9 12345 # force-kill a stubborn process
pkill -f "node server" # kill by name instead of PID

Use kill -9 as a last resort. It does not give the process a chance to clean up — open files, database connections, and temporary data may be left in an inconsistent state. Try kill without flags first.

The Real Value

The command line rewards spending ten minutes to learn something that saves ten seconds every time you use it. Multiplied across a career, the return on that ten minutes is enormous. Start with navigation and file operations. Add grep and pipes when you are comfortable. The rest comes with necessity — each time you find yourself doing something repetitive, ask if there is a command-line way to do it faster. There almost always is.


Linux Command Line – Essential Skills Every Developer Should Have
https://toongs.org/2026/04/14/10-linux-commands/
Author
Jain Chen
Posted on
April 14, 2026
Licensed under