Replacing a file inside a hidden folder via terminal

35,738

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.

Share:
35,738

Related videos on Youtube

Timothy Benjamin
Author by

Timothy Benjamin

Updated on September 18, 2022

Comments

  • Timothy Benjamin
    Timothy Benjamin over 1 year

    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?

    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 7 years
      You can view hidden directories via file manager as well. Just press ctrl+h in file manager window
  • Pablo Bianchi
    Pablo Bianchi over 2 years
    And he could use cp/mv -iv, interactive: prompt before overwrite, and verbose: explain what is being done.