Essential Linux command line basics for developers - Rocketeers app

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com/login) 

 On this page

 Knowledge
---------

Essential Linux command line basics for developers
==================================================

### [\#CommandLine](https://rocketeersapp.com/knowledge/command-line)

A practical primer on Linux command line basics: navigating, working with files, pipes and redirection, permissions, and where to go next.

 Published by [Mark van Eijk](https://rocketeersapp.com/author/mark-van-eijk) on June 23, 2026 · 2 minute read

1. [Why the command line is worth it](#content-why-the-command-line-is-worth-it)
2. [Knowing where you are and moving around](#content-knowing-where-you-are-and-moving-around)
3. [Working with files and directories](#content-working-with-files-and-directories)
4. [Pipes and redirection](#content-pipes-and-redirection)
5. [A quick word on permissions](#content-a-quick-word-on-permissions)
6. [Where to go next](#content-where-to-go-next)

[\#](#content-why-the-command-line-is-worth-it "Permalink")Why the command line is worth it
-------------------------------------------------------------------------------------------

If you write code or touch a server, the terminal is unavoidable, and honestly that's a good thing. It's faster than clicking, it's scriptable, and it's the same on your laptop and on a remote box. This is the set of commands I'd hand a new developer to get comfortable. Everything here works on Ubuntu and macOS alike.

[\#](#content-knowing-where-you-are-and-moving-around "Permalink")Knowing where you are and moving around
---------------------------------------------------------------------------------------------------------

The terminal always has a "current directory". Three commands cover navigation:

 ```
pwd        # print working directory: where am I right now?
ls         # list files in the current directory
cd /var/www  # change directory

```

`ls` becomes much more useful with flags:

 ```
ls -l      # long format: permissions, owner, size, date
ls -la     # also show hidden files (the ones starting with a dot)
ls -lh     # human-readable sizes (KB, MB instead of bytes)

```

A few `cd` shortcuts save constant typing: `cd ~` goes home, `cd ..` goes up one level, and `cd -` jumps back to the previous directory.

[\#](#content-working-with-files-and-directories "Permalink")Working with files and directories
-----------------------------------------------------------------------------------------------

The everyday file commands:

 ```
mkdir project          # make a directory
touch project/app.js   # create an empty file (or update its timestamp)
cp app.js app.bak.js   # copy a file
mv app.bak.js backup/  # move or rename a file
rm app.bak.js          # remove a file

```

Be careful with `rm`. There is no recycle bin. To delete a directory and everything in it you need `rm -r directory`, and that's exactly the command people regret. Double-check the path before you hit Enter.

To read files without opening an editor:

 ```
cat app.js     # dump the whole file to the screen
less app.js    # scroll through a long file (q to quit)
head -n 20 app.js   # first 20 lines
tail -n 20 app.js   # last 20 lines
tail -f app.log     # follow a log file live

```

[\#](#content-pipes-and-redirection "Permalink")Pipes and redirection
---------------------------------------------------------------------

This is where the command line gets powerful. The pipe `|` sends one command's output into another command's input:

 ```
ls -l | less          # page through a long listing
cat app.log | grep ERROR   # show only lines containing ERROR

```

Redirection sends output to a file instead of the screen:

 ```
echo "hello" > notes.txt    # write to a file (OVERWRITES it)
echo "more" >> notes.txt    # append to a file (keeps existing content)

```

The difference between `>` and `>>` matters: a single `>` wipes the file first. Get them mixed up and you'll lose the contents of a file you meant to add to.

[\#](#content-a-quick-word-on-permissions "Permalink")A quick word on permissions
---------------------------------------------------------------------------------

Run `ls -l` and you'll see strings like `-rwxr-xr--` at the start of each line. Those are permissions: read (`r`), write (`w`), and execute (`x`), shown for the owner, the group, and everyone else. When a script "won't run" or you get a "permission denied", this is usually why. The full story, including `chmod` and the numbers like `755`, is in the [change file permissions with chmod guide](/change-file-permissions-chmod-linux).

[\#](#content-where-to-go-next "Permalink")Where to go next
-----------------------------------------------------------

These basics get you around, but the real productivity comes from a handful of focused tools:

- Finding files by name or type: [find files on the Linux command line](/find-files-linux-command).
- Searching inside files for text: [search files with grep](/search-files-grep-command).
- Bundling and compressing directories: [create and extract tar archives](/create-extract-tar-archives-linux).
- Working on a remote machine: [connect to a server with SSH](/connect-to-server-ssh-command).

Pick one command, use it for real on something you're actually doing, and it sticks. That beats memorizing a cheat sheet every time.

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#CommandLine](https://rocketeersapp.com/knowledge/command-line)

- [Argument list too long (Bash: /bin/rm)](https://rocketeersapp.com/knowledge/argument-list-too-long)
- [How to install Composer packages locally](https://rocketeersapp.com/knowledge/install-composer-packages-locally)
- [How to send GET and POST requests with curl](https://rocketeersapp.com/knowledge/curl-post-get-api-requests)
- [How to search file contents with grep](https://rocketeersapp.com/knowledge/search-files-grep-command)
- [The complete guide to the curl command](https://rocketeersapp.com/knowledge/curl-command-complete-guide)
- [Getting started with the AWS CLI](https://rocketeersapp.com/knowledge/getting-started-aws-cli)

 [View all 21 articles →](https://rocketeersapp.com/knowledge/command-line)
