1

This is the tutorial shows:

enter image description here

You can see the /application/nginx -> /application/nginx-1.8.0

But I follow the steps:

[root@localhost nginx-1.8.0]# ll /application/nginx lrwxrwxrwx. 1 root root 12 5月 19 04:01 /application/nginx -> nginx-1.8.0/

It is nginx-1.8.0/, there is no /application in front it, and sure the nginx-1.8.0 is the Symbolic Link under the /application.

My operating system is Cnet OS 7.2

The tutorial operating system is Cent OS 6.8

The difference between the tutorial if is the system reason?

1
  • 1
    You probably didn't run the ln command exactly as written in the tutorial, but it doesn't matter. May 19, 2017 at 4:35

3 Answers 3

0

It's a classic mistake to get the targets wrong way round when using the ln command.

Make sure you use ln <target> <linkname> and see if it works.

The opening post could be a bit clearer, so that's all the help I can give.

0

If you're trying to view the contents of the directory, you need a trailing slash when specifying the path. Like this:

ll /application/nginx/
2
  • No, I mean the ->, it is point to -> nginx-1.8.0/ but the /application/nginx-1.8.0/. May 19, 2017 at 9:41
  • @qg_java Are you trying to make a relative link? if you you have to do cd /application ln -s nginx-1.8.0 nginx
    – Vegar
    May 19, 2017 at 11:47
0

The tutorial created a link that resolves to an absolute path. You created a symbolic link that resolves to a relative path.

Creates an absolute link:

ln -s /application/nginx-1.8.0 /application/nginx

nginx will always resolve to /application/nginix-1.8.0, even if you move nginx to a new directory.

Use an absolute link if nginx might move and /application/nginix-1.8.0 will never move.

Creates a relative link:

ln -s nginx-1.8.0 /application/nginx

nginx will always resolve to nginx-1.8.0 in whatever directory nginx is in

When you use -s to create a symbolic link, the first parameter does not have to even exist in your filesystem. It's not an error to create a symbolic link to a file or path that doesn't exist yet.

Use this relative link if nginix will always exist in the same directory relative to nginx-1.8.0

More relative link examples

ln -s ../real alpha      # alpha will always point to real in alpha's parent directory
ln -s real alpha         # alpha will always point to real in alpha's directory
ln -s subdir/real alpha  # alpha will always point to subdir/real in alpha's directory

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .