1

I have an app in /usr/abc and I want to link the abc app to /dump/abc (this is an existing directory). When I run ln -s /usr/abc /dump/abc the link is created inside /dump/abc/abc directory. But I need the content of /usr/abc to be in /dump/abc and not in /dump/abc/abc.

When I do ls -l /dump/abc, I get

lrwxrwxrwx 1 root root 15 Dec 11:00 abc -> /usr/abc 

The desired result when I do ls -l /dump/abc is the content of /usr/abc.

Can someone help me here?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Shree
  • 111
  • 1
  • 2
  • 8
  • If `/dump/abc` is empty, you can just delete this directory, then rerun `ln -s /usr/abc /dump/abc`. – yolenoyer Jan 06 '21 at 11:34
  • Thanks for the reply, But i am not supposed to delete the directory but create symlink to existing directory. – Shree Jan 06 '21 at 11:35
  • 2
    Actually you don't really have the choice: on *nix OSes, directories are files, and symlinks are files as well. You can either have a directory or a symlink in the same path, but not both of them of course – yolenoyer Jan 06 '21 at 11:38

1 Answers1

1

if your intention is to preserve existing /dump/abc you can bind-mount /usr/abc. when done umount /dump/abc to restore the previous state

mount -o bind /usr/abc /dump/abc
alecxs
  • 701
  • 8
  • 17