rm is the 'remove' command.

learn more… | top users | synonyms

0
votes
0answers
32 views

Delete subfolder and keeping up parent folder

I need to delete folderx which are not accessed for seven days, easily I can do it with next: find /path/folder -type d -mtime +7 |xargs rm -rf The probelm is when I have subfolder marked for ...
4
votes
5answers
267 views

logic behind deleting files where user does not have right to write [duplicate]

When I create a file with no write permissions in my home directory: $ umask 777; touch testfile $ ls -ln testfile ---------- 1 1000 1000 0 2014-03-21 16:52 testfile $ ..then I'm still easily able ...
1
vote
3answers
124 views

Delete files with same name at the end of the file

Delete files with same name at the end of the file i have a lot of files in my folder and sub directories like ajax_hostel_room_master.php.php class_hostel_registration.php.php ...
7
votes
5answers
504 views

Is there a simple way to preview the files that rm will remove?

Is there a simple way to evaluate what a given rm command will do when you do not understand it (such as not recognizing how the flags, variables, etc. interact)? While ls helps catch problems in ...
1
vote
2answers
67 views

Free disk space from a JBoss log file which is still being written to

Is there any locking on the content, imposed by the process if at all the process is using the file. We host a JBoss app server on a RHEL 6.4 OS and due to the disk space constraints we have decided ...
1
vote
0answers
23 views

Most efficient way of purging of 10TB data from SAN? [duplicate]

I want to purge storage data from SAN which accumulates to 10 TB. The OS is linux. The storage is mounted as mount-points on a system for which it is visible I was recommended by a friend to use ...
0
votes
1answer
385 views

How do I delete a unfortunately named folder? [duplicate]

In an unfortunate series of events, I happened to create a folder named --bindir=. Thing is, I cannot cd to him because when I try to cd I get this message: bash: cd: --: invalid option cd: usage: cd ...
0
votes
2answers
39 views

Recursively delete all files with a given extension [duplicate]

I wan't to delete all *.o files in a directory and its sub-directories. However I get an error: sashoalm@aspire:~/.Workspace.OLD$ rm -r *.o rm: cannot remove `*.o': No such file or directory On the ...
2
votes
2answers
83 views

delete old log files except the last one (alphanumerically sorted)

I have a number of log files in the form: log.2014-02-19-10_24_22 I.e. log.YYYY-MM-DD-H24_MI_SS The date that's part of the log file's name is when the log file was first created. So at any given ...
3
votes
3answers
322 views

Delete files and directories by their names. No such file or directory

I need to delete all compiled data: directories called build, directories called obj, *.so files. I wrote a command find \( -name build -o -name obj -o -name *.so \) -exec rm -rf {} \; that ...
110
votes
5answers
20k views

I deleted /bin/rm. How do I recover it?

Just for fun, I thought I would use this command on my Raspberry PI running Raspbian: sudo rm -f /bin/rm I thought I could just reinstall coreutils: I was wrong! apt-get install --reinstall ...
-1
votes
4answers
58 views

Using 'find' to create text file, and later deleting files listed

I'm trying to use find to create a text file with the result. And then later be able to delete files, based on that list. I'm using find /volume1/video/ -iname "sample" to give me the results. How do ...
1
vote
0answers
26 views

How to recover deleted directories “/home/pi” [duplicate]

I just deleted my /home/pi directory while I was trying to remove the directory under /home/pi which was /home/pi/nmap. So, is there anyway to recover /home/pi directory as I have other important ...
1
vote
1answer
51 views

rm -f files starting with a digit

I've accidentally redirected the output of a CSV file to my directory. How can I rm only the files that start with a number, and leave the files that start with a letter intact? mymachine$ ls 71.24 ...
1
vote
1answer
46 views

rm -r * in unix [duplicate]

I am about to enter the command: rm -r * in a directory where I would like all files and directories (and their files) removed. My concern is that unix also has the ./ and the ../ directories. rm -r ...
2
votes
2answers
82 views

delete directory with special character in filename

I have these tricky directories that I can't figure out how to delete. If I run ls -ld * I get… drwxrwxr-x 7 user1 taskfmri 2048 Jan 22 15:26 857263 drwxrwx--- 4 user2 ...
4
votes
4answers
147 views

Keeping the number of files in the folder constant by deleting old files

I'm trying to create a script and run it in crontab every 5 min, so that the number of files in a folder always remain 50000. If there are more, I want the script to delete the old files. ...
1
vote
2answers
64 views

Keeping the latest two version and delete the remaining

I have a list of files (say xsl format below) in one directory. I want to keep the last two version of all files. (I can delete the remaing files) {A}_1.0.xsl {A}_2.0.xsl {A}_3.0.xsl {A}_4.1.xsl ...
2
votes
2answers
53 views

Process each line from text file and delete related files from disk

I used the find command to find several files and folders and output them to a text file like so: nohup find /oradba -name '*soapr*' 2>/dev/null >find_soapr_db40.txt & So instead of ...
3
votes
2answers
110 views

grep string from contents of file command then delete file

I have a peculiar problem I need help with. I have a large batch of .docx files where a certain number of them are junk. I know how to identify these files from the file command, as they contain the ...
0
votes
1answer
194 views

Delete all 'nohup.out' within a directory recursively

How can I delete all 'nohup.out' files within a directory recursively from my terminal? I'm using CentOS.
1
vote
3answers
56 views

Preventing deletion of system/shell aliased folders

Is there a way to prevent deletion of system/shell aliased folders? I want these commands to fail. My shell is bash. Such as: $rm -rf . $rm -rf .. $rm -rf ~ $rm -rf *
3
votes
3answers
275 views

How to delete 2 months back files in unix

Say I have below log files, AA_XX_20130719185428.log exec_xxx_cpb_20130712182453.log 13122013121327_AR_INC_DOBC_1.dprf.log 24122013_masterscript.LOG Date part contains both date and time. I want ...
4
votes
1answer
310 views

Why is rm slow?

I have been trying to use rsnapshot for making backups, but I'm finding it unusable. While it is able to diff a directory (50gb) and duplicate it (hardlinking every file) in a few minutes, and I can ...
5
votes
2answers
77 views

Delete files specified by the output of find: rm thinks argument list is too long.

When I run the following command, it gives me an error: $ rm -f `find /home/domain/imap/domain.com/*/Maildir -mtime +190 | grep -E '/cur/|/new/'` -bash: /bin/rm: Argument list too long How can I ...
1
vote
1answer
186 views

Does rm -rf * delete files recursively from the current directory or parent/root directory?

I wanted to delete files and folder recursively from a particular folder so I ran this command from that folder rm -rf * I assumed it would delete all files/directories under the current directory ...
-2
votes
3answers
473 views

How do I override rw-r--r— root/wheel for a all files in a directory?

I am trying to delete a directory on OS X. I do rm -r /path/dir but I keep getting many, many messages like this: override rw-r--r-- root/wheel for cron/migrate.php? I type y for one message, ...
7
votes
1answer
246 views

Can rm recursively remove empty directories?

In an old version of Unix, the rm command would delete directories if they were empty. From the Research Unix Eighth Edition man page for rm: "If an entry is a directory it is removed only if empty." ...
2
votes
2answers
128 views

Removed `rm` command in cygwin

Having the need to use a bash shell on a Windows computer (I'll spare you the details), I installed Cygwin, and a friend as a joke ran rm /usr/bin/rm on the terminal, and surprisingly nothing much ...
3
votes
2answers
52 views

Guess complete filename

I have some files with really long names lying around on my server and writing the complete names is kind of a pita so I'm asking if my Linux system (Debian 7) can guess the complete filename? I want ...
1
vote
3answers
106 views

AIX 'rm' command has no '-v' parameter for verbose output

AIX 'rm' command has no '-v' parameter for verbose output as stated by IBM's documentation. Normally I would run (in linux) rm -rfv <myfile> to (r)ecursively and (f)orcably delete files and ...
2
votes
3answers
97 views

Remove all files except for last file of each month

Consider a directory with MySQL backup files with timestamps as part of the filename: -rw-rw-r-- 1 ubuntu ubuntu 35856184 Nov 16 16:00 db_2013-11-16_1600.sql -rw-rw-r-- 1 ubuntu ubuntu 35856915 Nov ...
2
votes
2answers
44 views

Proper escape sequence for a non-standard file name [duplicate]

I'm trying to remove a file I made by mistake using --exclude with tar. I ended up making a tar file named --exclude=*.tar Now I want to delete it but I'd like to rename it first. How do I escape it ...
1
vote
3answers
283 views

Remove all *.mp4 and *.zip but some files

In one of my programs I call a bash command to remove all files in the directory, but some: bash -c shopt -s extglob shopt -s nullglob rm /path/to/directory/!("file1" | "file2") Which for what I ...
2
votes
2answers
3k views

How to recover files I deleted now by running rm *? [duplicate]

By mistake I ran rm * on the current directory where I created many c program files. I had been working on these since morning. Now I can't take out again the time that I spent since morning on ...
3
votes
1answer
131 views

How can there be a directory named `~`?

I was trying to test out this buggy/new tool to see how it works, and it prompted me to choose a directory to use for stuff I am doing. From the directory ~/Code/indep, I typed in ...
3
votes
2answers
109 views

What is a regular file?

$ rm foobar rm: remove regular file `foobar'? What does it mean for a file to be "regular" and why does rm treat such a file as a special case?
0
votes
1answer
80 views

rm -rf /home/ Recovery [duplicate]

OS :-Suse Linux Enterprise 12.0 File System :- ext3 I hit rm -rf /home/, immediately I did Contol+C so the command got canceled but until that time I lost ~9GB of data from this /home dir. I don't ...
0
votes
1answer
115 views

rm -rf on vhosts directory, what should I do?

I was tired and unfortunately I did: rm -rf * /var/www/vhosts repertory on my CentOS 6.3 running with Parallel Plesk. I lost many websites, but worst: I've lost chroot, default, fs and fs-passwd. ...
8
votes
1answer
222 views

Is `rm -rf` not atomic?

I've just caught a confusing error: rm: cannot remove `xxx/app/cache/prod': Directory not empty which was caused by the following command: rm -rf $cache_dir/* where $cache_dir is defined as ...
4
votes
5answers
841 views

Faster way to delete large number of files

I have a directory where lots of cached files are getting generated very quickly. Since these are very small files, it is consuming all my inodes very quickly. Currently I am running the following ...
1
vote
2answers
126 views

What's the idea behind rm not removing non-writable file by default?

What's the idea behind rm not removing non-writable file by default? Every time you want to remove a file that is non-writable file for current user but you have a write permission on directory get ...
0
votes
1answer
97 views

when is it safe to remove `/dev/.tmp-block-*` files

i'm currently experimenting with temporary lvm-snapshots (that is: create a snapshot of an LV, do something with the snapshot (e.g. run a backup), then destroy the snapshot. something along the lines: ...
0
votes
1answer
75 views

Proper way to delete contents of directory [duplicate]

What is the proper way to delete all the contents of a directory, without said directory? For example, I have the following directory structure: foo/ bar1/ bar2/ x.txt I want to delete ...
3
votes
2answers
1k views

Scripting `rm` and `rm -i`

I want to create a script that whenever there are more than three files being removed, it invokes rm -i by default. I know it will go in initialization files but can't seem to get it working. So far: ...
0
votes
0answers
8 views

Removing in interactive mode [duplicate]

I want to create a script that whenevr there are more than three files being removed, it invokes rm -i by default, i know it will go in initialization files but cant seem to get it working.
1
vote
1answer
453 views

mount.cifs not respecting file permissions in Ubuntu 12.04.2 LTS

I am attempting to mount a cifs drive in standard Ubuntu 12.04.2 LTS using the following line in /etc/fstab: //server-name/share-name /mnt/archive cifs ...
23
votes
1answer
894 views

Does 'rm .*' ever delete the parent directory?

The expression .* is expanded by bash to include the current and parent directories: $ ls -la total 2600 drwxrwxrwx 2 terdon terdon 2162688 Sep 10 16:22 . drwxr-xr-x 142 terdon terdon 491520 Sep ...
1
vote
3answers
446 views

How to delete directories based on `find` output?

I issue the following command to find the .svn directories: find . -name ".svn" That gives me the following results: ./toto/.svn ./toto/titi/.svn ./toto/tata/.svn How could I process all these ...
5
votes
3answers
147 views

What's the real point of the -f option on rm?

By reading the GNU coreutils man page for rm, one of the options is -f, which according to the manual, -f, --force ignore nonexistent files and arguments, never prompt Now, I made some ...