show contents of one directory in another.
drawing a total blank hope you guys can help me out.
I am trying to remember the command to link directories. I need to show the contents of /var/home_volume in /home. I was abe to this once before and I remember it not being the normal symbolic link process. The last time I did this was to display /home in a folder called /workspace. So if i created a new user in /home it showed up in /workspace. IDK maybe it is a symbolic link but /home is already created. I could have sworn there is another method. Hope I am able to get my point across. |
The ordinary symlink should work.
ln -s /var/home_volume $HOME/home_volume You can also automount at boot in fstab using bind. Something like this: UUID=f7927995-b098-42be-ada0-987857f5177a /var ext4 defaults,noatime 0 0 /var/home_volume $HOME/Documents auto bind 0 0 |
@ Reply
Directories cannot be hard link but you can soft link them. As you said you want to show contents of one directory to be shown in other. You can use:
Code:
ln -s <parent directory> <directory you want to show contents in>, example: ln -s <home> <home_test> |
The folders are already created. I wanted to avoid rebuilding them. Symbolic link will require the folder to not exist right?
|
Yes that is correct. However, you can have a sub-folder inside that which contains symlink to your parent folder. Example:
Code:
/tmp/test_dir (already exist) |
So what you're saying is, /var/home_volume already exists and has files/dirs inside. In addition, /home already exists and has files/dirs inside. And you want to merge these two directories so that all files/dirs from BOTH locations are shown side-by-side in /home ?
The cleanest way, I would think, would be to move the contents of /home to /var/home_volume, delete /home, and then symlink or bind mount /var/home_volume to /home. If that's not an option, I suppose you could loop through all files/dirs in /var/home_volume and symlink them inside of /home Code:
for i in /var/home_volume/*; do ln -s $i /home/; done All of the above suggestions are explaining how to make a symlink of /var/home_volume INSIDE of /home, so you would have to go to /home/home_volume to see it. It doesn't sound like that's what you want. |
All times are GMT -5. The time now is 02:48 PM. |