我不小心做了一个链接,不能删除:
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
我不想用“rm”做实验:–D
在bash中你可以这样做:
shopt -s extglob for file in !(testfile); do echo "x${file}x"; done
并用rm
replaceecho
(并删除x),当你确信它的工作。
如果这是GNU:
ls -l --quoting-style= # with shell/c/escape whatever fits your need best
或者find:
find . -type l -exec ls -l {} \;
并用-delete
(或ls -l
与rm
)replace-exec ...
或者你用这些方法之一重命名它( mv
而不是rm
),然后手动删除。