z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Creating a symbolic link

z/OS UNIX System Services User's Guide
SA23-2279-00

You can create a symbolic link to a file or a directory. Additionally, you can create a symbolic link across mounted file systems, which you cannot do with a hard link. A symbolic link is another file that contains the path name for the original file—in essence, a reference to the file. A symbolic link can refer to a path name for a file that does not exist.

To create a symbolic link to a file, use this command format:
ln -s old new
Thus, new is the name of the new file containing the reference to the file named old. In Figure 1, /u/benson/proja is the name of the new file that contains the reference to /u/smitha/proja.
Figure 1. Symbolic link: a new file. A symbolic link has its own inode number.A file system with a symbolic link.

When you create a symbolic link, you create a new physical file with its own inode number, as shown in Figure 1. Because a symbolic link refers to a file by its path name rather than by its inode number, a symbolic link can refer to files in other mounted file systems.

To understand how a symbolic link that is a component of a path name is handled during path name resolution, see Resolving a symbolic link in a path name.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014