Unix dotfiles and rc files: a developer’s guide

If you have cloned a project from GitHub recently or set up a modern JavaScript framework, you will have noticed a collection of files in the project root with names like .babelrc, .eslintrc, .npmrc, and .prettierrc. They all start with a dot, many end in rc, and none of them are immediately obvious to someone who has not encountered them before. This article explains what they are, where the naming convention comes from, and how it is evolving.


What are dotfiles?

Files whose names begin with a dot are known as dotfiles. On Unix-like operating systems such as Linux and macOS, any file or directory whose name starts with a dot is treated as hidden by default. It will not appear when you list files in a directory using ls, and it will not show up in the macOS Finder unless you have enabled hidden files. The convention of using a dot prefix to hide configuration files dates back to an early quirk of Unix: the ls command was written to skip files starting with a dot to avoid cluttering the output with . (current directory) and .. (parent directory), and hiding configuration files alongside them became an unintended convention that stuck.

To view hidden files in the terminal you can use the -a flag:

ls -a

On macOS you can toggle hidden files in Finder using Command + Shift + .


What does rc mean?

The rc suffix stands for run commands. The convention originates from CTSS (Compatible Time-Sharing System), an operating system developed at MIT in the early 1960s. CTSS had a script processor called RUNCOM, which executed a list of commands from a file when a program started. The term rc was carried forward into early Unix shells and has been used ever since to describe any file that contains startup or configuration commands for a program.

This is why your shell configuration files are named .bashrc and .zshrc: they contain the run commands that are executed when Bash or Zsh starts. The same logic applies to tool-specific files like .eslintrc and .npmrc, which contain configuration commands that those tools read on startup.


Common rc and dotfiles you will encounter

Working on a modern JavaScript project you will likely come across most of these:

FilePurpose
.bashrcBash shell configuration, loaded for each new interactive shell session
.zshrcZsh shell configuration, equivalent to .bashrc for Zsh users
.npmrcnpm configuration, used to set registry URLs, authentication tokens, and other npm settings
.babelrcBabel configuration for JavaScript transpilation
.eslintrcESLint configuration for linting rules (now deprecated in favour of flat config)
.prettierrcPrettier configuration for code formatting preferences
.gitignoreLists files and directories that Git should not track
.envEnvironment variables for local development, should never be committed to version control
.editorconfigDefines consistent coding style settings across different editors and IDEs

The shift away from rc files

Modern tools are increasingly moving away from the rc naming convention towards explicitly named configuration files, and the trend is well established. There are a few reasons for this.

The rc suffix gives no indication of the file format. An .eslintrc file could contain JSON, YAML, or JavaScript depending on which version of the tool you are using and how it was set up. Explicitly named files like eslint.config.js or prettier.config.js make the format immediately obvious and are easier for editors and tooling to handle.

ESLint is the most prominent example of this shift. ESLint v9, released in 2024, introduced a new flat config system where the configuration file is named eslint.config.js (or .mjs or .cjs). The legacy .eslintrc format is now deprecated and no longer automatically searched for in new projects. Prettier similarly supports prettier.config.js as an alternative to .prettierrc.

Other tools that have moved in this direction include:

  • Vitevite.config.js
  • PostCSSpostcss.config.js
  • Babelbabel.config.json (the newer format alongside the older .babelrc)
  • Jestjest.config.js
  • TypeScripttsconfig.json

The rc convention is not going away entirely. Shell configuration files like .bashrc and .zshrc are deeply embedded in Unix history and will not be renamed. And many tools still support both formats for backwards compatibility. But for new tooling, explicitly named configuration files with a clear extension are now the preferred approach.


Further reading


Posted

in

by