Essential Linux Commands Every Developer Should Know

Whether you’re building backend applications, deploying services on a server, or working with containers, chances are you’ll encounter Linux. It powers the majority of cloud infrastructure and developer environments, so understanding how to use its command line is a major plus for any developer.

In this post, we’ll go through the Linux commands you’ll use most often — with clear examples and explanations that’ll make you feel at home in the terminal.

📁 File & Directory Management

ls

Lists the contents of a directory.

ls           # List files and directories
ls -l        # Long format with details
ls -a        # Show hidden files (those starting with a dot)

cd [directory]

Changes the current working directory.

cd /var/www      # Move to specific directory
cd ..            # Go up one directory level
cd               # Return to home directory

pwd

Prints the current working directory.

pwd

mkdir [directory]

Creates a new directory.

mkdir new-folder

rmdir [directory]

Removes an empty directory.

rmdir old-folder

📦 Working with Files

touch [file]

Creates a new file or updates the timestamp of an existing file.

touch index.html

cp [source] [destination]

Copies files and folders.

cp file.txt backup.txt
cp -r project/ backup_project/   # Recursive copy for directories

mv [source] [destination]

Moves or renames files and folders.

mv file.txt archive/
mv oldname.txt newname.txt

rm [file]

Deletes files or directories.

rm unwanted.txt
rm -r old_folder/     # Recursive delete
rm -rf temp/          # Force delete without confirmation

📄 Viewing File Content

cat [file]

Displays the contents of a file.

cat readme.md
cat -n readme.md   # Show line numbers

less [file]

Views large files one page at a time.

less server.log

Use Up/Down arrows to scroll. Press q to quit.

grep [pattern] [file]

Searches for specific text in files.

grep 'main' app.js

🔍 Searching & Disk Usage

find [path] -name [filename]

Search for files in a directory hierarchy.

find . -name "*.log"

df -h

Shows disk usage of mounted file systems in human-readable format.

df -h

du -sh [directory]

Displays total size of a directory.

du -sh /var/log

🔐 Permissions & Ownership

chmod [permissions] [file]

Changes file permissions.

chmod 755 script.sh

chown [user]:[group] [file]

Changes the file owner.

chown ubuntu:ubuntu server.conf

⚙️ Process & System Management

ps

Lists running processes.

ps
ps aux        # Detailed list of all processes

top

Interactive real-time process viewer.

top

kill [PID]

Terminates a process by ID.

kill 1234

sudo [command]

Run a command with root (superuser) privileges.

sudo apt update

🧠 Final Thoughts

Linux may seem intimidating at first, but once you’re familiar with the basics, it becomes one of the most powerful tools in your developer toolkit. From managing files to debugging server processes, these essential commands will help you navigate and control your environment with ease.

Learning Linux is an investment that pays off across every stack — whether you’re deploying with Docker, configuring a server, or just building something cool on your local machine.