This one is probably easy for all of you, but I have never had to deal with such a nested local set of directories.

If I have a path like: /mnt/media2/Archived\ Files/_Transfer/ is there a way to "mount" that directory to ~/Transfer/ or /mnt/transfer?

I was looking into symlinks, but it talks about "how it's not always a good idea on directories because of recursive commands, etc..."


  • 1
    This is what symlinks are for. Just try not to set up circular links, because that won't be useful to anyone, and you should be fine. – jw013 Sep 21 '12 at 14:43

Symlinks do sound a good idea to me in this case:

ln -s /mnt/media2/Archived\ Files/_Transfer/ ~/Transfer

See also zsh's:

PS1='%~%# '
transfer=/mnt/media2/Archived\ Files/_Transfer/
cd ~transfer
  • For the section about zsh's above -- can I copy using that format too? I.e. cp ~/test.sh ~transfer/.? And do I still retain rw privileges in the linked directory? – chow Sep 21 '12 at 16:30
  • 1
    @chow They're called named directories. They work in all cases where the shell interprets the string, which includes passing arguments to commands – Michael Mrozek Sep 21 '12 at 17:26

If you don't want to (or can't) use symlinks (e.g., filesystem doesn't support, like vfat), you can also use a bind mount:

mount --bind "/mnt/media2/Archived Files/_Transfer" /mnt/Transfer

Beware that bind mounts are stronger than symlinks. E.g., rm -Rf will just remove a symlink when it encounters one; it'll traverse through a bind mount.

Bind mounts can only be done by root. Symlinks can be done by any user.

  • 1
    I do not recommend bind mounts for this. The directory tree will effectively appear twice for many purposes (backups, indexing, etc. — anything that traverses the directory tree). Symlinks are the right answer here. – Gilles Sep 21 '12 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.