ln command
How to create a link in the Linux
create a link to the file
1 | ln -s [file] [the link] |
For example, now you have a file called the t1.txt, then you
wants to make a link called t2 to the t1.txt
Then you can do as follow
1 | ln -s t1.txt t2 |
cat t2
will have the same effect as the cat t1.txt
Then we can use the ls command to check the l2
1 | ls -l t1.txt |
The link do not same as the t1 totaly, and the -> means what it point to.
overwrite the link
If the link aready exist, it will be error if you try to link it to a
different file.
If you still wants to do it. Just add the -f to the command.
1 | ln -sf t3.txt t2 |
delete the link
Whether the unlink
or the rm
is ok.
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.