- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Link two Directories
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 01:24 AM
12-06-2001 01:24 AM
Can you tell me how can I link two directories?
e.g.
/mnt1a/george/data->mnt2a/root/data
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 01:27 AM
12-06-2001 01:27 AM
Re: Link two Directories
ln -s

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 01:28 AM
12-06-2001 01:28 AM
Re: Link two Directories
ln -s /mnt2a/root/data /mnt1a/george/data
regards
Fr??d??ric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 01:30 AM
12-06-2001 01:30 AM
Re: Link two Directories
go to the dir you wnat the linked dir to be
cd mnt2a/root
then do
ln -s /mnt1a/george/data data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 01:31 AM
12-06-2001 01:31 AM
SolutionAssuming that mnt2a/root/data currently contains the data and /mnt1a/george/data is the link,
If you want a hard-link,
# ln /mnt2a/root/data /mnt1a/george/data
If you want a soft-link,
# ln -s /mnt2a/root/data /mnt1a/george/data
Hope this helps. Regards.
Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 01:36 AM
12-06-2001 01:36 AM
Re: Link two Directories
type:
ln -s /mnt2a/root/data /mnt1a/george/data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 06:57 AM
12-06-2001 06:57 AM
Re: Link two Directories
One minor point to add: If /mnt1a/george/data already exists, the ln (with or without -s) command will fail.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 07:07 AM
12-06-2001 07:07 AM
Re: Link two Directories
cd /mnt1a/george
ll data (just to confirm there is no such directory existing; if it is move or remove it)
ln -s data /mnt2a/root/data
Another point, do not worry about the permissions of /mnt1a/george/data . Irrespective of what it is the permission of the actual directory will be counted during access.
HTH
raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 08:25 AM
12-06-2001 08:25 AM
Re: Link two Directories
Use the ln command with -s to create a symbolic link. The first argument identifies the existing file that you wish to link to. Additional arguments specify the path names of the symbolic links you wish to create to the existing file.
In your case, it is
ln -s /mnt2a/root/date /mnt1a/george/date
Shawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 08:41 AM
12-06-2001 08:41 AM
Re: Link two Directories
Try,
ln -s /mnt2a/root/data /mnt1a/george/data
hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 08:50 AM
12-06-2001 08:50 AM
Re: Link two Directories
My earlier reply definitely was not a good one. Shawn points out correctly that ln (without -s) will fail if the source is a directory. You must use ln -s on directories.
To clarify (hopefully) the point I was trying to make earlier:
ln -s will fail if the destination exists and is a file. ln -s will succeed if the destination exists and is a directory however the link will be created subordinate to the destination directory. Examples:
# ll
total 0
drwxr-xr-x 2 root sys 96 Dec 6 11:39 d
-rw-r--r-- 1 root sys 0 Dec 6 11:40 e
drwxr-xr-x 2 root sys 96 Dec 6 11:40 f
# ln d e
ln:
# ln d f
ln:
# ln -s d e
ln: e exists
# ln -s d f
# ll
total 0
drwxr-xr-x 2 root sys 96 Dec 6 11:39 d
-rw-r--r-- 1 root sys 0 Dec 6 11:40 e
drwxr-xr-x 2 root sys 96 Dec 6 11:40 f
# ll f
lrwxr-xr-x 1 root sys 1 Dec 6 11:40 d -> d
Sorry for my earlier poor post. I added confusion to the issue instead of clarification.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2001 09:01 AM
12-06-2001 09:01 AM
Re: Link two Directories
for hard link
ln /
for soft (symbolic) link
ln -s /
note: ln does not create hard links across
filesystems.
joey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2003 08:29 AM
07-17-2003 08:29 AM
Re: Link two Directories
The manpage for ln shows as if 2 directories can be hard linked, but in the manpage it states: "The ln command does not permit hard links to a directory."
To link directories the -s option must be used.