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

StackOverflow https://stackoverflow.com/questions/17557487

  •  02-06-2022
  •  | 
  •  

Question

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

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

I tried to change the name of libcrypto:

mv libcryto.so libpmcrypto.so

And now it shows:

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

Does that affect anything? And what does the arrow mean?

Was it helpful?

Solution

The file in question is a symbolic link. This is conceptually similar to the idea of a shortcut, but it appears to be the real file if you use it (Open it, copy it, etc.). The symbolic link is another name that "points to" the real file. When you do ls -l it also shows you which file is pointed to by the link. Renaming the link has no effect on the original file, but may break things that rely on the link name, just as with any other file name. Deleting the link just removes the pointer, and has no effect on the original file. Deleting the original file will leave the link in a "broken state" where the link points to nothing.

Edit You can't really edit what symbolic links point to. You can delete them with rm and then recreate them with the ln -s command. Take a look at the man pages for more information.

OTHER TIPS

-> means libpmcrypto.so is a Symbolic link and the information stored in libcrypto.so.0 is accessible through the libpmcrypto.so file.

How to create a symbolic link:

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

for example:

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

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

How to find symbolic links:

find ./ -type l

read man ln for more information on links.

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

For example in your library directory you have file pointing to the .so files (shared object).

This means it does not need to be recompiled. You have no easy way of telling how files are linked.

Yes that does changes something, in fact you shouldn't change a shared library because when a 3rd-party program tries to call libcryto.so its not going to be there any more.

But if you're sure you want to change the name, I would recommend you to 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 symlink name. You're changing part of its name so whenever a program tries to call it, its not going to be able to locate it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top