Hidden Files
Updated
Hidden files are quite self-explanatory. They are files that are hidden (duh), but they are really important in software development. Here are the most common ways you'll interact with them. This applies to directories as well.
Syntax
On Unix-like systems, the convention is dead simple: if the name starts with a dot, it's hidden. That's the whole trick.
Files:
.superhiddenfile101.txt
.bashrc
Directories:
home/.superhiddenDirectory
desktop/folders/.superhiddenphotos
How do I actually see them?
By default, ls won't show them. That's the point. Add the -a (all) flag:
ls -a
Or pair it with -l for the long listing:
ls -la
Pro tip: In Finder on Mac, you can toggle hidden files with Cmd + Shift + .
Why are hidden files (and directories) important?
These are the contexts I've found them relevant in software engineering:
1. Configuration
Lots of software stores user-level configuration in dotfiles. For instance, I'm using the mintty terminal, and when I want to modify my settings or appearance, I edit my .minttyrc file.
Also, people often call these dotfiles.
2. Environment variables
When you're working on a project involving Git and you have API keys or other sensitive information you'd like to keep off the internet, tools commonly load those values from a .env file.
BUT, and this is the important part, naming a file .env does not hide it from Git. Git tracks dotfiles just fine; the dot only hides them from a normal directory listing. To keep an untracked .env out of commits, list it in .gitignore:
# .gitignore
.env
.gitignore tells Git which untracked paths to ignore. If a secret was already committed, adding it to .gitignore is not enough: remove it from tracking and rotate the secret.
Dotfiles you'll meet in the wild
Quick reference of the ones you might run into:
.git/ the whole Git repository metadata lives here
.gitignore patterns for intentionally untracked files
.env commonly used for local environment variables and secrets
.bashrc Bash config (or .zshrc for Zsh)
.ssh/ SSH configuration and keys
.config/ a common user configuration directory