Hot answers tagged


You can create a symbolic link with the command line utility mklink. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Link specifies the new ...


Edited: use the '-f' flag to print the canonicalized version. readlink -f /root/Public/myothertextfile.txt man readlink ... -f, --canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist


Using -f with ln will overwrite any link that was already there, so as long as you have the correct permissions, it should work... It's always worked for me. What operating system are you using?


you can use ldconfig, it recreates the symlink: # rm /lib/ rm: remove symbolic link `/lib/'? y # ls -l /lib/libc* ls: error while loading shared libraries: cannot open shared object file: # ldconfig # ls -l /lib/libc* [skip] lrwxrwxrwx. 1 root root 12 May 11 07:59 /lib/ -> just tested it, as you ...


CentOS 6 generally comes with busybox, a statically-linked set of Unix tools, installed in /sbin. You can run it like this: /sbin/busybox ln -s /lib/


That works for me, what is the output of strace ln -f -s /var/www/html/releases/build1390 app-current ? Oh, since it is a directory you need to add -n for no dereference and this should solve the issue. -f is really more of a convenience since adding the -f just causes it to unlink anyways. Although I guess it would probably happen a few hundred ms faster ...


The -L flag to rsync will sync the contents of files or directories linked to, rather than the symbolic link.


just use namei: $ namei d f: d l d -> c l c -> b l b -> a d a


On Windows XP you can use fsutil (built into the OS) to create a hardlink fsutil hardlink create c:\foo.txt c:\bar.txt Keep in mind fsutil will only work if both are on same drive


Hell yes. If you execute the ln -s you create a symbolic link, which is an inode pointing to a certain filesystem object, which is why symlinks can traverse filesystems and hard links cannot: hard links do not have their own inode. If you mount a filesystem with --bind, you create a second mountpoint for a device or filesystem. If you envision a symlink as ...


Set LD_PRELOAD to preload the relevant library. I tried it out with libpthread and it seems to work: root@spirit:~# mv /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/ root@spirit:~# chattr chattr: error while loading shared libraries: cannot open shared object file: No such file or directory root@spirit:~# ...


Ok, I found where my error is: one should not put the first / in path. In other words, the commands in my questions should be: Creation -> ln -s {path/to/file-name} {link-name} Update -> ln -sfn {path/to/file-name} {link-name} instead of Creation -> ln -s {/path/to/file-name} {link-name} Update -> ln -sfn {/path/to/file-name} {link-name} ...


sln serves exactly that purpose: to fix symbolic links when you can't use regular ln because you broke an essential symlink. To quote its man page: DESCRIPTION The sln program creates symbolic links. Unlike the ln(1) program, it is statically linked. This means that if for some reason the dynamic linker is not working, sln can be used ...


Use with some caution. It will take a while. find / -type l


The pwd command is both a shell builtin and /bin/pwd. Under normal circumstances, the builtin will be run in preference to /bin/pwd. The pwd command can be called as pwd -L or pwd -P Both the builtin and /bin/pwd default to pwd -L from the man page -L, --logical use PWD from environment, even if it contains symlinks so when you run pwd ...


perheps: pwd -P from help: "-P : The pathname printed will not contain symbolic links. "


There's only one kind of symbolic link. The issue you're seeing with FTP is probably that the FTP server is restricted to a subtree of the filesystem (this is called a chroot jail), and a symbolic link pointing outside that subtree won't work. That's by design: the chroot jail is for security, and you mustn't be able to escape the jail by following a ...


GNU find's manpage says that all POSIX finds are supposed to detect filesystem loops and emit error messages in these cases, and I have tested find . -follow -printf "" on GNU find, which was able to find loops of the form ./a -> ./b and ./b -> ./a printing the error find: `./a': Too many levels of symbolic links find: `./b': Too many levels of ...


Use -a option with rsync. It will copy the broken symlinks too. Something like this: # rsync -av source host:destination


readlink is the command you want. You should look at the man page for the command. Because if you want to follow a chain of symbolic links to the actual file, then you need the -e or -f switch: $ ln -s foooooo zipzip # fooooo doesn't actually exist $ ln -s zipzip zapzap $ # Follows it, but doesn't let you know the file doesn't actually exist $ readlink ...


readlink -e <link> readlink [OPTION]... FILE -e, --canonicalize-existing canonicalize by following every symlink in every component of the given name recursively, all components must exist $ mkdir testlink $ cd testlink pjb@pjb-desktop:~/testlink$ ln -s c b pjb@pjb-desktop:~/testlink$ ln -s b a pjb@pjb-desktop:~/testlink$ ls -l ...


It's likely the SFTP is being chrooted, so that the directory /var/www is not available to the user in the chroot jail. Look in /etc/ssh/sshd_config and examine the sftp directives. Do you see something like: Match group sftp ChrootDirectory /home/%u AllowTcpForwarding no ForceCommand internal-sftp The sshd_config man page is here. Basically, ...


I know this has been answered a while ago, but I was wondering the same thing and found this answer. The accepted answer is actually not quite correct. There are symbolic links to files and directories. There are hard links to files. "Hard links" to directories are called junctions. The thing is, they are not quite hard links. Microsoft calls them Soft ...


Are you talking about MS-DOS or Windows XP? Since it's likely that you're just talking about doing this from a command-prompt on Windows XP I'll answer for that case first... >smile< On an NTFS volume under Windows XP you can use the "fsutil" tool to create a hard link: fsutil hardlink create <destination filename> <source filename> ...


Windows 2000 and later allows for symbolic linking but refers to symbolic links as junctions. I do not believe you can make them easily without an additional tool, but you can find free tools for creating them. Free tool: KB Article on Junctions:


You can use -n or --no-dereference to prevent the target from being dereferenced if it is a symlink. You can also use -T or --no-target-directory to ensure that the target file will always be treated as a regular file. These produce slightly different behavior, as the following example shows. Suppose src is some file, dirlink is a symlink to a directory, ...


You cannot use hard links across file systems like that. You need to use ln -s to create a symbolic link. ln -s /mnt/storage/sourcefile.txt /var/www/myweb/linkedfile.txt


Two options: 1) Use Hard symlinks. Rsync doesn't need special flags to traverse these, because they look like part of the filesystem. - Of course, this only works on the same filesystem, which doesn't apply. 2) A bind mount. sudo mount -o bind /source /dest.


You can set LD_LIBRARY_PATH variable to include the directory where real is: export LD_LIBRARY_PATH="/dir/for/$LD_LIBRARY_PATH" Also, execute ldconfig for it to recreate the links. This should make the commands work so you can then use ln commands to fix your system. Another way would be to boot via LiveCD and link file there.

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