# Top terminal commands every developer should know (part 1)

> Fourteen navigation, file, and search commands on a safe /tmp demo tree, with GNU versus BSD flag traps.

Source: https://fullbytedeveloper.com/blog/essential-linux-commands-developers-part-1
Published here: 2026-11-16, updated 2026-12-03

Fourteen everyday commands cover move, look, read, change, and search: `pwd`, `cd`, `ls`; `cat`, `less`, `head`, `tail`; `mkdir`, `touch`, `cp`, `mv`, `rm`; `find` and `grep` (or `rg`). This Part 1 runs them on a throwaway `/tmp` tree and flags GNU versus BSD traps. Part 2 covers [processes, pipes, and jobs](/blog/essential-linux-commands-developers-part-2).

## Quick start: build a safe demo tree under /tmp

Work under `/tmp/blog-demo` (or `$HOME/tmp/blog-demo`). Never demo recursive deletes of your home directory. The examples use the GNU versions documented in the GNU coreutils manual [1]; macOS ships BSD versions of `ls`, `find`, and `grep`, so the flag traps below matter.

```bash
rm -rf /tmp/blog-demo
mkdir -p /tmp/blog-demo/{src,docs,.hidden}
cd /tmp/blog-demo
echo 'hello' > README.md
echo 'print(1)' > src/app.py
echo 'findme-unique-token' > src/needle.txt
echo 'note' > docs/note.txt
printf 'secret\n' > .hidden/key.txt
ls -la
```

Captured on this host (inode and timestamp columns vary):

```text
total 32
drwxr-xr-x 5 ubuntu ubuntu 4096 Dec 3 12:51 .
drwxrwxrwt  74 root   root  12288 Dec 3 12:51 ..
drwxr-xr-x 2 ubuntu ubuntu 4096 Dec 3 12:51 docs
drwxr-xr-x 2 ubuntu ubuntu 4096 Dec 3 12:51 .hidden
-rw-r--r-- 1 ubuntu ubuntu    6 Dec 3 12:51 README.md
drwxr-xr-x 2 ubuntu ubuntu 4096 Dec 3 12:51 src
```

You should see six entries: `.`, `..`, `.hidden`, `README.md`, `docs`, and `src`.

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 280" role="img" aria-label="Tree under slash tmp slash blog-demo: README.md at the root, then three folders for src with app.py and needle.txt, docs with note.txt, and a highlighted .hidden folder with key.txt, plus a footer on pwd cd ls find grep and GNU versus BSD man checks.">
  <defs>
    <marker id="arrowLinuxDemo" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="280" rx="12" fill="#0b1f3a"/>
  <text x="24" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">/tmp/blog-demo</text>
  <rect x="280" y="20" width="160" height="44" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="300" y="48" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">README.md</text>
  <path d="M360 64 V92" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowLinuxDemo)"/>
  <rect x="40" y="100" width="180" height="72" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="56" y="132" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">src/</text>
  <text x="56" y="156" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">app.py needle.txt</text>
  <rect x="270" y="100" width="180" height="72" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="286" y="132" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">docs/</text>
  <text x="286" y="156" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">note.txt</text>
  <rect x="500" y="100" width="180" height="72" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="516" y="132" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">.hidden/</text>
  <text x="516" y="156" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">key.txt</text>
  <text x="24" y="220" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">pwd cd ls to move; find grep rg to search; keep demos under /tmp</text>
  <text x="24" y="252" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">GNU vs BSD: check man before copying long flags [1][4][7]</text>
</svg>
</figure>

*Demo tree under slash tmp slash blog-demo: README.md, src with app.py and needle.txt, docs with note.txt, and .hidden with key.txt. Use pwd cd ls to move, find and grep to search, and check GNU versus BSD man pages before copying flags.*

## Move around and list

`pwd` prints the working directory. `cd /path` changes it. `cd -` returns to the previous directory. `ls` lists names; `ls -l` is long form; `ls -a` includes dot entries; `ls -la` combines them; `ls -lh` adds human-readable sizes on GNU `ls` [1].

```bash
cd /tmp/blog-demo
pwd
ls -la
cd src
pwd
cd -
```

Captured on this host:

```text
/tmp/blog-demo
/tmp/blog-demo/src
/tmp/blog-demo
```

When a remote box needs SSH host aliases before you `cd` around, see [stop typing the full SSH command every time](/blog/ssh-config).

The same short flag can mean different things. On BSD `ls`, `-G` turns on color [7]; on GNU `ls`, `-G` hides group names in a long listing [4]. Check `man ls` before you copy a flag between a Linux box and a Mac.

## Read files without opening an editor

`cat file` prints the whole file. `less file` pages through it (`q` quits). `head` and `tail` show the start or end. Keep these on the demo files first so you do not dump secrets from real projects into scrollback. For shell history that already holds keys, see [your shell history may contain API keys](/blog/hist-key).

```bash
cd /tmp/blog-demo
cat README.md
head -n 1 src/app.py
tail -n 1 docs/note.txt
```

Captured on this host:

```text
hello
print(1)
note
```

## Create, copy, move, and remove inside the demo

`mkdir`, `touch`, `cp`, `mv`, `rm`, and `rmdir` change the tree. Prefer named paths inside `/tmp/blog-demo`. There is no trash by default. `cp` copies a file; add `-r` for a folder.

```bash
cd /tmp/blog-demo
mkdir scratch
cp README.md scratch/x.md
mv scratch/x.md scratch/y.md
rm scratch/y.md
rmdir scratch
echo removed_ok
```

Captured on this host:

```text
removed_ok
```

If the terminal freezes mid-command, use the exits in [terminal stuck? Do not close the window](/blog/term-stuck) before killing the session.

## Find and search

`find . -name "*.txt"` walks the tree by name. `find . -type f` lists files. Label GNU find features such as `-printf` when you use them [6]; not every BSD `find` has it (OpenBSD's does not [8]), so check `man find` on a Mac first.

```bash
cd /tmp/blog-demo
find . -name "*.txt"
grep -R "findme-unique-token" .
```

Captured on this host:

```text
./src/needle.txt
./docs/note.txt
./.hidden/key.txt
./src/needle.txt:findme-unique-token
```

On GNU grep, `grep -r` follows symlinks only when they are named on the command line; `grep -R` follows all of them [5]. Check `man grep` on your box.

If ripgrep is installed, prefer it for code search [2]:

```bash
cd /tmp/blog-demo
rg -n "findme-unique-token"
```

Captured on this host:

```text
src/needle.txt:1:findme-unique-token
```

ripgrep is not installed by default on every distribution; use `grep -R` when `rg` is missing. For which search tool fits which job, see [CLI tools matched to jobs](/blog/cli-tools-matched-to-jobs).

## Use find when tree is missing

Also know `tree` as an optional viewer, or use `find . -print` when `tree` is missing. Defer pipes, permissions, processes, and package managers to later parts. When you need mode bits and ownership next, see [Linux permissions: chmod and chown](/blog/linux-permissions-chmod-chown). The agent and API glossary posts that share this demo tree idea are [what is an AI agent](/blog/what-is-an-ai-agent) and [what is an API](/blog/what-is-an-api).

## GNU versus BSD traps worth memorizing

Three traps burn hours when someone pastes a Linux snippet onto macOS:

1. `ls --color=auto` is GNU; BSD color is often `ls -G` [4][7].
2. `find -printf` is a GNU extension; portable scripts stick to `-name` and `-type` [6][8].
3. `grep -r` versus `grep -R` symlink behavior differs; read the local man page before recursive searches across trees with links [5].

Install GNU coreutils as `gls` on a Mac when you need GNU long options in scripts you also run on Linux [1]. Prefer portable short flags in shared docs when you can.

## Why PATH matters before you blame the install

If `rg` or `find` "vanishes" after an install, print `command -v`, check PATH order, and only then assume the package failed. Part 1 assumes those names resolve on a normal developer PATH.

A `cd` inside a script does not move your interactive shell unless you source the script. Run `pwd` after the script exits to confirm you never left the parent shell.

## Mistakes that wreck real trees

Running `rm -rf /` or a mistyped path outside `/tmp` while "just practicing." Keep demos under a dedicated throwaway directory.

Copying GNU long options into a BSD man page world without checking [1][7].

`cat`ing production `.env` files into scrollback during a screen share. Use the demo tree first [1].

Shipping scripts that require `rg` on every CI image. Fall back to `grep -R` or install ripgrep explicitly [2].

Using `find . -name *.txt` without quotes so the shell expands the glob before find runs. Quote the pattern: `"*.txt"` [6].

## Depth: a five-minute drill on every new box

Build the same demo tree on the next SSH box you log into and run these commands there before you touch real project paths. Confirm `pwd`, a hidden listing, a `find` name search, and a content search. That five-minute drill surfaces missing tools and BSD flag mismatches before a deploy script fails.

When you edit remote configs in a hurry, pair this page with [vim quick start on a remote box](/blog/vim-quick-start-remote-box). When Part 2 is next, move to pipes and process control instead of inventing more navigation flags here.

## Depth: quoting, globs, and hidden files

Shells expand globs before many commands see them. Quoted "*.txt" stops the shell from expanding the glob before find runs [6]. The same habit helps `grep` patterns that contain spaces or shell metacharacters.

Hidden files (names starting with `.`) stay invisible to plain `ls`. Use `ls -a` or `ls -la` when you need them [1][4]. The demo `.hidden/key.txt` exists to make that muscle memory automatic before someone "loses" a dotenv file that was never missing.

`cp -r` and `rm -r` recurse. Prefer named targets inside the demo tree until the flags feel boring. `mkdir -p` creates parents without erroring when they already exist, which is why the setup script uses it [1].

Tab completion and `cd` with absolute paths reduce typos on unfamiliar hosts. Relative `../` chains are fine once you can read `pwd` without thinking. If an agent shell starts with a minimal PATH, interactive aliases may be invisible; see [CLI tools matched to jobs](/blog/cli-tools-matched-to-jobs) for that failure mode.

Keep a personal cheat sheet short: ten commands you actually type, with the one BSD or GNU flag that burned you last month. Long posters on the wall do not beat a five-minute drill on a new box.

## Depth: what Part 1 deliberately skips

Pipes (`|`), redirection (`>`, `>>`), permissions (`chmod`, `chown`), process control (`ps`, `kill`, jobs), and package managers belong in later parts so this page stays navigable. Jumping ahead without a safe tree is how people delete the wrong path while learning `rm`. Finish the drill here, then open Part 2 for processes and pipes.

Browse the [Dev explainers topic](https://fullbytedeveloper.com/blog/topic/dev-explainers).

Send this to the friend who freezes every time they have to open a terminal.

Image: A tidy tree of dark folder boxes and small file slabs on a navy floor, with a teal path line walking the branches and an amber search beam highlighting a few matching nodes, shown as a clean geometric workspace with no letters, flags, or command names.
https://fullbytedeveloper.com/media/essential-linux-commands-developers-part-1/essential-linux-commands-developers-part-1-venice.webp
Move, list, copy, and search inside a safe throwaway tree before you touch a real repo.

## Sources

1. [GNU coreutils manual, accessed 2026-11-12](https://www.gnu.org/software/coreutils/manual/)
2. [ripgrep repository, accessed 2026-11-12](https://github.com/BurntSushi/ripgrep)
3. [Linux man-pages project, accessed 2026-11-12](https://www.kernel.org/doc/man-pages/)
4. [GNU ls(1) manual page, man7.org, accessed 2026-11-12](https://man7.org/linux/man-pages/man1/ls.1.html)
5. [GNU grep(1) manual page, man7.org, accessed 2026-11-12](https://man7.org/linux/man-pages/man1/grep.1.html)
6. [GNU find(1) manual page, man7.org, accessed 2026-11-12](https://man7.org/linux/man-pages/man1/find.1.html)
7. [FreeBSD ls(1) manual page, accessed 2026-11-12](https://man.freebsd.org/cgi/man.cgi?query=ls&sektion=1)
8. [OpenBSD find(1) manual page, accessed 2026-11-12](https://man.openbsd.org/find.1)
