≡ Menu

ln command

Unix Create a Symbolic Link

How do I create a symbolic links under Linux or Unix like operating systems using command line options?
[click to continue…]

Linux / UNIX: Clear bash history

Q. I'm using CentOS Linux server and how do I clear bash history in UNIX / Linux / BSD operating systems?

A. Type the following command to clear your bash history:


Another option is link ~/.bash_history to /dev/null:
ln -sf /dev/null ~/.bash_history

HowTo: Create a Hard Links in Linux / UNIX

Both Linux / UNIX allows the data of a file to have more than one name in separate places in the same file system. Such a file with more than one name for the same data is called a hard-linked file. How do I create a hard link under Linux / UNIX / Apple Mac OS X / BSD operating systems?
[click to continue…]

How to: Linux / UNIX create soft link with ln command

Q. How do I create a soft link (symbolic link) under UNIX or Linux operating system?

A. To make links between files you need to use ln command. A symbolic link (also known as a soft link or symlink) consists of a special type of file that serves as a reference to another file or directory. Unix/Linux like operating systems often uses symbolic links.

Two types of links

There are two types of links

  • symbolic links: Refer to a symbolic path indicating the abstract location of another file
  • hard links : Refer to the specific location of physical data.

How do I create soft link / symbolic link?

To create a symbolic link in Unix or Linux, at the shell prompt, enter the following command:
ln -s {target-filename} {symbolic-filename}

For example create softlink for /webroot/home/httpd/test.com/index.php as /home/vivek/index.php, enter the following command:
ln -s /webroot/home/httpd/test.com/index.php /home/vivek/index.php
ls -l


lrwxrwxrwx 1 vivek  vivek    16 2007-09-25 22:53 index.php -> /webroot/home/httpd/test.com/index.php

Linux Delete Symbolic Link ( Softlink )

How do I delete softlink or symbolic link in Linux operating system using a command prompt?
[click to continue…]