Linux: the ls -la command shows a file pointing to another file. What does it mean?

When I type ls -la to list all the files, I see the following:

 11 Jul 9 12:04 libcrypto.so -> libcrypto.so.0 

I tried changing the name of libcrypto:

 mv libcryto.so libpmcrypto.so 

And now he shows:

 11 Jul 9 12:04 libpmcrypto.so -> libcrypto.so.0 

Does this affect something? And what does the arrow mean?

+4
source share
4 answers

This file is a symbolic link. This conceptually resembles the idea of ​​a shortcut, but it seems like a real file if you use it (open it, copy it, etc.). A symbolic link is another name that "points to" a real file. When you execute ls -l , it also shows you which file the link is to. Renaming a link does not affect the source file, but it can violate what depends on the link name, just like with any other file name. Removing a link simply removes the pointer and does not affect the source file. Deleting the source file leaves the link in a "broken state" where the link does not indicate anything.

Edit You cannot edit any symbolic links. You can delete them with rm and then recreate them with the ln -s command. Take a look at the manual pages for more information.

+9
source

-> means that libpmcrypto.so is a symbolic link, and the information stored in libcrypto.so.0 is available through the libpmcrypto.so file.

How to create a symbolic link:

 ln -s [TARGET DIRECTORY OR FILE] ./[SHORTCUT] 

eg:

 ln -s /usr/local/apache/logs /home/el/logs 

If you delete the link itself (/ home / el / logs), the file (/ usr / local / apache / logs) will still be present.

How to find symbolic links:

 find ./ -type l 

read man ln for more info on links.

+8
source

ls -la display files pointing to the module using symbolic links

For example, in your library directory there is a file pointing to the .so files (shared object).

This means that it does not need to be recompiled. You have no easy way to tell how the files are linked.

+1
source

Yes, something is changing, in fact, you should not change the shared library, because when a third-party program tries to call libcryto.so , it will no longer be.

But if you are sure that you want to change the name, I would recommend that you call nautilus in superuser mode:

 sudo nautilus /THE/FOLDER/WHERE/YOUR/FILE/IS 

And edit it manually by adding .0 to the end of the symbolic link name. You change part of your name, so whenever a program tries to call it, it will not be able to find it.

+1
source

Source: https://habr.com/ru/post/1490568/


All Articles