Open a terminal and type: Alternatively, you can do it with a GUI.
Install dconf
Run dconf-editor
On the left panel, navigate to “org -> gnome -> nautilus -> preferences”. On the right panel, search for an entry “show-hidden-files.” Uncheck the box beside it.
That’s it. Next time you open your Nautilus File Manager, all the hidden files will stay hidden. You can then press “Ctrl + h” to show the hidden files. Enjoy!