Today, when using cat to view the created soft link file, the following problem occurred:
The emergence process:
1. First, I have a 2.txt file and test folder in the current home directory;
[wq@localhost ~]$ ls
1.txt 2.txt Desktop Documents Downloads Music Pictures Public Templates test Videos
2. I put the shortcut of the 2.txt file into the test folder through a soft connection;
[wq@localhost ~]$ ln -s 2.txt test
3. Then, when I used the cat command to view the contents of the shortcut file 2.txt, I was prompted:
[wq@localhost ~]$ cat test/2.txt
cat: test/2.txt: Too many levels of symbolic links
Reasons for occurrence:
For the two parameter paths of the soft link, I wrote: relative path, not absolute path.
Soft link syntax:
ln -s 参数1 参数2
-s: (create soft link)
Parameter 1: (File or folder to be linked)
Parameter 2: (Where to link)
Solution:
Change the parameter path to: absolute path.
4. Finally, I changed it to an absolute path and used a soft link;
[wq@localhost ~]$ ln -s /home/wq/2.txt /home/wq/test/
5. At this time, use the cat command to view the contents of the shortcut file 2.txt, and you can successfully query it.
[wq@localhost ~]$ cat test/2.txt
/home/wq
233
over. . .