1

On a shared machine somehow a directory ; (with a lot of stuff in it) was created.

I only have shell access to this machine and so I can't use any GUI File explorer to delete that file.

rm -rf ;

results in strange behavior since the semicolon probably acts as a command separator and is not evaluated as the directory's name.

rm -rf ./; rm: refusing to remove '.' or '..' directory: skipping './'

rm: refusing to remove '.' or '..' directory: skipping './'

Furthermore I do not want to delete other directories and so I am not willing to play around with wildcards and stuff.

How can I securely remove that semicolon-directory recursivly?

2 Answers2

5

Quote its name. Quoting the name will stop the shell from interpreting it as a command terminator.

rm -rf ';'

The same goes for working with files with names containing other characters that the shell usually treat specially, like filename globbing characters, &, <, >, (, ), {, }, newlines, tabs, spaces, etc., and any other character that may be part of the shell's grammar.

Kusalananda
  • 333,661
0

when I have a hard time deleting a directory I download the tool mc(midnight commander), it's a tool that is very similar to Norton Commander and has great functions and GUI that you can use to delete problematic directories

try

yum install mc -y 

in the command line after the installation write just

mc
Daniel
  • 50