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

1
  • 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, 2013 at 1:24

1 Answer 1

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.

1
  • find . -type l -exec rm {} \; did a quite good job. ty!
    – Daniel W.
    May 29, 2013 at 0:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .