How do I get spaces instead of tabs in nano?

Either create .nanorc in your home folder, including:

set tabsize 4
set tabstospaces

or edit the system /etc/nanorc file.


From the nano Command Manual:

-E, --tabstospaces
Convert typed tabs to spaces.

-T <#cols>, --tabsize=<#cols>
Set the displayed tab length to #cols columns. The value of #cols must be greater than 0. The default value is 8.

For four spaces, the appropriate command would therefore be nano -ET4.

Consider creating a permanent alias.