Posted by: jasonk2600 | November 25, 2009

Random Notes – Creating Symlinks with LN

A symlink is simply a pointer to a file or directory.  Symlinks are used in Linux, *BSD, and UNIX operating systems.  When interacting or editing, the symlink acts as if it is the actual file or directory it points to.  Creating symlinks are fast and easy.

In the example below a symlink for the /usr/local/www/data directory is created under the /var/www/ directory.

# cd /var/www
# ln -s /usr/local/www/data

When changing to the /var/www/data/ directory you will actual be working with files that are located in /usr/local/www/data/.  This is very useful should the need to have access to the same files from different directories.

Creating symlinks for files is carried out in the same manner as directories.  In the example below a symlink for the /root/kernels/GENERIC.conf is created in the /usr/src/sys/i386/conf/ directory.

# cd /usr/src/sys/i386/conf
# ln -s /root/kernels/GENERIC.conf

NOTE: To remove or delete a symlink treat it as a normal file or directory. Only the symlink will be deleted, not the original files/directory. The example below deletes the two symlinks that we created above.

# rm /usr/src/sys/i386/conf/GENERIC.conf
# rm /var/www/data

 

  [EoF]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: