Tag Info

Hot answers tagged

4

SLINK has its own inode, and this inode will point to the inode of A.DAT. No, it doesn't reference the inode at all. It points to the name of A.DAT. If the name is changed, the reference breaks. This is why symlinks can work across filesystems. The inode (or whatever data structure is used) may not be visible, but the name is.


4

Since your primary aim is to have a combined view of your local and external Music folder, I think a union mount via overlayfs could be used, especially if the files are not being written to. The basic command is, in older kernel versions (<3.18): mount -t overlayfs -o lowerdir=/read/only/directory,upperdir=/writeable/directory overlayfs /mount/point ...


3

Not the issue of ls. It's how symlinks work. The .. gets you into the parent of the current directory, the directory doesn't know you got to it through a symlink. The shell has to intervene to prevent this behaviour. For the shell builtin cd, there is special handling that doesn't just call chdir but memorizes the full directory path and tries to figure out ...


3

readlink only works with one file, you need a loop to do that: for f in *; do readlink -f -- "$f" done


3

It's hard links to directories that can break the filesystem structure. Hard links to other types of files aren't a problem. For example: mkdir foo ln foo foo/self rmdir foo rmdir foo doesn't actually remove the directory since it has a remaining link — the self entry inside foo itself. foo has become detached from the filesystem; it can't be reached ...


2

You can use the -F parameter to ls to get: -F, --classify append indicator (one of */=>@|) to entries i.e.: # ln -s videos Videos # ls -l lrwxrwxrwx. 1 guido guido 6 Jan 23 14:11 videos -> Videos # ls -lF lrwxrwxrwx. 1 guido guido 6 Jan 23 14:11 videos -> Videos/ Anyway, I'd suggest you create symlinks to directories like ...


2

You can also use gnu stow, a symlink farm manager. Assume the following layout: . ├── drive │   ├── a │   │   ├── b │   │   │   └── bar │   │   └── c │   │   └── baz │   └── b └── music └── a └── b └── foo Execute: $ stow --target music --dir drive . Result: . ├── drive │   ├── a │   │   ├── b │   │   │   └── bar │   │   └── ...


2

You can also use realpath: % realpath * /data/code/mdweb/Gemfile /data/code/mdweb/Gemfile.lock /data/code/mdweb/README.markdown realpath is not POSIX. It is available by default on FreeBSD systems, and on some (but not all) Linux systems (but AFAIK can be installed as a package on most, if not all, Linux systems). realpath's behaviour might be different ...


1

bash "knows" about symlinks and tracks this info when you use a symlink to enter a directory. You can check this by doing the following in your example: $ cd /dir2 $ cd linked $ pwd /dir2/linked $ PWD='' bash -c pwd /dir1 You need to start the bash with an empty PWD variable, otherwise it uses that trick to display the "fake" path. Note that ls is a ...


1

The output of ll, which I assume is a shell alias for ls -l, does not contain this information in the mode/permissions of the symlink. On Linux (symlink(2)): The permissions of a symbolic link are irrelevant; the ownership is ignored when following the link, but is checked when removal or renam- ing of the link is requested and the link is ...


1

. is a regular expression metacharacter in sed, which matches any single character. Because you just insert the $from path into the regular expression directly, the . is there as though you'd written: sed "s@.@../pool/@" yourself. That replaces any single character, once, with "../pool/", so it has the effect of deleting the first character and inserting ...


1

While replacing symbolic links to directories we should use -n option. Example: ln -sfn /path/to/directory /target/directory



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