Lesson 0.8

Hidden files and dotfiles

Artifact: Showing hidden files, recognising a dotfile, and knowing why developers use them

1. The promise

You'll be able to show hidden files on your machine, recognise a dotfile when you see one, and explain in plain words why developers put dots on filenames.

2. The mental model

Hidden files are not secret. They're just files the OS chose not to show in the default view so you don't have to look at all the housekeeping.

If every config file showed up in your home folder, the folder would have hundreds of files in it and the three you actually care about (Desktop, Documents, Downloads) would be lost in the noise.

The vocabulary, said properly:

  • A hidden file is a file the OS suppresses from the default view.
  • A dotfile is a file whose name begins with a dot. Hidden by convention on macOS and Linux.
  • The .env file is a developer convention. A file holding secret keys and config values for local development. You'll meet it properly in Ch 14.
  • The .gitignore file is a file telling Git which files to ignore. You'll write hundreds of these.

How each OS hides files:

  • macOS hides files in two ways. Files with names that begin with . are hidden. Files with a hidden flag in their metadata are also hidden.
  • Linux only uses the leading-dot convention.
  • Windows only uses the hidden flag in the file's metadata. Windows doesn't care about leading dots.

3. You do it, with me

Step 1. Open your home folder.

  • macOS: Finder, then your name in the sidebar.
  • Windows: File Explorer, then your name in the sidebar.

Step 2. Toggle hidden files on.

  • macOS: press Cmd+Shift+. (Command, Shift, period). It's a toggle — press again to turn off.
  • Windows: from the menu, click View -> Show -> Hidden items.

(SCREENSHOT: macOS Finder before pressing Cmd+Shift+. — full window — no dotfiles visible)

(SCREENSHOT: macOS Finder after pressing Cmd+Shift+. — full window — dotfiles visible in grey)

(SCREENSHOT: Windows File Explorer View -> Show menu — full window — "Hidden items" checkbox highlighted)

The view changes. New files appear, usually drawn in grey or with a faded icon to show they're hidden.

Step 3. Spot the dotfiles. Look for files like:

  • .DS_Store (macOS) — Finder writes one of these in every folder you visit. It stores window position, icon arrangement, view settings. Harmless on your machine; embarrassing if you commit one to a public repo.
  • .zshrc or .bashrc (macOS, Linux) — settings for your terminal shell. You'll edit these in Ch 2.
  • .gitconfig — your Git username, email, and editor preferences. You'll create one in Ch 8.
  • .npmrc — settings for npm, the Node package manager. Ch 13.
  • .env — secrets for local development. Ch 14.

(SCREENSHOT: macOS Finder showing home folder with hidden files revealed — full window — .zshrc and .DS_Store visible)

(SCREENSHOT: Windows File Explorer showing user folder with hidden items toggled on — full window — AppData visible)

Step 4. Open one. Right-click .zshrc (macOS) or any text-based dotfile -> Open With -> VSCode. You'll see plain text inside — just configuration written in whatever format that tool expects.

This is the whole trick. A dotfile is a normal text file. The dot is a hint to humans and to the file manager that you can ignore it most of the time.

Step 5. The Windows equivalent. Windows doesn't use leading dots. It uses a hidden flag — a bit of metadata on the file. You set it via right-click -> Properties -> Hidden checkbox. Then the file disappears from the default view until you toggle "Hidden items" on. Windows-shipped folders like AppData use this.

4. What you should be seeing

Your home folder with hidden files visible. You can see at least three dotfiles (on macOS) or hidden folders like AppData (on Windows). You can toggle the hidden state on and off with the keyboard shortcut.

You also opened one dotfile and confirmed it's just a text file inside.

5. Common stumbles

  • You turn hidden files on and then everything looks cluttered. Toggle them back off (Cmd+Shift+. on macOS, untick on Windows) when you're done. You don't need them visible all day — just when you're working with a specific dotfile.
  • You try to open .zshrc and the OS says "no default app". macOS doesn't know what to open a file with no extension in. Right-click -> Open With -> VSCode. Tick "Always use this app" if you want this to be permanent.
  • You commit a .env file to Git. Dotfiles aren't hidden from Git — only from your file manager.
  • You delete .DS_Store and it comes back. Finder writes a fresh one the next time you open the folder. The fix isn't to delete them — it's to add .DS_Store to your project's .gitignore so it never leaves your machine.

6. You should know

9/16
Next