Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #239449
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Soft link confusion |
| Date | 2021-08-30 02:20 +0200 |
| Message-ID | <CRDbQ-71r-1@gated-at.bofh.it> (permalink) |
| References | <CRCSt-6FV-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Aug 29, 2021 at 04:59:35PM -0700, Gary L. Roach wrote: > I don't have occasion to use links very often and tend to get confused as to > which direction the link is pointing. Specifically, I am trying to redirect > backuppc files from the normal /var/lib/backuppc directory to another disk > mounted at /media/Backup, a 1TB disk that is not being used. I wrote "ln -s > /var/lib/backuppc /media/Backup". This produced "backuppc -> > /var/lib/backuppc" on the 1TB disk. The syntax is: ln -s TARGET LINKNAME I.e. you specify the existing thing first, and the name of the link that you want to create last. > The problem is that I now have duplicate > files in both places. Specifically the cpool, log, pc, and pool directories > appear on both drives. Well, there are two things here. First, if you screwed up the ln -s command the first time, you might also have accidentally created the link in a different place than you thought. In particular, if the final argument is an existing directory, a link will be created *inside* that directory. Second, what you see depends on how you're viewing the two directories. To begin with, note that the ls command has a -d option which suppresses the normal ls behavior of showing the contents of a directory, and instead shows you the directory itself. unicorn:~$ ls -ld /bin drwxr-xr-x 2 root root 4096 Aug 5 07:09 /bin/ If you've been doing commands like "ls -l /media/Back<TAB>" then you might be seeing the contents of a directory, rather than the actual symlink or the directory that it points to. unicorn:~$ ln -s /bin link unicorn:~$ ls -ld link lrwxrwxrwx 1 greg greg 4 Aug 29 20:07 link -> /bin/ Right? There's my symlink which points to a directory. Now, if I forget to use the -d option: unicorn:~$ ls -l link lrwxrwxrwx 1 greg greg 4 Aug 29 20:07 link -> /bin/ Still OK, right? But if I use tab completion, then I get a trailing slash on the argument, and then... unicorn:~$ ls -l link/ total 13980 -rwxr-xr-x 1 root root 1234376 Aug 4 16:25 bash* -rwxr-xr-x 3 root root 38984 Jul 20 2020 bunzip2* -rwxr-xr-x 1 root root 715480 Jul 25 14:44 busybox* [...] So I have a guess that you might have done that. Including the trailing slash changes the behavior of ls (and many other commands).
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Soft link confusion "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-30 02:00 +0200
Re: Soft link confusion Greg Wooledge <greg@wooledge.org> - 2021-08-30 02:20 +0200
Re: Soft link confusion Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2021-08-30 15:20 +0200
Re: Soft link confusion Tixy <tixy@yxit.co.uk> - 2021-08-30 15:40 +0200
Re: Soft link confusion David Christensen <dpchrist@holgerdanske.com> - 2021-08-30 02:40 +0200
Re: Soft link confusion "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-30 16:50 +0200
Re: Soft link confusion Andrei POPESCU <andreimpopescu@gmail.com> - 2021-08-31 12:20 +0200
csiph-web