Thursday, April 25, 2019

How to symlink a file in Linux? [SOLVED]

How to create symlink for a file/directory ?

Today I will show you how to create a symlink to a file or folder.
In linux, a symbolic link, also known as a symlink or a soft link, is a special kind of file (entry) that points to the actual file or directory on a disk (like a shortcut in Windows)

So lets create one: 

in order to create a new symlink try below


ln -s /path/to/file /path/to/symlink


To create or update a symlink:
ln -sf /path/to/file /path/to/symlink


How to list all symlink in a directory ?
Now you have created a symlink. To see present symlink for current directory you can try below command:

ls -la /var/www/ | grep "\->"

This will list all the links present in the current directory.

Let me know if this resolves your problem 😃



Tags:

No comments:

Post a Comment