0

I was troubleshooting a problem with a guy on irc and he suggested me to run this command. What I do not understand is what the two points mean,

ln -s ../run/lock /var/lock
Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
  • In the US (at least), points=dots, so we say dot-dot slash run slash lock . Good luck, but this Q is not about programming as defined for StackOverflow. It **may** be more appropriate on https://superuser.com OR https://unix.stackexchange.com . Please don't post the same Q on 2 different sites. Please read https://stackoverflow.com/help/on-topic , https://stackoverflow.com/help/how-to-ask , https://stackoverflow.com/help/dont-ask and https://stackoverflow.com/help/mcve before posting more Qs here.' – shellter Jan 28 '23 at 02:51

4 Answers4

1

If you mean the two dots, it is the bash way to say go up a directory before diving down in run etc.

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
mbofos01
  • 51
  • 1
  • 1
  • 10
1

It means, if your folder named "run" is inside another folder, this ../ will take you to the higher folder and navigate to a file outside the directory you're currently in. For example (see the folder structure below):

project_folder/
├─ modules/
│  ├─ main.py
├─ run/
│  ├─ lock/
│  │  ├─ var/
│  │  │  ├─ lock/

your code is written in the main.py file under the modules folder. To navigate to the ``run/lock/var/lock```` you have to go up one folder to do that, this is why you need to add ../ before the path you want to go to. You can add more ../../ if you want to go up further.

gabrsafwat
  • 108
  • 7
0

The ../run means to take the run directory from the current' parent directory. If your script is running from foo/bar/ it should then look for lock command in foo/run/

gildux
  • 448
  • 6
  • 12
  • This isn't quite right. Normally, the path is relative to the script's working directory, which is normally inherited from the working directory of whatever ran the script and has nothing to do with the location of the script. But in the specific case of the target of a symbolic link (which it what it is here), it's relative to the directory the link is in, so in this case it's making `/var/lock` a link to `/var/../run/lock` (which is equivalent to `/run/lock`). – Gordon Davisson Jan 28 '23 at 02:31
  • We agree. :) When I wrote "If your script is running from", I wanted to point out the working directory and not the location it's stored to. Please suggest a better/clearer formulation but still simple regarding the question (OP doesn't look familiar with some notions) – gildux Jan 28 '23 at 03:44
  • Beware, we aren't sure of that absolute path `/var/lock`, it may be `/usr/local/var/lock` or `/opt/some_app/var/lock` etc. – gildux Jan 28 '23 at 03:46
0

There are really nice and informative content arround internet about terminals in general, here is a citation of a really good article about the use of terminal in linux:

Usually, we use names to access the directories. In Linux we use symbols.

. This directory.

.. The parent directory.

/ Directory separator. Directories end in a forward slash and this is often

assumed the directory separator is optional i.e.

$ cd /bin/abc

$ cd /bin/abc/ are same.