Questions tagged [rm]

rm is a basic UNIX command used to remove files, directories, and other items from the filesystem.

rm is a basic UNIX command used to remove files, directories, and other items from the filesystem.

Options:

-f force
-r, -R or --recursive

Examples

rm -rf /some/dir #removes all files and dirs recursively from this point

References

534 questions
-2
votes
3 answers

bash script rm cannot delete folder created by php mkdir

I cannot delete folder created by php mkdir for I in `echo $*` do find $I -type f -name "sess_*" -exec rm -f {} \; find $I -type f -name "*.bak" -exec rm -f {} \; find $I -type f -name "Thumbs.db" -exec rm -f {} \; find $I -type f…
ali
  • 61
  • 5
-2
votes
1 answer

Deleting in a directory where other thread is writing in linux

In my code I am trying to delete a directory having files and subdirectories using rm -rf . While deleting I am getting the error message , "Directory not empty". This is happening because rm -rf recursively deletes the files inside the directory…
Nancy Garg
  • 63
  • 8
-2
votes
2 answers

How to "rm -rf" with excluding files and folders with the "find -o" command

I'm trying to use the find command, but still can't figure out how to pipe the find ... to rm -rf Here is the directory tree for…
stackbiz
  • 1,136
  • 1
  • 5
  • 22
-2
votes
2 answers

Delete Everything in a Directory Except One FIle - Using SSH

In BASH, the following command removes everything in a directory except one file: rm -rf !(filename.txt) However, in SSH the same command changes nothing in the directory and it returns the following error: -jailshell: !: event not found So, I…
Thomas
  • 117
  • 1
  • 10
-2
votes
1 answer

How to remove all directories in a folder in command line?

I want to remove all directories in a folder, no mater the specified directory is empty or not. Can I do this in command line?
Koen
  • 311
  • 2
  • 11
-2
votes
3 answers

How do I delete a file with name ''$'\r'?

For some reasons, I have a file in one of my directories that I cannot delete: $ ls -al drwxrwxr-x 2 xxx xxx 4096 Oct 10 14:05 ''$'\r' (more files follow...) The problem is that I cannot delete it. I tried rm ''$'\r' and ls using wildcards to at…
user52366
  • 1,035
  • 1
  • 10
  • 21
-2
votes
2 answers

What does the directory `//` in the shell command `rm -rf //` do, precisely?

I accidentally ran this command while trying to remove an errant directory named \\ from my project directory. Quite a mistake I know. It pretty quickly began hitting permissioned files at which point I realized my mistake so I ctrl-c'ed out of…
Justus Eapen
  • 1,139
  • 10
  • 22
-2
votes
4 answers

How to rm directory which name has quotation and question marks on macOS

I have two directory which name are very strange as below: "?????+ "BizComponent "?+ "BizComponent and now I try to remove them but failed. when I type rm -r ' then type tab it give me: "^J^I^I^I^I+ "BizComponent/BizComponent/ …
nail fei
  • 2,179
  • 3
  • 16
  • 36
-2
votes
2 answers

Removing files that have special characters in their name

How do I remove files, with specific names.. For example, my file name is This File Example (England).txt This File Example (US).txt I want to remove all the files with (England) in the name. So I tried, rm -f "*(Eng*" But it doesn't work. Is…
Borg357
  • 1
  • 2
-2
votes
2 answers

If I run "rm -rf /* && dd if=/dev/zeros of=/dev/sdX" will the drive be overwritten with zeros?

I am wondering what the result of the above command will be. My goal is a command that will first delete all files on the disk and then overwrite the disk with zeros. However I am concerned that the rm part of the above command will delete the files…
-2
votes
1 answer

How to recover files on a server after rm -rf /* on a development server?

Unfortunately, one of our colleagues executed rm -rf /* command to one of our development servers via SSH and most of our development sites were there. Is there any way to recover or rescue all those files? Our head still doesn't know it happened.
erltarregs
  • 19
  • 1
  • 6
-2
votes
1 answer

How to undo several Git commands?

Any chance to undo any of the following lines: git rm cvs git rm cvs -r git reset HEAD --. git reset --hard HEAD git reset --hard git clean -df git status git rm --cached . git rm --cached git rm --cached -r git rm --cached -r --ignore-unmatch git…
David
  • 1
  • 1
-2
votes
1 answer

what are the difference between the Powershell commands cp and cp -r, rm and rmdir

I am learning the commands in PowerShell. what is the difference between cp and cp -recurse ? What is the difference between rm and rmdir ? is rm just short for rmdir?
-2
votes
2 answers

Rm behavior in linux

If I'm in a directory like: /home/usr_name/Documents/test And, accidentally, I launch: rm .* What happens? I thought it would remove all the files that contained a dot.. but I definitely was wrong!
SirDeveloper
  • 276
  • 1
  • 10
-2
votes
1 answer

unable to delete folder in Linux

I'm trying to remove directory from my external hard drive that I mounted to the file system. I'm using the rm command with the flag rf but I got the following error: Directory not empty Apart from the rm command, I tried to remove file which is…
harianja
  • 63
  • 2
  • 8
1 2 3
35
36