New answers tagged symlink
Another solution that side-steps the issue (at least for my case) is to use bind mounts instead of symbolic links for the directories on the hard disk. This is done by adding entries in /etc/fstab like this: /mnt/hdd/Films /home/mark/Videos/Films none bind 0 0
Try using realpath: realpath --relative-to=/foo/bar/something /foo/hello/world For more examples, see: Convert absolute path into relative path given a current directory at SO
-t specifies a directory in which to create a symlink. It doesn't specify a directory which is to be targeted by the symlink. What you want is ln -s gradle-2.7 gradle-current. This creates a symlink called "gradle-current" which points to "gradle-2.7". In actual fact it doesn't matter whether gradle-2.7 is a directory or a file—the command is the same. ...
There are at least 2 standard utilities to build a shadow directory tree of an existing tree, so no need to write code here. First there's lndir(1) from the xutils-dev package. It uses symlinks to files. From the man page: NAME lndir - create a shadow directory of symbolic links to another directory tree SYNOPSIS lndir [ -silent ] [ ...
The tilde character is expanded by the shell before the command is executed. It will be replaced by the value of $HOME. So the ln utility which creates the symlink will never see the tilde, only the full path. This path will be stored in the symlink. In Linux, there is no otion to make a symlink variable. They are handled by the kernel. The kernel does ...
To address your question regarding symbolic links, "is ~ not allowed?". Answer : ~ is not allowed. It'll allow you to create such a symlink but it won't resolve to the home directory when followed. ln -s \~ d ls -ld d lrwxrwxrwx 1 steve steve 1 Sep 29 11:28 d -> ~ ls d d cd d cd: d: No such file or directory
The LS_COLORS variable has an option for symbolic links. The LN option, if given a unique color compared to the DI option, will show all symbolic links as that color instead. See http://linux-sxs.org/housekeeping/lscolors.html for basic options. There is ways of setting individual extension types to their own colors, so there may be a way to set symbolic ...
There are three possible reasons: your du implementation does not check hard linked files only once the filesystem does not report the space used by files correctly with the stat() syscall The filesystem is NFS and the fileserver is running HP-UX
As you showed, system/nrcalc is a symlink on the local system, but it's a directory on the remote server. If the directory on the remote system is not empty, rsync will refuse to delete it (to make way for the symlink) unless you specify --force or one of the --delete options. If you don't want to replace the directory on the far end, but you still need to ...
There is also stat: $ touch test $ ln -s test test_l $ stat test File: `test' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fc00h/64512d Inode: 4309 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1000/ vagrant) Gid: ( 1000/ vagrant) Access: 2015-09-11 11:37:59.864165922 +0000 Modify: 2015-09-11 ...
Alternatively you can use a simple script: #!/bin/bash ls -alFQ | grep '^l' The Unix mantra is to have small simple utilities that can be chained together to achieve complex task. So while this is technically not a POSIX utility, it's very close to one. If you want to get fancy you can only select what portion of the string to return: #!/bin/bash ...
Two utilities could do that for you, fileand readlink: file some_symlink will display some_symlink: symbolic link to 'some_target' readlink some_symlink will exit with code 0 whereas readlink some_file will exit with code 1 Note that exit code is stored in variable $?, and can be displayed with echo $?.
You're looking for test: -h pathname True if pathname resolves to a file that exists and is a symbolic link. False if pathname cannot be resolved, or if pathname resolves to a file that exists but is not a symbolic link. If the final component of pathname is a symlink, that symlink is not followed. Most shells have it as a builtin, but test also ...
Top 50 recent answers are included