Tag Info

Hot answers tagged

7

Because bash (and possibly other shells) track the path you descended, including symlinks, in order to make your trail back up look like the one down. Bash knows how you got to the working directory because cd must be a shell built-in. When you run ls .. the shell can't substitute the "symbolic path" because grep .. is also valid and translating .. would be ...


4

You'll probably want to use the find command using the maxdepth option. I created this sample directory structure: /tmp/parent /tmp/parent/subdir2 /tmp/parent/subdir1 /tmp/parent/subdir4 /tmp/parent/subdir4/notme /tmp/parent/subdir3 Let's say I wanted to create a symlink to /tmp/hooks in each subdir but not the notme subdir: root@xxxxxxvlp12 ~ $ find ...


4

This isn't du resolving the symbolic links; it's your shell. * is a shell glob; it is expanded by the shell before running any command. Thus in effect, the command you're running is: du -s /data/ghs/14 /data/ghsb/14 /data/hope/14 /data/rssf/14 /data/roper/14 If your shell is bash, you don't have a way to tell it not to expand symlinks. However you can ...


3

A program that acts on the contents of a file always acts on the target, not on the symbolic link, because symbolic links have no contents of their own. A program that acts on the metadata of a file (timestamps, owner, permissions, …) usually acts on the target, but some programs have options to act on the symbolic link instead (for example, chown -h, touch ...


2

Go to the directory where you want to create the link and run the following command: ln -s ./ 2015 The ln command creates links, see man ln: -s, --symbolic make symbolic links instead of hard links


2

This is a symbolic link. Go the directory where they are pointing to and execute: ln -s . 2015 should do it. Note the destination shall not exist. If there is currently a directory named 2015 move it before linking.


2

ln works a bit like cp. If there are more than two arguments, the last one is treated as a directory. From man ln: ln [option]... target... directory You'll need to use a for loop instead.


2

dpkg -S can't tell you which package installed the symlink because it only looks at the files that were unpacked from the packages. This information is provided by the *.list files in /var/lib/dpkg/info/*.list. Every file on a Debian system can only be owned by one package. If you try to install a package that contains a file that is already provided by ...


2

You can use readlink to print where a link points to. The argument to readlink without options has to be a link, if you pass it a file, it will not print anything. The -f option for readlink, from the coreutils package, recursively follows links and prints the filename even if the argument already is a file. If you do (-n supresses the newline at the end of ...


1

Let's have a look at what your first command did: it created a symbolic link math in your current directory that points to the absolute path of the current directory. Lets inspect a bit closer: user@host:/free$ ls -al /free total 4 drwxrwxrwt 2 root root 40 Oct 14 10:29 . drwxr-xr-x 24 root root 4096 Oct 1 22:28 .. user@host:/free$ ln -vs /free math ...


1

find can be used to execute a command in the context of every directory under a specific path. The following command looks for all files under /var/opt/gitlab/git-data/repositories/web/ that are directories (-type d) and creates a symbolic link relative to the current directory it is examining (represented by {} in -exec ) So the following find command ...


1

I insert disable_symlinks off; in my nginx.conf and i resolved, works fine! http { disable_symlinks off; } Thanks Andy


1

Lets create simple script: #!/bin/bash mypath=$1 while [[ "${#mypath}" -gt 1 ]]; do file "$mypath" mypath="$(dirname $mypath)" done Test: $ ./linksinfo /usr/src/linux/kernel/../../../../bin/sh /usr/src/linux/kernel/../../../../bin/sh: symbolic link to `bash' /usr/src/linux/kernel/../../../../bin: directory ...



Only top voted, non community-wiki answers of a minimum length are eligible