Linux

Where Is the nano Config File?

Where nano looks for nanorc on Linux, from the user file down to the system sample config.

Last updated

nano reads one rc file: ~/.config/nano/nanorc first (or $XDG_CONFIG_HOME), then the legacy ~/.nanorc, then /etc/nanorc. Most distros ship a long commented system sample meant for copying.

Uncomment includes rather than writing rules by hand. The sample already points at the syntax dir; enabling lines beats duplicating them. Keep key rebinding minimal since terminal emulators intercept half the combos.

Where nano stores this, by platform

Linux
~/.config/nano/nanorc

User config (uncomment include lines for syntax). Legacy ~/.nanorc still works but XDG wins when both exist. System sample at /etc/nanorc.

Frequently asked questions

How do I enable syntax highlighting?

Copy /etc/nanorc to ~/.config/nano/nanorc and uncomment the include lines for syntax files. The system file gets replaced on updates, so your copy is the durable one. Newer nano prefers the XDG path over legacy ~/.nanorc.

Is ~/.nanorc still valid?

Yes, and nano still reads it for backward compatibility. New setups should use ~/.config/nano/nanorc since that is the documented default now. If both exist, the XDG file wins.

Notice an outdated path? Let us know.