I made a symlink to a directory like this:  ln -s /some/directory symlink   Now I'd like to remove the symlink:  rm symlink/   This doesn't work. The error message is:   rm: cannot remove 'symlink/': Is a directory    What am I doing wrong? Why does rm claim my symlink is a directory? How to remove the symlink properly?
121086
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 '/' in resolution, I did following things in a shell:  mkdir this_is_dir ln -s this_is_dir this_is_link rm this_is_link   Everything was fine, because this_is_link is a symlink, and I just removed it away. But while trying:  mkdir this_is_dir ln -s this_is_dir this_is_link rm this_is_link/   It echoed rm: cannot remove 'this_is_link/': Is a directory  Well, the trailing '/' caused following of symlink, I thought. So, I tried another command: rmdir this_is_link/  And a funny result came out: rmdir: failed to remove 'this_is_link/': Not a directory  Not what I expected. So I asked my friend to confirm if the same result could be obtained on his system. He had a lower version of coreutils than I had. And the result was amazing, no matter rm or rmdir 'this_is_link/', the same error Not a directory occurs.  And another friend just tried it out on his Mac OS, the result is: rm => 'Is a directory', rmdir => the directory is successfully deleted, the link remained.  Are there any spec about the exact behavior of path resolution?
37950
I have a directory with images. Suddenly I found out that there's a new image with a new name. The image content is similar to another image in another directory but with a different name. I didn't copy this image to this directory.  Also a directory with the same name as the image suddenly appeared there. I didn't create any of them. When I tried to delete them I got this message "No such file or directory" even though it already existed there. I used the command sudo rm -rf imagename.jpg to delete it but it didn't work.   Can anyone explain why this is happening and how to solve it?  The output of ls -l "large (2).jpg":  -rw------- 1 alaa alaa 2859942 Jun  8 04:01 large (2).jpg   The output of rm "large (2).jpg":  rm: cannot remove ‘large (2).jpg’: No such file or directory   The output of printf %s\\0\\n ./large* | sed -n l  ./large (20).jpg\000$ ./large (26).jpg\000$ ./large (2).jpg\000$ ./large (5).jpg\000$   The filesystem is NTFS.
2083
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, which are actually symlinks to directories. There is a possibility to use   ls -l -L --group-directories-first   which will list both kind of directories on top, but will not distinguish between proper directory and symlinked directory, which is again confusing.  Can ls display symlinked directories on top, while still keeping them distinct from regular directories?  EDIT: I am using bash.
18208
I ran following commands in the order specified:  $ln a b $ls -i a b 523669 a 523669 b $rm -f a $ls -i b 523669 b   I concluded from this test that the command rm actually removes only the filename (a in this test) instead of the file, as the inode still exists and could be retrieved through another filename (b).  My question is, if a file is hard linked to only one filename, when rm is executed to the file, is the real file (i.e., the inode) removed completely? And if not, can a file inode be retrieved without a filename and only through the inode?
52146
In a python script, I am creating a bunch of symbolic links chained together.  example: link1->link2->link3->.......->somefile.txt  I was wondering how you can change the max number of symlinks to be greater than 20?
47557
I'm trying to implement a configuration mechanism that allows in a certain project to deploy through svn a cron configuration.  I immediately thougt that what I should do is cerate symlinks from /etc/cron.d/ to my project's cron file (which in turn is controlled by a vcs), but that seems to not be working.  I found some old forum messages referring that symlinks were not supported and other saying that they are. Which is it?  Is there anything else or any other good way to achieve this?
113349
Assuming you know the target is a symbolic link and not a file, is there any difference between using rm and unlink to remove the link?
118375
Structure:    /base/    +- somedir/    +- symlink/  -&gt; /some_other_dir   This command (in addition to my Makefiles) fails:  cd /base/symlink ls ../somedir   Bash complains that ../somedir does not exist. Likewise, my makefiles in some_other_dir that reference ../somedir fail. However, cd .. works just as expected. Can I have my shell act with regards to the logical structure?
66025
I use Ubuntu 14.04 and in a terminal I became root with sudo su and I wanted to delete root's trash manually. It deleted everything except for a few files that start with a dot. Like .htaccess etc. So I went to that directory (which is "files") and I ran this command:  rm -rf .*   It did delete those files, BUT I also got an error message that the system couldn't delete "." and ".."  What does it mean? Like if I tried to delete the whole directory tree? Like I said, when I was running that command I was in the lowest directory. This one to be exact: /root/.local/share/Trash/files/ I shot down my PC and then turned it on. Everything seems to be normal at first glance. So now I want to ask is what went wrong and if what I did could really cause any serious damage to the system in general? In other words, should I be worried now or everything is OK?
24905
How do you create a hardlink (as opposed to a symlink or a Mac OS alias) in OS X that points to a directory? I already know the command "ln target destination" but that only works when the target is a file. I know that Mac OS, unlike other Unix environments, does allow hardlinking to folders (this is used for Time Machine, for example) but I don't know how to do it myself.
25143
The expression .* is expanded by bash to include the current and parent directories:  $ ls -la total 2600 drwxrwxrwx   2 terdon terdon 2162688 Sep 10 16:22 . drwxr-xr-x 142 terdon terdon  491520 Sep 10 15:34 .. -rw-r--r--   1 terdon terdon       0 Sep 10 16:22 foo $ echo .* . ..   If I run rm -rf .* on my Debian using GNU bash, version 4.2.36(1)-release and rm from rm (GNU coreutils) 8.13, I get this message:  $ rm -rf .* rm: cannot remove directory: `.' rm: cannot remove directory: `..'   Is this a GNU thing or is it POSIX? Are there any *nix systems where the command above will silently delete . and ..?  Also, is this a safety feature of the shell or of the rm command itself?
8546
I have the following directory setup:  /var/www/html   and  /home/tim/Website/files_here   The folder html is actually a link to /home/tim/Website. This means all my Website files are in my home area (they get included in the backup etc).  Is there anything wrong with this method? Is there a better way to get the homepage to be in /home/tim/Website?  Are symbolic links on a web server ever incompatible with users not on linux?
75569
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 have the shell "fully resolve" a symbolic link (i.e. updating CWD, etc.), as if I had directly done:  cd /target/path   ?  I need to run some programs that seem to be "aware" or "sensitive" about how I get to my target path, and I would like them to think that I arrived to the target path as if had done cd /target/path directly.
37657
I'm using rsync to backup some of my files:  rsync -aEN --delete --link-dest="$CURR/" "$SOURCE/" "$NEW/"  The --link-dest option works fine with most files, but not with symlinks. When I was writing a clean-up script for old backups, I noticed that unchanged symlinks are not hard-linked, but rather copied.  Now I'm wondering: Is there a way to make rsync hard-link unchanged symlinks as well? And if not: Is it intentional or a bug in rsync?  I'm using rsync version 3.1.1 on Mac OS 10.11.  Edit:  It seems to be a problem in Mac OS X. For some reason HFS+ seems not to support hard-links to symlinks.
1552
We have an issue with a folder becoming unwieldy with hundreds of thousands of tiny files.  There are so many files that performing rm -rf returns an error and instead what we need to do is something like:  find /path/to/folder -name "filenamestart*" -type f -exec rm -f {} \;  This works but is very slow and constantly fails from running out of memory.  Is there a better way to do this? Ideally I would like to remove the entire directory without caring about the contents inside it.
108889
Is there way to replace value of symbolic link?  For example I want to replace symbolic link like this:  first -&gt; /home/username/foo/very/long/directories/that/I/do/not/want/to/type/again    to   second -&gt; /home/username/bar/very/long/directories/that/I/do/not/want/to/type/again   I want to change only foo to bar.  Of course I can create a link again, but if it is possible to replace value of the link, it become easier.
5953
I have this file (see attached);   And I cannot delete it. it doesn't exist...  I have tried typing rm in the prompt then dragging the file on to it, I have gone to the actual location of the file and it's not there, I have deleted .Trash folders left right and center and I still can't find it... I have just run First Aid on ALL the volumes I have and the file still mocks me. Does anyone else have any suggestions?