I have a file in a .directory (so I can only see it through the terminal) and I have a file on the desktop with the same name.

How do I replace the file in the directory with the one on the desktop?

  • 3
    You can view hidden directories via file manager as well. Just press ctrl+h in file manager window Feb 21, 2017 at 0:06

2 Answers 2


1. The console way:

If you want to move/copy from .directory to the Desktop:

mv /path/to/.directory/filename ~/Desktop
cp /path/to/.directory/filename ~/Desktop

Alternatively, if you want to move/copy from the Desktop into .directory:

mv ~/Desktop/filename /path/to/.directory
cp ~/Desktop/filename /path/to/.directory

The difference between mv and cp is:

mv will move a file (the file at origin gets destroyed).

cp will copy a file (you get to keep the file at origin).

2. The GUI way:

Open your file manager and activate Show hidden files (Ctrl+H on PcManFM and many others). You can then navigate any hidden directories and drag and drop your file to its intended destination.

  • 1
    And he could use cp/mv -iv, interactive: prompt before overwrite, and verbose: explain what is being done. Dec 1, 2021 at 1:53

In Nautilus (Files) in the View menu, click Show Hidden Files, or press Ctrl+H. Then you can use the file manager, if you are not comfortable with the command line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .