Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anybody give me an example why should we use the symlink kind of the "ln" command between files? I know that when you create symlink file, that file size is very small and it redirect to the main file.

The problem is when I created the symlink from a specific file (text file) from another directory, but I can't cat, less or any kind of print and view that file. Pls help me understand more about this type.


share|improve this question
It would help if you post the precise command(s) you typed. I suspect a path error. – jlliagre Jul 26 '13 at 18:29
up vote 1 down vote accepted

Let say you have a file named /home/george/Images/ubuntu.jpg and you want it to be available too in the /var/tmp directory, you can run:

ln -s /home/george/Images/ubuntu.jpg /var/tmp

Then, you can equally view the file using the /var/tmp/ubuntu.jpg path.

Beware not to miss to provide a correct relative or absolute path for the first parameter passed to the link command. This path is relative to the directory where the symbolic link resides. This is a common source of mistakes, like Nitin reply demonstrates.

share|improve this answer
That's great. Now I understand it. That's just my typing problem haha. Thanks dude! – George Luong Jul 27 '13 at 15:56

Symbolic links contains a text string that is automatically interpreted and followed by the operating system as a path to a target file or directory.

The most relevant use case of symbolic links is restructuring of file system hierarchy, so keeping the compatibility with old tools and standards like POSIX.

Wikipedia has extensive information on symbolic links.

share|improve this answer

As you mentioned that you have created a link but cannot access the file if you do cat.

  1. You should have permission to cat original file.
  2. File should be on same file-system/partition.

$ cd / 
$ echo "UBUNTU" > orig.txt 
$ cat orig.txt 
$ ls -l orig.txt
-rw-r--r--   1 root     root           0 Jul 26 18:28 orig.txt 
$ ln -s orig.txt /pool0/manager/link.txt 
$ cd /pool0/manager/ 
$ cat link.txt
 cat: cannot open link.txt: No such file or directory


share|improve this answer
Your command created a wrong symbolic link, i.e. you linked /pool0/manager/orig.txt to /pool0/manager/link.txt. The first file doesn't exist. This has nothing to do with the same file-system limitation that doesn't affect symbolic links anyway. – jlliagre Jul 26 '13 at 18:32
file orig.txt lies in / while symlink lies in other partition /pool0/manager/link.txt which i tested. – Nitin Jul 26 '13 at 18:51
As you wrote the command, orig.txt is in the same partition, but doesn't exist. – jlliagre Jul 26 '13 at 19:12
You should have typed: ln -s /orig.txt /pool0/manager/link.txt (notice the absolute path for /orig.txt. – jlliagre Jul 26 '13 at 19:19
Thanks for your test Nitin! That's just my typing problem... Haha. – George Luong Jul 27 '13 at 15:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.