Tag Info

Hot answers tagged


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 ...


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 ...


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 $?.


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 ...


-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. ...


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


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


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 ...


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

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