how to change background of nautilus in ubuntu 14.04

You can edit the gtk-main.css or nautilus.css files.

I recommend you to try this under your ~/.themes and not system-wide. You may either change the background color of nautilus only or the base theme as a whole, which affects a lot more programs. In this example I will change the background color in the default Ubuntu Theme "Ambiance" (in Ubuntu Gnome use the folder Default instead) from white (#ffffff) to a light grey (#D8D8D8). Feel free to pick any other color.

For comparison how it looks like in the beginning: Natuilus css file

Create a copy in ~/

Create your ~/.themes directory and copy the original Ambiance theme to it.

mkdir ~/.themes
cp -R /usr/share/themes/Ambiance ~/.themes/

Change the background color for the whole theme

If you want to change the base color for the whole theme, edit the base_color (Hex notation #??????) in gtk-main.css. This changes the background color of other applications (eg: gedit) as well.

nano ~/.themes/Ambiance/gtk-3.0/gtk-main.css

Change this line:

@define-color base_color #ffffff;

For this one:

@define-color base_color #D8D8D8;

To save the changes in nano, press Ctrl+O,Enter then Ctrl+X.

Effect: Background color for the whole theme

Change the background color for nautlius only

If you want to change the background color for nautilus, edit nautilus.css.

nano ~/.themes/Ambiance/gtk-3.0/apps/nautilus.css

Add this lines to the beginning of the file.

 NautilusWindow * .view {
     background-color: #D8D8D8; 
}

Natuilus css file

To save the changes in nano, press Ctrl+O,Enter then Ctrl+X.

Effect

Background color for nautilus only

To see the changes you can restart nautilus, logout login or restart your machine.


Roman's solution will work, but actually there's no need to copy the entire Ambiance theme to your .themes directory. Instead, you can simply create a file ~/.config/gtk-3.0/gtk.css and put any changes you want there, such as

NautilusWindow * .view {
 background-color: #D8D8D8; 
}

Then restart Nautilus. The definition in your gtk.css file will override the theme defaults and you'll see the background color you wanted.