rm is the command to remove files

learn more… | top users | synonyms

1
vote
4answers
15 views

Remove a directory from inside using the command line interface

Imaging the next simple file structure within the /home/user/ directory: /home/user |--dir0 |--dir1 |--file1 My current directory is 'dir1' and I remove the ...
-2
votes
1answer
50 views

how to delete swarm of ._ files using commandline

I have these files in MAC which have weird ._ character before filenames/folders. Which I want to delete in one shot. Is there a way to do it in commandline? eg. ._js ._css ._image if I go into ...
-6
votes
1answer
48 views

Delete Huge file in linux

I would like to delete a large file in my server. It's very large nearly more than TB's. What is the best way to delete that huge file ???
4
votes
1answer
115 views

Undeletable directory

Everything I've tried (always with superuser privileges) has failed: # rm -rf /path/to/undeletable rm: cannot remove ‘/path/to/undeletable’: Is a directory # rmdir /path/to/undeletable rmdir: failed ...
3
votes
2answers
119 views

rm not deleting file, thinks its a directory

I have a hard drive with windows loaded on it hooked up to my Linux machine for backing up some of the information. I want to delete one of the 'temporary internet files' folders and it deleted all ...
2
votes
2answers
87 views

How to remove a file that can be seen but no program can seem to touch?

I'm trying to remove some obsolete backups, and deep inside one I've found a file 'cifs3bee' that I can find no way of removing. (And since I can't remove it, it's preventing the removal of the entire ...
0
votes
0answers
5 views

Fine tuning of an informative replacement for rm [migrated]

I want to replace rm by a more informative variant: I would like to see which files will be deleted, along with their size, and I would like this information to use the same coloring as ls. I built ...
4
votes
2answers
81 views

sudo rm -rf returns “cannot remove directory” on empty directory owned by root

I have a directory on my Debian system. The directory is: root@debian:/3/20150626# stat 00 File: `00' Size: 6 Blocks: 0 IO Block: 4096 directory Device: fe00h/65024d Inode: ...
0
votes
1answer
52 views

“find” function still print files I've already removed

I've removed some directories and files inside them using sudo rm and sudo rmdir, but when I execute sudo find /*/*/ng* the files I've previously deleted are still showing up, anybody know why and ...
3
votes
2answers
125 views

File deletion under special conditions, recursively if possible

I am looking for a unix command sequence, which is able to perform a quite complex, conditional deleting action. All files with the extensions "[NAME].cut" and "[NAME].cut.bak" shall be deleted, IF ...
2
votes
3answers
106 views

Delete several sequential file names, but ignore part of the first

Sometimes, my scripts get trapped in infinite loops. When the loop creates new files, things get messy. I currently have this file name format: Task.4883.store.log where 4883 is a counter. I ...
1
vote
1answer
141 views

delete multiple remote files with the FTP command

Right now we have a script that uses the FTP mget command to download all the files in a specific location. After after verifying the files have successfully downloaded we run a ftp delete command ...
5
votes
3answers
248 views

How does Linux format itself while running? [duplicate]

When you run sudo rm -rf --no-preserve-root / Your system will delete every file, one by one. However, this also includes running processes and the operating system itself, eventually deleting rm. ...
0
votes
1answer
65 views

How many files can rm delete at once? [duplicate]

One of my friends wanted to have more logs in the /var/log/ directory, and after some time of using the system, he tried to access the folder and list it, but instead he got the following error: ...
4
votes
2answers
331 views

Where is the trash can for root partition?

I use trash-put to trash files from command line. Recently, I had aliased my rm command to trash-put so that I don't accidentally delete something important. However, what happened now was that I ...
1
vote
2answers
49 views

How to remove all files in a directory except hidden ones?

I'm cleaning an output directory before I put things in it. I want to track the output directory in git with a .gitkeep file, but this keeps on getting deleted with my rm -rf "$OUT_DIR" line in a ...
1
vote
1answer
40 views

How to put “rm -i” in an iteration?

echo "$MOUNTPOINTLIST" | while read onelinefortouch; do touch "${onelinefortouch}testfileforwrite"; done echo "$MOUNTPOINTLIST" | while read onelineforrm; do rm -i "${onelineforrm}testfileforwrite"; ...
6
votes
5answers
916 views

Deleting files with spaces in their names

I am trying to delete all the files with a space in their names. I am using following command. But it is giving me an error Command : ls | egrep '. ' | xargs rm Here if I am using only ls | egrep '. ...
-1
votes
1answer
41 views

How to delete a file that starts with a -? [duplicate]

I accidentally created a file when I meant to pass an option. Now I have a file named: -myfile that I can not delete with rm -myfile $ touch hi > -myfile $ rm -myfile rm: invalid option -- 'm' ...
2
votes
1answer
54 views

What happens step by step when using “rm -rf directory”? [duplicate]

Let's assume that I have 150 GB of data in a directory and I have accidentally run this command for a directory. Suddenly I realised, I should not put "/" in the beginning of directory and I ...
0
votes
1answer
64 views

Remove files newer than X day and hour

I want to remove files, more specifically, symbolic links of /usr/include that are newer than 2 JUN 22:27 How can I do this?
2
votes
1answer
45 views

How to delete stubborn directory?

I'm having issues with dropbox so I'd like to uninstall and reinstall it. To do so I need to remove ~/.dropbox-dist but no matter what I do it won't budge. If I run ls -l I get: drwxr-xr-x 3 user ...
3
votes
1answer
56 views

Deleting ghost files with non-ASCII characters

I have some weird files and folders in my trash on Mac OS X. After I "empty" the trash, the files still remain. I attempted to manually delete the files: $ cd ...
3
votes
2answers
242 views

Why can't I delete this file as root?

I have directory exam with 2 files in it. I need to delete files but permission is denied. Even ![rm -rf][1] command can't delete these files. I logged in as a root user.
20
votes
4answers
2k views

How can I delete a file named “>”?

I was running a Python script that malfunctioned and used sudo to create a file named >. How can I get rid of this file? Of course, when I try sudo rm >, I get the error bash: syntax error ...
1
vote
2answers
93 views

Why can't root delete a file?

On a samba share, I have a .DS_Store file on a SMB network share that is causing havoc. Even as root, I can not delete or chmod it. -rwx------ 1 bob acme\Domain Users 6148 Apr 24 09:11 ...
2
votes
1answer
244 views

rm -rf: cannot remove `/opt/jetty': Directory not empty

I have a script using the following command to remove a folder: ssh -q root@hostname sh -c 'rm -rf /opt/jetty/' Most of the times it works fine, but occasionally I get this message: rm: cannot ...
0
votes
4answers
171 views

delete all .swp file using rm command

I am trying to find and delete all .swp files in my current directory. I was using below command: rm -i `find . | grep .swp$` But everytime it is giving me this error: rm: missing operand Try `rm ...
1
vote
1answer
329 views

Why can't I remove the empty directory with username www-data? [duplicate]

The test is a directory which contains nothing, an empty directory. root@localhost:~# ls -l /home drwxrwxrwx 2 www-data www-data 4096 Apr 26 17:50 test root@localhost:~# ls -l /home/test ...
0
votes
1answer
66 views

find all directories (except `encoded`) in the working dir then delete all of them

I am trying to test this scenario, I have these files /encoded encode <~~~ a bash script /dir1 /dir2 .../dir2-sub test.meta what I wish is, for find to search for all directories in our current ...
0
votes
1answer
186 views

Cannot (force) remove directory in Docker build

With this Dockerfile: FROM php:5.4-fpm RUN apt-get -qqy update \ && apt-get -qqy install git \ libcurl4-gnutls-dev \ libmcrypt-dev \ ...
2
votes
2answers
2k views

Delete files older than X days +

I have found the command to delete files older than 5 days in a folder find /path/to/files* -mtime +5 -exec rm {} \; But how do I also do this for subdirectories in that folder?
1
vote
2answers
179 views

Why doesn't “rm -rf ./” delete anything?

The command rm -rf ./ does not do anything in a directory full of sub directories and files. Why so? Isn't -r supposed to go recursive? To add more confusion, it even prints an error message ...
0
votes
1answer
77 views

tar unused files then delete them

I have folder with subfolders and sessions logs. I need some commands or script to tar this folder without usage files and then delete it. I have this construction, but I'm not sure if this leave ...
0
votes
1answer
52 views

If “rm dir -r” has removed just partial content of dir/dir1/, has it not removed anything in dir/dir2/? [duplicate]

If rm dir -r has removed just partial content of dir/dir1/ (and I cancelled rm), has it not removed anything in dir/dir2/ if dir/dir2/ still exists and contains something? My OS is Ubuntu 14.04 and ...
0
votes
0answers
24 views

Cancel removing a directory, and want to find out what have been removed

I was removing a directory by rm -r mydir and cancelled it in the middle. How can I find out what have been removed under the directory? Does remove a content of a directory change the timestamp of ...
1
vote
0answers
49 views

Why is rm -r the same as rm -R?

If you look in the rm man page you see that rm -r, rm -R, and rm --recursive are all the same. -r, -R, --recursive remove directories and their contents recursively When using options, I'm ...
4
votes
1answer
49 views

Recovering data written to file that moved

I have a Python daemon running on CentOS that opens a file at the beginning of a session, and keeps writing to it. A cronjob however, gzipped the file that was being written to, and so the file moved ...
1
vote
2answers
64 views

how to delete file that start with “-” [duplicate]

I try to delete this file on my solaris machine rm "-Insi" rm: illegal option -- I rm: illegal option -- n rm: illegal option -- s I also try this rm "\-Insi" -Insi: No such file or directory ...
4
votes
4answers
1k views

Why does `rm -f !(/var/www/wp)` leave files behind in /var/www?

Why does the rm -f !(/var/www/wp) command have no effect? I want to remove all the files in /var/www, except for the /var/www/wp directory, which should remain. root@born:~# ls /var/www ...
0
votes
2answers
71 views

How to delete the whole root with rm rf and shred together?

My task is simple: I need to able to delete the whole root which i can do with rm-rf ./* but the problem here is HFS recovery can get back the data since it is not actually deleted from disk if i ...
1
vote
0answers
118 views

rm: Directory resources is not empty

I'm getting this kind of error when i'm deleting file on my AIX machine. Getting same error for rmdir. venky-19:[/hm/dev/application/backup/ear/] # rm -rf resources rm: Directory ...
1
vote
1answer
335 views

Shell script `rm -r`: Redirect write-protected prompt and answer “n”

I have a few lines in a shell script whose function is to iterate through directories, match some names, and delete them. Some areas of the file system are write protected and I would like to leave ...
2
votes
2answers
137 views

remove the low version number of file

I have these files: atk-2.8.0-ia64-11.31.depot gtk+2-2.24.25-ia64-11.31.depot lzo-2.09-ia64-11.31.depot bash-4.3.030-ia64-11.31.depot gtk+3-3.6.5-ia64-11.31.depot ...
2
votes
3answers
94 views

Optimise a shell script / command to delete files

I'm running Magento and it doesn't clean up old session data, so I need to clean it up with a shell script / cronjob: 0,30 * * * * /usr/bin/find /var/www/magento/var/session -name 'sess_*' -type f ...
0
votes
2answers
361 views

Remove all files recursively without deleting directories

I want to "clean out" all of the files a directory including all files in subdirectories but I want to leave the subdirectories in place. My understanding of rm -r is that it will also delete the ...
1
vote
2answers
54 views

Delete all files by find

How to delete all files found by this command? find -type f -name "*-thumb.png"
0
votes
1answer
52 views

Remove a folder with the same name as an environment variable

I was messing around with a log4j properties file and accidently made a folder with the following text ${foo} however I also have an environment variable named foo that points to a folder so thus if I ...
1
vote
1answer
37 views

Why does the -v option with rm show entries with a backquote and a normal quote?

When I do rm -v on a set of files, I see the output list of files being deleted with a backquote and a regular quote, eg: rm -v rsl.out.0??? removed `rsl.out.0579' removed `rsl.out.0580' removed ...
5
votes
2answers
586 views

How to quote arguments with xargs

Suppose that I want to delete all files in a folder that are greater than 1 MB. $ find . -size +1M | xargs -0 rm This will not delete files that have space in their names. So I want it to quote all ...