๐Ÿ“– L4 of 5 ยท M0โฑ 5 min

Editing config files

Most Tailscale-adjacent projects ask you to edit a file. You don't need a fancy editor โ€” there are exactly three options that all work.

1The three editors that always work

Option A: VS Code. If you have it installed, run code path/to/file and it opens in a window you already know. This is the easiest path.

Option B: nano. Built into every Linux/macOS terminal. Run nano filename. Edits look like a regular text editor. Save with Ctrl + O, exit with Ctrl + X. The keys are listed at the bottom of the screen, so you don't have to remember them.

Option C: vim or emacs. Built-in too, more powerful, steeper learning curve. Skip these for this course unless you already know one.

Recommendation: use VS Code if installed, nano otherwise. You don't need to learn vim to learn Tailscale.

2Walking through nano

Open a test file:

nano hello.txt

You're now in nano. Type some text. The bottom of the screen shows shortcuts โ€” ^O means Ctrl + O:

  • Ctrl + O โ€” write out (save). Hit Enter to confirm the filename.
  • Ctrl + X โ€” exit.
  • Ctrl + W โ€” search for text.
  • Ctrl + K โ€” cut current line.

That's enough for any config edit.

3Editing system files

Some config files are owned by root (system files). Editing them needs sudo:

sudo nano /etc/hosts

Same nano interface โ€” but sudo lets you save changes back. Without it, nano lets you read but not write.

4Just looking

To peek at a file without editing, use cat (it just dumps the file to your terminal):

cat hello.txt

For long files, use less instead โ€” paginated. Space to scroll, q to quit:

less /var/log/system.log
Deep-path detail: head -n 20 file shows the first 20 lines, tail -n 20 file the last 20. tail -f file "follows" โ€” keeps showing new lines as they're written. Useful when watching a service's log live.

5Try it

nano test.txt
# Type something. Save with Ctrl+O, Enter. Exit with Ctrl+X.
cat test.txt
# Should print what you just typed.
rm test.txt
# Delete the file.

That's the entire toolkit for "edit a config file" anywhere in this course.

๐Ÿง Knowledge check

Three quick questions

Pick an answer to see why.

Q1.You're in nano and want to save your changes. Which keys?
Q2.You try to edit /etc/hosts and nano won't let you save. Why?
Q3.You want to glance at a long log file without opening an editor. What's the right tool?
3 / 3
Last terminal lesson is a wrap-up.