V
V
Vladimir Korshunov2021-02-07 19:26:04
linux
Vladimir Korshunov, 2021-02-07 19:26:04

Why doesn't the link work if I move it to another directory?

Just started learning linux. Downloaded and installed the steam program, it is automatically installed via apt-get. The script that runs it is in /usr/games. I create a link to it: sudo ln -s steam steam_link , in this directory, steam can be launched both through the original file and through the link. However, when I transfer the link somewhere, let's say, like this: sudo mv steam_link ~/MyAppl , and then I try to run it there, nothing works anymore, and the file, if opened, turns out to be empty. If you transfer the link back, then everything works again, I gave maximum access rights to everything through sudo chmod 777 steam. The same story is not only with this script, but with any other file. If you transfer the original, then everything works.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2021-02-07
@GashhLab

If you make a relative link and then copy it, it will link relative to the new directory. Make the link a link from the root of the file system. Or create a link immediately in the desired directory. Yes, it's the same with Microsoft.

R
Ragnar Black, 2021-02-08
@Ragnar1

To understand the symbolic link, you need to understand the types of paths, namely, to know that there is an absolute path - a path listing the route to the destination folder / file from the root of the file system, for example ls /usr/bin - viewing the contents of the bin folder using an absolute path; and know that there is a relative path - a path relative to the current working directory. for example, to get to /usr/bin from the user's home folder using a relative path, you need to specify the following route: cd ../../usr/bin
Now about the soft links themselves. A soft link is, in short, a file that contains the path to the file it points to.
Now that you know about paths and how symbolic links work, you won't get confused in this thread anymore! ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question