2

I accidently made a link and can't delete that:

big:~# ls -al
total 88
lrwxrwxrwx  1 root root    27 May 28 18:10   -> /etc/apache2/ssl/apache.pem
drwx------  8 root root  4096 May 29 01:45 .
drwxr-xr-x 23 root root  4096 May 27 04:50 ..
drwxr-xr-x  2 root root  4096 Apr 18 19:26 backup_big

I don't wonna do experiments with "rm" :-D

Daniel W.
  • 1,439
  • 4
  • 23
  • 46
  • 2
    Slightly dangerous, but you can always just do `rm -i *`. The `-i` puts rm into confirm mode. Simply answer no to everything except the file you actually want to get rid of. – Zoredache May 29 '13 at 01:24

1 Answers1

2

In bash you can do this:

shopt -s extglob
for file in !(testfile); do echo "x${file}x"; done

and replace echo by rm (and delete the x) when you are convinced that it works.

If this is GNU:

ls -l --quoting-style= # with shell/c/escape whatever fits your need best

Or with find:

find . -type l -exec ls -l {} \;

and replace -exec ... with -delete (or the ls -l with rm).

Or you rename it (mv instead of rm) in one of these ways and delete is manually afterwards.

Hauke Laging
  • 5,157
  • 2
  • 23
  • 40