A special type of file that references a file or directory.

learn more… | top users | synonyms (1)

5
votes
1answer
349 views

Symbolic links with ls, mv: forcing the functions to utilize “logical” addresses (remembering the original path)

It seems that for many basic functions operating on symbolic links, the physical path is used by default. However, cd works fine. When moving into a symbolic link, cd remembers where I came from so it ...
5
votes
1answer
6k views

Make samba follow symlink outside share

This is ubuntu server 10.04 64 and samba 3.4.7 I have a shared directory /home/mit/share and another one /home/temp that I link into the shared one: ln -s /home/temp /home/mit/share/temp But on ...
5
votes
1answer
106 views

Cannot delete broken symbolic link

I have a symbolic link formerly pointing to a Dropbox directory. I don't know what I did wrong, but apparently now it points to itself. hyper@mypi:/home/hyper/test$ ls -l total 1024 lrwxrwxrwx 1 ...
5
votes
1answer
132 views

Can non-canonicalized forms of filesystem paths be significant? (eg. “foo//bar”, “foo/./bar”, and “foo/../bar”)

I have a script for building a particular flavor of GCC cross-compiler. Throughout the script there are many paths that are not in canonical form, such as duplicate path separators (/xxx/foo//bar/yyy) ...
5
votes
1answer
5k views

Copy symlink AND where it points to using rsync

It doesn't need to be done by rsync, but it would be nice not have to write a script to do this, and rsync is very close to what I want. "rsync -a" (or -l) can preserve symlinks, and -L can ...
4
votes
4answers
411 views

Symbolic link and hard link questions

Let's say /A/B/c.sh is symbolic linked to /X/Y/c.sh. If c.sh has the command "./SOMETHING", '.' means /A/B/ or /X/Y/? How about the hard link?
4
votes
4answers
2k views

Is chmod behavior wrong for symlinks?

Recently we had a problem on a Red Hat Linux box with many users: the /usr/bin/sudo binary has lost its sticky bit. Work was blocked until root user fix it (we need sudo for deploying and testing). ...
4
votes
4answers
1k views

Changing the timestamp of a symlink

I know how to change the timestamp of a regular file: touch -t 201301291810 myfile.txt I was not able to do the same with a symlink. Is it possible? Distro: RHEL 5.8
4
votes
3answers
479 views

Create symbolic links to files using wildcards

I want to create symlinks to multiple files: ln -s dev-*.php 's/dev-(.*\.php)/$1/' Results hoped for: site.php links to dev-site.php file.php links to dev-file.php What's the most ...
4
votes
2answers
171 views

How to copy directory structure without removing symlinks?

I need to "install" a bunch of files to another directory keeping the directory structure of the source files intact. For example, if I have ./foo/bar/baz.txt going to /var/www/localhost/webroot/ I ...
4
votes
4answers
5k views

List symlinks in current directory?

This question talks about finding directories in a current diretory. The solution is basically: ls -d */ That's great but how can I easily list symlinks? Do I have to use something like find . ...
4
votes
6answers
1k views

Is it possible to “roll” a symlink to a new file without affecting any open file handles?

An application I am developing locally logs it's output to files formatted with the current timestamp such as app-%Y%m%d.log. To make it simple to be able to tail the current's day log in a terminal ...
4
votes
1answer
129 views

`cd` up the canonical path

Consider: $ pwd /home/user $ ls -l total 3604 lrwxrwxrwx 1 user user 19 Nov 27 12:11 pages -> /var/www/pages/ $ cd pages $ pwd /home/user/pages $ readlink -f . /var/www/pages $ cd .. $ readlink ...
4
votes
2answers
112 views

Is symlink's target relative to the destination's parent directory and if so, why?

I've got the following file structure: build/ client/ –> index.js And when I try to create a symbolic link named "client" inside the build directory that refers to the client directory in the ...
4
votes
4answers
352 views

find all symbolic links in a directory tree pointing outside that tree

I frequently move directory trees to other locations or copy their tarballs to other machines, and I would like to have a method to check whether any symlinks in a directory tree A point to locations ...
4
votes
2answers
255 views

Can we use symbolic link and hard link for directories?

I know we can do that for files. What about directories? It seems that cpanel uses that a lot.
4
votes
2answers
95 views

Quicker Way to Reference a Directory?

This one is probably easy for all of you, but I have never had to deal with such a nested local set of directories. If I have a path like: /mnt/media2/Archived\ Files/_Transfer/ is there a way to ...
4
votes
2answers
703 views

Why is bash completion of a symlink different than a directory?

I usually do a find with an environment variable as the path when searching for source code. Recently I replaced my environment variable with a symbolic link, and it broke Bash's shell completion. ...
4
votes
1answer
60 views

Is there a command to move a file, and symlink it back to where it was?

I often find myself wanting to move a file, then create a symlink where it was. In doing this by hand I tend to twist my mind. (Esp after doing half a dozen files) Use cases: Moving all my "dot ...
4
votes
1answer
75 views

Behavior of `du` command with `-L` flag

I've noticed a strange behavior with du command when it's used with -L command line option. I'm using Slackware 14 and Coreutils 8.19. To reproduce the strange behavior, create two folders: mkdir ...
4
votes
3answers
111 views

How can I edit symlinks?

My basic understanding of a symlink is as a special file, a file that contains a string path to another file. The kernel's VFS abstracts a lot of that away but is there any reason why symlinks seem to ...
4
votes
1answer
922 views

How to replace a symbolic link with a copy of a file it links to?

Having a (single, no batch filesystem processing needed) symlink, what a command line to use to replace it with a copy of the file it links to?
4
votes
2answers
2k views

How does linux work with symbolic links?

I mean what's going on when some process wants to read a symlink? What's going on when something changes a symlink during a read or even write process? For example: I have 2 huge, similar 100G files ...
4
votes
2answers
54 views

Is it possible to notify/warn that current path isn't a valid symlink anymore?

Let's say we have ./a and ./b directories. Then we create a symlink using ln -s a x and entering it cd x The pwd would be x Then in another terminal we change the x so that it pointed to b. But ...
4
votes
1answer
150 views

Can I create a symlink that will ignore subdirectories?

I'm trying to get dropbox symlinked to the relevant folders in /home. I'd like to symlink them like this: ~/Dropbox/Pictures --> ~/Pictures ~/Dropbox/Camera Uploads --> ~/Pictures/Camera ...
4
votes
1answer
1k views

Does Windows recognize Linux's symbolic links?

I was just wondering how a Windows system handles symbolic links. My best guess is that it will not recognize them, but I'm not entirely sure. Also, what do Macs do when confronted by one?
4
votes
1answer
161 views

How do I cd up and down again with symlinks in bash?

Structure: /base/ +- somedir/ +- symlink/ -> /some_other_dir This command (in addition to my Makefiles) fails: cd /base/symlink ls ../somedir Bash complains that ../somedir does not ...
4
votes
2answers
2k views

What causes ln: //: Is a directory?

When linking a directory to root, I get this error: $ ln -s ~/inbox/ / $ ln: //: Is a directory Bash autocompletes the directory path by adding a /. I've tried escaping without success. $ ln -s ...
4
votes
2answers
1k views

Trailing slashes on symbolic links to directories

I'm trying to emulate the process of path resolution (see man page path_resolution) in unix-like systems. My OS is Linux with GNU coreutils 8.7. In order to clarify the meaning of extra trailing '/' ...
4
votes
2answers
401 views

Find incoming symlinks

In Linux, what is the best way to find all symbolic links that point to a given file (regardless of whether the symlink is relative or absolute)? I realize this will require scanning the whole ...
4
votes
1answer
40 views

ls -l --group-directories-first (act on symlinks as well)

ls option --group-directories-first causes directories to be listed on the top, which makes the output of ls nice and clean: ls -l --group-directories-first However, it does not act on symlinks, ...
4
votes
2answers
482 views

How to rsync a chroot without breaking symlinks?

I'd like to rsync (backup) a chroot environment from outside the chroot. For that I first make a lvm snapshot of the chroot volume and then run rsync on that. The only problem with this approach: ...
4
votes
1answer
342 views

How to remove a directory with “Too many levels of symlinks”

I have a bit of an odd problem on a RHEL system. On our systems we have our home directory automounted under /export/home. There are a few exceptions, as I'm experimenting with using gluster for our ...
4
votes
2answers
740 views

Syncing multiple home folders with dropbox and symlinks

To keep multiple computers synced with dropbox I tried the following. Approach A. -Computer 1: Install dropbox, dropbox folder: /Dropbox/ -Computer 1: Create symbolic link in that folder to home ...
4
votes
2answers
108 views

Force Bash 4 'globstar' option to ignore symlinks

Bash 4 has a fantastic option called 'globstar' that emulates (i.e. was stolen from) zsh's ** syntax for globbing across multiple directories. However, it's somewhat crippled (for my usage, at least) ...
4
votes
1answer
97 views

How do I batch-export all the content contained in symbolic links? (and then delete them all)

So as an alternative to Recursive scp without following links or creating a giant tar file? (this could be an emergency since the remote files could be deleted any time soon), I'm thinking of deleting ...
4
votes
0answers
153 views

Move a file and re-target all of its symlinks [duplicate]

Possible Duplicate: How can I “relink” a lot of broken symlinks? Is there any way to move a file to a new location, and then re-target its symlinks to the new location, using a shell ...
4
votes
0answers
316 views

No access to symlink folder on NTFS partition

I am using an NTFS parition for storing data I like to access both from Ubuntu and Windows 7. On my Ubuntu HOME partition, I like to link the folder Assets in order to access it from an application ...
3
votes
2answers
779 views

How could I make multiple symbolic links for multiple directories, conveniently

lrwxrwxrwx 1 deploy users 20 1월 23 18:15 v122 -> /home/files/video122 lrwxrwxrwx 1 deploy users 20 1월 23 18:15 v123 -> /home/files/video123 lrwxrwxrwx 1 deploy users 20 1월 23 ...
3
votes
2answers
161 views

cd to directory of a symbolically linked file

Before I write a script, anyone know an easy way to do the following: $ pwd /foo/bar $ ls -l lrwxr-xr-x 1 username admin 48 Apr 17 2012 foo.sh -> /bar/foo.sh $ cd /bar $ ls foo.sh i.e., in ...
3
votes
3answers
2k views

Find only destination of symlink

For use in a shell-script, I'm looking for a commandline-way to get the destination of a symbolic link. The closest I've come so far is stat -N src, which outputs src -> dst. Of course I could ...
3
votes
2answers
485 views

Why is bash giving me (apparently) conflicting information about a file?

Background I am working on a RHEL 5 cluster. I want my Fortran program to read the file /home/bob/inputs/input_1 I asked Bob to give me permission to read all contents of inputs: [bob@server]$ ...
3
votes
3answers
623 views

Linux find and remove all symlinks relating to a directory

So, I have a bit of a situation where I created many symlinks in an attempt to get them to work, trying all sorts of combinations .. now I have this error: ls: cannot access /etc/sv/me: Too many ...
3
votes
2answers
51 views

Is there a way to condense ../.. parts of a path out programatically?

Say for example I have these types of paths to files in a script: /path/to/some/file/../../file1.txt Is there a command I can call such as readlink that will convert this path to its actual ...
3
votes
2answers
179 views

How Do I Block Read Access to a Symbolic Link?

I have this file structure: > APPLICATION 1 >> CONTROLLER (@JuniorProgrammers) >> MODELS (symlink to SHARED/MODELS) >> VIEWS (@Designers) > APPLICATION 2 >> CONTROLLER ...
3
votes
2answers
449 views

Resolving symbolic links (pwd)

Say I do the following: cd /some/path ln -s /target/path symbolic_name If then do: cd /some/path cd symbolic_name pwd I get: /some/path/symblic_name and not: /target/path Is there a way to ...
3
votes
2answers
109 views

Symbolic Link local .jpg file to .jpg file on the internet

Is there any way to have a symbolic link that links a local .jpg file to a .jpg file on the internet in a l/unix environment?
3
votes
2answers
1k views

How does /dev/fd relate to /proc/self/fd/?

$ ls -l /dev/stdin /dev/fd/0 lrwx------ 1 tim tim 64 2011-08-07 09:53 /dev/fd/0 -> /dev/pts/2 lrwxrwxrwx 1 root root 15 2011-08-06 08:14 /dev/stdin -> /proc/self/fd/0 $ ls -l /dev/pts/2 ...
3
votes
2answers
261 views

Can I make a symlink point to different locations on different machines?

Before you say "no", a workaround would also be fine. Here is the situation: I have two machines local and compile, both including the same ~ over nfs from a third machine files. I would like to have ...
3
votes
2answers
203 views

open a file using CDPATH and symlink

To quickly move around, I added a path to CDPATH that contains symlinks to different locations. I did this by adding the following line to .bashrc: export CDPATH=~/symlinks When working with ...