Khush Shah

Command Line Basics: A Task-Based Guide

Khush Shah 15 min read Tools, Tutorials

Most of my work, from training a model to building this blog, starts in a terminal, and a small set of commands covers nearly everything I do there: look around, create and move files, find things, and chain commands together. This post groups those commands by the job you want done, gives the flags I actually use and the traps that have caught me, and shows the real output of the examples, so you can paste the commands into an empty directory and check that you get the same. It sticks to the basics; the references at the end go further.

What I tested on

I ran every command that is shown with its output on macOS 27.2.1 (Apple silicon), in zsh, with the BSD versions of the tools that come with macOS, inside a fresh directory made by mktemp -d, in November 2026. Linux distributions such as Ubuntu use the GNU versions (coreutils, findutils, grep, sed). The everyday commands are the same, but some flags, messages and output formats differ; I point these out as I go, and the last section collects them. tree and bat are not installed on this Mac, so their sections keep the screenshots from my original 2023 run on Ubuntu, man and less take over the screen and tail -f never finishes, so there is no output to paste for them, and tldr is not installed here either.

In the code blocks, a line that starts with $ is a command (type what follows the $) and the lines below it are its output. In ls -l output I have replaced my user name with user.

When you are stuck: man, --help and tldr

Before searching the web, ask the machine. man ls opens the manual page for ls: press Space for the next page, type / and a word to search, and q to quit. It is long, but it describes the exact version installed on your machine, which matters because the macOS and Linux versions differ. On Linux, every GNU tool also prints a one-screen summary of its options with --help (for example ls --help); most macOS tools do not understand --help and print only a one-line usage summary, as below. For worked examples rather than a full reference, tldr ls prints a handful of common uses from the community-written tldr pages. It is a separate program you install first; it is not installed on the Mac I tested on, so I have not run it here.

$ ls --help
ls: unrecognized option `--help'
usage: ls [-@ABCFGHILOPRSTUWXabcdefghiklmnopqrstuvwxy1%,] [--color=when] [-D format] [file ...]

Set up a playground

To follow along without touching your own files, make an empty throwaway directory and move into it. mktemp -d creates a new directory with a random name in the system's temporary area and prints its path (under /var/folders on macOS, /tmp on Linux), and $( ) hands that path to cd. Then create a few files to play with: printf prints text, turning each \n into a new line, seq 1 1000 prints the numbers 1 to 1000, one per line, and > sends the output into a file instead of the screen (more on that below). mkdir makes a directory.

$ cd "$(mktemp -d)"
$ printf 'This is a demo file.\nIt is for practising command-line tools.\n\n\nThe two lines above this one are empty.\n' > demo.txt
$ printf 'a = 5\nb = 10\n\nprint(f"Sum of {a} and {b} is {a + b}.")\n' > demo.py
$ seq 1 1000 > numbers.txt
$ mkdir someDir

Installing tools

Two of the tools in this post, tree and bat, do not come with the system, so install them first if you want to try them. On Debian or Ubuntu:

$ sudo apt install bat tree

On macOS, with Homebrew:

$ brew install bat tree

Check them with tree --version and bat --version. On older Debian and Ubuntu releases the bat package installs the command as batcat instead of bat, because another package already used the name bat. If bat --version does not work after installing, try batcat --version, and add the line alias bat=batcat to your shell profile (~/.bashrc for bash, ~/.zshrc for zsh) so that bat works too. Homebrew installs it as bat. Neither tool is installed on the Mac I tested on, and I did not install them for this post, so there is no output to show here.

Look around

Where am I: pwd

pwd prints the working directory, the directory your commands run in.

$ pwd
/var/folders/mh/50m1dp452td8xxwjjt2k4jhr0000gn/T/tmp.A4H2Dku6vy

What is here: ls

ls lists what is in a directory (the current one if you do not name one). The flags I use most:

  • ls -l: long listing, one entry per line with its permissions, owner, size in bytes and modification time (the columns are explained under Permissions).
  • ls -a: include hidden entries, whose names start with a dot. . is the directory itself and .. its parent.
  • ls -lh: sizes with units, such as 3.8K instead of 3893. -h only has an effect together with -l (or -s), so on its own it changes nothing.
  • ls -t: sort by modification time, newest first.
  • ls -1: one entry per line. This is also what ls does when its output goes into a pipe or a file rather than the screen.

Flags can be combined, so ls -lt is a long listing with the newest entry first.

$ ls
demo.py         demo.txt        numbers.txt     someDir
$ ls -1
demo.py
demo.txt
numbers.txt
someDir
$ ls -a
.               demo.py         numbers.txt
..              demo.txt        someDir
$ ls -l
total 24
-rw-r--r--  1 user  staff    55 Nov 15 08:13 demo.py
-rw-r--r--  1 user  staff   104 Nov 15 08:13 demo.txt
-rw-r--r--  1 user  staff  3893 Nov 15 08:13 numbers.txt
drwxr-xr-x  2 user  staff    64 Nov 15 08:13 someDir
$ ls -lh
total 24
-rw-r--r--  1 user  staff    55B Nov 15 08:13 demo.py
-rw-r--r--  1 user  staff   104B Nov 15 08:13 demo.txt
-rw-r--r--  1 user  staff   3.8K Nov 15 08:13 numbers.txt
drwxr-xr-x  2 user  staff    64B Nov 15 08:13 someDir
$ ls -t
someDir         numbers.txt     demo.py         demo.txt
$ ls -lt
total 24
drwxr-xr-x  2 user  staff    64 Nov 15 08:13 someDir
-rw-r--r--  1 user  staff  3893 Nov 15 08:13 numbers.txt
-rw-r--r--  1 user  staff    55 Nov 15 08:13 demo.py
-rw-r--r--  1 user  staff   104 Nov 15 08:13 demo.txt

On Linux, Ubuntu's default shell setup colours the output of ls (it makes ls an alias for ls --color=auto). On macOS, add -G or put export CLICOLOR=1 in ~/.zshrc. Do not carry -G over to Linux: there it means "leave out the group column".

The shape of a directory: tree

tree draws a directory and everything under it as a tree. It is not installed by default (see Installing tools). It is not installed on the Mac I tested on, so the screenshot below is from my original run on Ubuntu, on a directory holding demo.py, demo.txt and someDir/demo.txt. Useful flags:

  • tree -a: include hidden files and directories.
  • tree -d: directories only.
  • tree -L 2: go at most 2 levels deep.
  • tree -f: print the full path of each entry.
  • tree -i: leave out the indentation lines (useful with -f).
  • tree -v: sort by version.
  • tree -t: sort by last modification time.
  • tree -h: print the size of each entry in a human-readable format.
  • tree -Q: put each name in double quotes.

Terminal on Ubuntu showing the output of tree, tree -d, tree -L 1, tree -f, tree -Q and tree -h on a directory that holds demo.py, demo.txt and someDir/demo.txt

Move around: cd

cd <directory> changes the working directory. cd .. goes up to the parent, cd on its own goes to your home directory, and cd - goes back to the directory you were in before and prints its path.

$ cd someDir
$ pwd
/var/folders/mh/50m1dp452td8xxwjjt2k4jhr0000gn/T/tmp.A4H2Dku6vy/someDir
$ cd ..
$ pwd
/var/folders/mh/50m1dp452td8xxwjjt2k4jhr0000gn/T/tmp.A4H2Dku6vy
$ cd
$ cd -
/var/folders/mh/50m1dp452td8xxwjjt2k4jhr0000gn/T/tmp.A4H2Dku6vy

Create and edit

Directories: mkdir

mkdir <name> creates a directory. mkdir -p also creates any missing parent directories along the way, and does not complain if the directory already exists. mkdir -v prints each directory it creates.

$ mkdir projects/blog
mkdir: projects: No such file or directory
$ mkdir -pv projects/blog
projects
projects/blog
$ mkdir -p projects/blog
$ mkdir -v emptyDir
emptyDir

On Linux, the messages are longer: mkdir -v prints mkdir: created directory 'projects'.

Timestamps and empty files: touch

touch <file> updates a file's modification time to now; if the file does not exist, it creates an empty one. Below, touch demo.txt moves demo.txt to the top of the newest-first listing without changing what is in it, and touch todo.md creates an empty file (size 0).

$ ls -1t
emptyDir
projects
someDir
numbers.txt
demo.py
demo.txt
$ touch demo.txt
$ ls -1t
demo.txt
emptyDir
projects
someDir
numbers.txt
demo.py
$ touch todo.md
$ ls -l todo.md
-rw-r--r--  1 user  staff  0 Nov 15 08:13 todo.md

echo prints its arguments. Add > and a file name to send the text into that file instead of the screen: the file is created if needed, and anything it held before is replaced, without a warning. >> adds the text to the end of the file instead.

$ echo "This is the echo command."
This is the echo command.
$ echo "This is a new file." > newFile.txt
$ cat newFile.txt
This is a new file.
$ echo "This replaces the old text." > newFile.txt
$ cat newFile.txt
This replaces the old text.
$ echo "This line is appended." >> newFile.txt
$ cat newFile.txt
This replaces the old text.
This line is appended.

Read files: cat

cat (short for concatenate) reads the files you name, in order, and writes them to the screen. Flags:

  • cat -n: number all output lines.
  • cat -b: number only the non-empty lines.
  • cat -s: squeeze runs of empty lines into one.
$ cat demo.txt
This is a demo file.
It is for practising command-line tools.


The two lines above this one are empty.
$ cat -n demo.txt
     1  This is a demo file.
     2  It is for practising command-line tools.
     3  
     4  
     5  The two lines above this one are empty.
$ cat -b demo.txt
     1  This is a demo file.
     2  It is for practising command-line tools.


     3  The two lines above this one are empty.
$ cat -s demo.txt
This is a demo file.
It is for practising command-line tools.

The two lines above this one are empty.
$ cat demo.py newFile.txt
a = 5
b = 10

print(f"Sum of {a} and {b} is {a + b}.")
This replaces the old text.
This line is appended.

cat with colours: bat

bat is a cat clone that adds syntax highlighting, line numbers and Git integration (it marks lines changed since the last commit). It is not installed by default, and on older Debian and Ubuntu releases the command is called batcat; Installing tools covers both. Use it like cat, for example bat demo.py. bat is not installed on the Mac I tested on, so I have not run these commands here; the screenshot is from my original run on Ubuntu, where the command was batcat.

Terminal on Ubuntu showing batcat demo.txt and batcat demo.py: each file in a bordered panel with its name at the top and line numbers on the left, with the Python code syntax-highlighted

Copy, move and delete

Copy: cp

cp <source> <destination> copies a file. If the destination is an existing directory, the copy goes inside it under the same name. By default cp overwrites an existing file without asking. Flags:

  • cp -R: copy a directory and everything in it. cp -r does the same on Linux, and macOS accepts it too, but its man page discourages -r in favour of -R.
  • cp -i: ask before overwriting an existing file.
  • cp -n: never overwrite an existing file.
  • cp -f: force: if an existing destination file cannot be opened for writing, remove it and copy again. On macOS, -f also cancels an earlier -i or -n.
  • cp -v: print each file as it is copied.
$ cp demo.txt someDir/
$ ls someDir
demo.txt
$ cp -v demo.txt demo-copy.txt
demo.txt -> demo-copy.txt
$ cp -i demo.txt someDir/
overwrite someDir/demo.txt? (y/n [n]) n
not overwritten
$ cp someDir backup
cp: someDir is a directory (not copied).
$ cp -R someDir backup
$ ls backup
demo.txt

On Linux, the wording differs (cp -i asks cp: overwrite 'someDir/demo.txt'?, and copying a directory without -R says cp: -r not specified; omitting directory 'someDir'), but the behaviour is the same.

Move and rename: mv

mv <source> <destination> moves a file or directory; when the destination is a new name rather than an existing directory, that is a rename. mv moves a directory as it is, with everything inside it, so it has no -r option. Like cp, it overwrites an existing file without asking, except that it asks when the existing file is write-protected and you are working in a terminal. Flags:

  • mv -i: ask before overwriting an existing file.
  • mv -n: never overwrite an existing file.
  • mv -f: force: never ask before overwriting, even when the existing file is write-protected. Of -i, -n and -f, the last one given wins.
  • mv -v: print each file as it is moved.
$ mv demo-copy.txt old-demo.txt
$ mv -v old-demo.txt someDir/
old-demo.txt -> someDir/old-demo.txt
$ ls someDir
demo.txt        old-demo.txt
$ mv backup archive
$ ls
archive         demo.txt        newFile.txt     projects        todo.md
demo.py         emptyDir        numbers.txt     someDir
$ mv -i demo.txt someDir/
overwrite someDir/demo.txt? (y/n [n]) n
not overwritten

Delete: rm

rm <file> deletes a file. There is no bin and no undo. Flags:

  • rm -i: ask before each removal.
  • rm -v: print each file as it is removed.
  • rm -f: force: never ask, and say nothing about files that do not exist.
  • rm -d: remove empty directories as well as files.
  • rm -r (the same as -R): remove directories and everything in them.
  • rm -rf: the two together: remove a directory and everything in it, without asking.
$ rm -i someDir/old-demo.txt
remove someDir/old-demo.txt? y
$ rm missing.txt
rm: missing.txt: No such file or directory
$ rm -f missing.txt
$ rm emptyDir
rm: emptyDir: is a directory
$ rm -d emptyDir
$ ls archive
demo.txt
$ rm -rv archive
archive/demo.txt
archive

On Linux, rm -v prints removed 'archive/demo.txt' rather than just the name.

Before you run rm -rf

rm -rf deletes a directory and everything in it without asking, and there is no undo: the files do not go to a bin.

  • Run ls on exactly the path you are about to delete, and read what it prints, before you delete it.
  • Never build the path from a variable that might be empty. If DIR is empty, rm -rf "$DIR/" becomes rm -rf /. Write "${DIR:?}" instead: the shell then stops with an error, before rm runs, when DIR is empty or unset.
  • Putting echo in front of a command prints what would run without running it, which is how I tested the line above:
$ DIR=""
$ echo rm -rf "$DIR/"
rm -rf /
$ echo rm -rf "${DIR:?}/"
zsh: DIR: parameter not set

In bash the message reads bash: DIR: parameter null or not set.

Find things

By name or type: find

find <where> <tests> walks down a directory tree and prints every path that passes the tests. Always give the starting directory (. is the current one) and put patterns in quotes:

  • find . -name "pattern": names matching the pattern, where * matches any run of characters, as in "*.txt".
  • find . -iname "pattern": the same, ignoring upper and lower case.
  • find . -type f or find . -type d: regular files only, or directories only.
  • find . -empty: empty files and directories.
$ find . -name "demo.txt"
./demo.txt
./someDir/demo.txt
$ find . -name "*.txt"
./numbers.txt
./demo.txt
./newFile.txt
./someDir/demo.txt
$ find . -iname "DEMO.PY"
./demo.py
$ find . -type d
.
./projects
./projects/blog
./someDir
$ find . -empty
./projects/blog
./todo.md

find lists entries in the order the file system returns them, which is not necessarily alphabetical. Now the two traps. Without a starting directory, GNU find on Linux assumes ., but macOS's find stops with an error. Without quotes, the shell expands *.txt into the names of the matching files in the current directory before find runs, so find receives something else: here, three file names and an error; with exactly one matching file it would quietly search for that one name instead.

$ find -name "demo.txt"
find: illegal option -- n
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
$ find . -name *.txt
find: newFile.txt: unknown primary or operator

By content: grep

grep "text" <files> prints the lines that contain the text. Flags:

  • grep -n: show line numbers.
  • grep -i: ignore upper and lower case.
  • grep -r "text" .: search every file under a directory (give the directory, as with find).
  • grep -l: print only the names of the files that match.
  • grep -v: print the lines that do not match.

The text is a regular expression, so characters such as . and * have special meanings; grep -F treats it as plain text. Note that line also matches inside command-line and lines, and that without -i the search is case-sensitive, so grep -v "This" keeps the last line, whose this is lower case.

$ grep "demo" demo.txt
This is a demo file.
$ grep -n "line" demo.txt
2:It is for practising command-line tools.
5:The two lines above this one are empty.
$ grep -i "THIS" demo.txt
This is a demo file.
The two lines above this one are empty.
$ grep -rn "print" .
./demo.py:4:print(f"Sum of {a} and {b} is {a + b}.")
$ grep -rl "demo" .
./demo.txt
./someDir/demo.txt
$ grep -v "This" demo.txt
It is for practising command-line tools.


The two lines above this one are empty.

Combine commands

A pipe, |, sends the output of one command into the next one. > sends output into a file (replacing what was there) and >> adds to the end of it, as in the echo section. Error messages travel on a separate stream, standard error, which > does not capture; 2>&1 sends them to the same place as the normal output. Three examples:

  1. ls | wc -l counts the entries in a directory: ls prints one name per line into the pipe, and wc -l counts lines.
  2. ls -t | head -n 3 shows the three most recently modified entries.
  3. > listing.txt alone leaves the error on the screen; adding 2>&1 puts it in the file too. The order matters: 2>&1 goes after > listing.txt.
$ ls | wc -l
       7
$ ls -t | head -n 3
someDir
newFile.txt
todo.md
$ ls demo.txt missing.txt > listing.txt
ls: missing.txt: No such file or directory
$ cat listing.txt
demo.txt
$ ls demo.txt missing.txt > listing.txt 2>&1
$ cat listing.txt
ls: missing.txt: No such file or directory
demo.txt

On Linux, wc pads its numbers less: ls | wc -l prints just 7.

Read long output

less <file>, or <command> | less, shows text one screen at a time: Space for the next page, b to go back, / and a word to search, and q to quit. For a quick look, head shows the first lines of a file (10 unless you give -n), tail the last ones, and wc counts lines, words and bytes (wc -l only lines). tail -f <file> keeps printing new lines as they are added to a file, which is how I watch a training log; press Ctrl+C to stop it.

$ head -n 3 numbers.txt
1
2
3
$ tail -n 3 numbers.txt
998
999
1000
$ head -n 500 numbers.txt | tail -n 1
500
$ wc demo.txt
       5      19     104 demo.txt
$ wc -l numbers.txt
    1000 numbers.txt

Permissions

Reading ls -l

$ ls -l demo.py
-rw-r--r--  1 user  staff  55 Nov 15 08:13 demo.py
Column Here Meaning
Type and permissions -rw-r--r-- The first character is the type (- file, d directory, l symbolic link). Then three groups of three: what the owner, the group and everyone else may do. r is read, w write and x execute (for a directory, x means you may go into it); - means not allowed.
Links 1 The number of hard links to the file.
Owner user The user who owns the file.
Group staff The group the file belongs to.
Size 55 Size in bytes.
Modified Nov 15 08:13 Last modification time (older files show the year instead of the time).
Name demo.py The file name.

In a listing of a whole directory, the first line, total, is the disk space the entries use, counted in blocks.

Change permissions: chmod

chmod changes the permissions. The symbolic form says who (u owner, g group, o others, a all), + or -, and what (r, w, x): chmod u+x hello.sh lets the owner run the file. The numeric form gives one digit per group, adding 4 for read, 2 for write and 1 for execute: 644 is rw-r--r-- (the usual for a file) and 755 is rwxr-xr-x (the usual for a script or a directory). A script will not run until it is executable:

$ printf '#!/bin/sh\necho "Hello from a script."\n' > hello.sh
$ ls -l hello.sh
-rw-r--r--  1 user  staff  38 Nov 15 08:13 hello.sh
$ ./hello.sh
zsh: permission denied: ./hello.sh
$ chmod u+x hello.sh
$ ls -l hello.sh
-rwxr--r--  1 user  staff  38 Nov 15 08:13 hello.sh
$ ./hello.sh
Hello from a script.
$ chmod 644 hello.sh
$ ls -l hello.sh
-rw-r--r--  1 user  staff  38 Nov 15 08:13 hello.sh

On Linux with bash, the error reads bash: ./hello.sh: Permission denied.

macOS and Linux differences

Task macOS (BSD tools) Linux (GNU tools)
find without a starting directory Error: find: illegal option -- n Assumes .
Colour in ls ls -G, or export CLICOLOR=1 ls --color=auto (Ubuntu sets this up as an alias); -G hides the group column
Help man <command>; most tools reject --help man <command> or <command> --help
Edit a file in place with sed sed -i '' 's/old/new/' file sed -i 's/old/new/' file
Edit in place, keeping a backup sed -i.bak 's/old/new/' file the same
A file's size with stat stat -f '%z' file stat -c '%s' file
-v messages, prompts, errors Short: mkdir -v prints projects Longer: mkdir: created directory 'projects'
wc output Numbers padded to a fixed width Padded only as much as needed

sed, the stream editor, edits text line by line; s/old/new/ replaces the first match on each line. GNU sed -i takes an optional backup suffix, which must be attached (-i.bak). macOS's sed -i requires a suffix, attached or as the next argument ('' for no backup), so the Linux spelling fails on a Mac, and in an unexpected way: sed took s/colour/color/ as the backup suffix and word.txt as the script, read that as the w command ("write to the file ord.txt"), created an empty ord.txt, and then stopped because no file name was left to edit in place. sed -i.bak, with the suffix attached, works on both and keeps the original as word.txt.bak. stat prints details about a file; the format flag and the codes inside it differ (-f '%z' on macOS, -c '%s' on Linux, both the size in bytes).

$ echo "colour" > word.txt
$ sed -i 's/colour/color/' word.txt
sed: -I or -i may not be used with stdin
$ ls -l ord.txt
-rw-r--r--  1 user  staff  0 Nov 15 08:13 ord.txt
$ rm ord.txt
$ sed -i '' 's/colour/color/' word.txt
$ cat word.txt
color
$ sed -i.bak 's/color/colour/' word.txt
$ cat word.txt
colour
$ ls word.txt*
word.txt        word.txt.bak
$ stat -f '%z bytes: %N' demo.py
55 bytes: demo.py

A worked exercise

Put the pieces together: in a fresh throwaway directory, create a project directory with a docs subdirectory, create three files, copy one of them into docs, find every Markdown (.md) file, count the lines in each, and then delete the project safely. find . -name "*.md" -exec wc -l {} + runs wc -l once on all the paths find found, with {} standing for them. To delete safely: step out of the directory first, list exactly what is about to go, delete it with rm -r (no -f, so rm would still ask about anything write-protected), and check that it has gone. The last ls prints nothing because the throwaway directory is empty again.

$ cd "$(mktemp -d)"
$ mkdir -p my-project/docs
$ cd my-project
$ echo "# My project" > README.md
$ printf 'First note\nSecond note\nThird note\n' > notes.md
$ touch todo.txt
$ ls
docs            notes.md        README.md       todo.txt
$ cp notes.md docs/
$ find . -name "*.md"
./docs/notes.md
./README.md
./notes.md
$ find . -name "*.md" -exec wc -l {} +
       3 ./docs/notes.md
       1 ./README.md
       3 ./notes.md
       7 total
$ cd ..
$ ls -R my-project
docs            notes.md        README.md       todo.txt

my-project/docs:
notes.md
$ rm -r my-project
$ ls

On Linux, find may list the files in another order, and wc pads its numbers less.

Cheat sheet

Command What it does Flags worth knowing
man, --help, tldr Show help for a command man ls; ls --help (Linux); tldr ls (install first)
pwd Print the working directory
ls List a directory -l, -a, -lh, -t, -1
tree Draw a directory as a tree (install first) -a, -d, -L 2, -f
cd Change directory cd .., cd (home), cd - (back)
mkdir Create a directory -p, -v
touch Update a file's timestamp; create an empty file
echo Print text > file (replace), >> file (append)
cat Print files -n, -b, -s
bat cat with syntax highlighting (install first; batcat on older Ubuntu)
cp Copy -R, -i, -n, -v
mv Move or rename -i, -n, -v
rm Delete, with no undo -i, -v, -r, -d, -f
find Find files by name or type find . -name "*.md", -iname, -type f, -type d, -empty
grep Find lines by content -n, -i, -r, -l, -v, -F
|, >, >>, 2>&1 Pipe, redirect, append, redirect errors too
less Page through long text Space, b, /, q
head, tail First or last lines -n 20, tail -f
wc Count lines, words and bytes -l
chmod Change permissions u+x, 644, 755

Takeaways

  • Give find (and grep -r) a starting directory and quote the pattern: find . -name "*.md". macOS's find fails without the ., and the shell expands an unquoted *.md before find ever sees it.
  • rm, >, cp and mv delete or overwrite without asking and without an undo. Check the path with ls first, use -i when unsure, and guard any variable in a path with "${DIR:?}".
  • macOS ships BSD tools and Linux the GNU ones: the everyday commands match, but flags such as ls -G, sed -i and stat -f/-c differ, so check man on the machine you are actually using.

References

  1. GNU Project, GNU Coreutils manual (ls, cp, mv, rm, mkdir, touch, cat, head, tail, wc, chmod, stat).
  2. Linux man pages on man7.org: find(1) and ls(1).
  3. GNU Project, GNU grep manual and GNU sed manual (the -i option).
  4. William Shotts, The Linux Command Line, a book that is free to download.
  5. The macOS manual pages (man ls, man find, man cp, man sed, man stat) on macOS 27.2.1. macOS's tools come from FreeBSD, whose manual pages are close relatives.
  6. bat (its README covers the batcat name), tree and the tldr pages.