Sponsored Content
Full Discussion: Hard link a directory
Top Forums UNIX for Advanced & Expert Users Hard link a directory Post 302488384 by hergp on Monday 17th of January 2011 03:00:50 AM
Old 01-17-2011
Hardlinks on directories are not impossible by design - the mkdir system call produces them, look at the "." and ".." entries in the newly created directory - but they are dangerous, because this capability may produce loops in the file hierarchy or otherwise corrupt the file system. (taken from the POSIX man page for the link system call/function, see: Man Page for link (POSIX Section 3) - The UNIX and Linux Forums). Therefore they are not allowed on most Unix implementations.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Differences between hard link and soft link

Hi all! I'd like to know the differences between hard links and soft links. I've already read the ln manpage, but i'm not quite sure of what i understood. Does a hard link sort of copy the file to a new name, give it the same inode number and same rights? What exactly should I do to do this:... (3 Replies)
Discussion started by: penguin-friend
3 Replies

2. UNIX for Dummies Questions & Answers

Why use a hard link

Someone asked me a question today about the difference between a hard link and a soft link. That got me thinking and maybe someone can answer. Why would I ever use a hard link if I can use a soft link instead? (2 Replies)
Discussion started by: dangral
2 Replies

3. UNIX for Dummies Questions & Answers

Difference between hard link and soft link in unix

Hi All, Can any one please explain me what is the difference between hard link and soft link in UNIX. Thanks in advance Raja Chokalingam. (2 Replies)
Discussion started by: RAJACHOKALINGAM
2 Replies

4. UNIX for Dummies Questions & Answers

need some info about symbolic link and hard link

hello folks how y'all doin well i have some questions about symbolic link and hard link hope some one answer me i open terminal and join as root and i wrote ln -s blah blah then i wrote ls i see red file called blah blah but didn't understand what is this can some one explain and... (2 Replies)
Discussion started by: detective linux
2 Replies

5. UNIX for Advanced & Expert Users

Hard link

Hello, In unix, the normal user can't create a hardlink for a directory. why..? Is there any difference between creating a hard link for a file and directory? The super user can create a hard link for directories. Why we cannot create and super user can create.? Please, can anyone help... (1 Reply)
Discussion started by: nagalenoj
1 Replies

6. UNIX for Dummies Questions & Answers

Hard Link vs SOft Link????

Hi PLease let me know the usage of Hard Link vs Soft Link i.e what is the basic difference and what happens when one file is changed or deleted in both the cases??? thanks (3 Replies)
Discussion started by: skyineyes
3 Replies

7. UNIX for Dummies Questions & Answers

Difference between hard link and soft link

Hi Experts, Please help me out to find out difference between a hard link and a soft link. I am new in unix plz help me with some example commands ( for creating such links). Regards S.Kamakshi :) (2 Replies)
Discussion started by: kamakshi s
2 Replies

8. Shell Programming and Scripting

Find Hard Link

Goodmorning everybody. A question: How can i match if a file is an hard link or not? (6 Replies)
Discussion started by: Guccio
6 Replies

9. UNIX for Advanced & Expert Users

Hard Link Examples

Hello, Please move this if I chose the wrong forum category. This question pertains to Unix and Linux I believe. I google the difference between hard and symbolic/soft links and I understand the difference. What I am trying to find is a real example of a hard link being used in a Operating... (11 Replies)
Discussion started by: jaysunn
11 Replies

10. Shell Programming and Scripting

Creating hard link with name

How can I create a hard link to a file, then rename the hard link to a different name? (2 Replies)
Discussion started by: fhill2
2 Replies
MKDIR(2)						     Linux Programmer's Manual							  MKDIR(2)

NAME
mkdir - create a directory SYNOPSIS
#include <sys/stat.h> #include <sys/types.h> int mkdir(const char *pathname, mode_t mode); DESCRIPTION
mkdir() attempts to create a directory named pathname. The argument mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created directory are (mode & ~umask & 0777). Other mode bits of the created directory depend on the operating system. For Linux, see below. The newly created directory will be owned by the effective user ID of the process. If the directory containing the file has the set-group- ID bit set, or if the file system is mounted with BSD group semantics (mount -o bsdgroups or, synonymously mount -o grpid), the new direc- tory will inherit the group ownership from its parent; otherwise it will be owned by the effective group ID of the process. If the parent directory has the set-group-ID bit set then so will the newly created directory. RETURN VALUE
mkdir() returns zero on success, or -1 if an error occurred (in which case, errno is set appropriately). ERRORS
EACCES The parent directory does not allow write permission to the process, or one of the directories in pathname did not allow search per- mission. (See also path_resolution(7).) EEXIST pathname already exists (not necessarily as a directory). This includes the case where pathname is a symbolic link, dangling or not. EFAULT pathname points outside your accessible address space. ELOOP Too many symbolic links were encountered in resolving pathname. ENAMETOOLONG pathname was too long. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOMEM Insufficient kernel memory was available. ENOSPC The device containing pathname has no room for the new directory. ENOSPC The new directory cannot be created because the user's disk quota is exhausted. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. EPERM The file system containing pathname does not support the creation of directories. EROFS pathname refers to a file on a read-only file system. CONFORMING TO
SVr4, BSD, POSIX.1-2001. NOTES
Under Linux apart from the permission bits, only the S_ISVTX mode bit is honored. That is, under Linux the created directory actually gets mode (mode & ~umask & 01777). See also stat(2). There are many infelicities in the protocol underlying NFS. Some of these affect mkdir(). SEE ALSO
mkdir(1), chmod(2), chown(2), mkdirat(2), mknod(2), mount(2), rmdir(2), stat(2), umask(2), unlink(2), path_resolution(7) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-05-13 MKDIR(2)
All times are GMT -4. The time now is 10:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy