rm is the command to remove files

learn more… | top users | synonyms

2
votes
3answers
71 views

How to remove file with mv command?

I started to study Solaris in my university. Teacher told me to remove a file with mv command. I tried to move a file to /dev/null. But that did not work. How can I remove file with mv command?
1
vote
0answers
23 views

Command that can find files that are not referenced by other files and then delete them

I was wondering if anyone knew how I could go about writing a grep command that recursively finds files that are not being referenced/used in a specific file and/or a directory of files, and then ...
0
votes
1answer
25 views

mount command over existing drive, then deleted

So I had a directory sitting on /dev/sdb1 I umounted the drive, moved the backup to sdc1 and restarted the server, still can't see the files...
2
votes
4answers
185 views

Remove file with ` in name

At some point I created a file with: ` in it. How do I remove it? ls -la returns: -rw-rw-r-- 1 ec2-user ec2-user 0 Sep 25 23:01 `which
20
votes
2answers
1k views

How does rm -r go about recursively removing? In what order?

Is there some order of operations to rm? I performed rm on a large directory and am curious where I should look to see what might have been deleted. Does rm work on files first, then directories? Or ...
0
votes
3answers
77 views

Unable to delete a file without permissions etc

I have a file in Windows XP left over after deleting Google Chrome. Its location is C:\Documents and Settings\Admin\Local Settings\Application Data\Google\Chrome\User Data\Default\old_Cache_000 The ...
0
votes
1answer
69 views

How do I delete directory and file, if .picasa.ini is the only file in the directory?

I want to start from a root directory and recurse through the tree. I want to delete the directory and file if there is only one file in the directory called .picasa.ini It seems like the "find" ...
29
votes
2answers
1k views

Why did powering down my machine after a bad `rm` save my files?

Classical situation: I ran a bad rm and realized immediately afterwards that I had removed the wrong files. (Nothing critical and I had tolerably recent backups, but still annoying.) Knowing that ...
0
votes
1answer
84 views

Accidentally rm -r the wrong etc folder… Help? [duplicate]

Well as you can see from the title I managed to accidentally rm -r the wrong etc file in Ubuntu 14.0.4 Desktop. I also decided I would set up encryption on my home folder (Another mistake). Is there ...
-2
votes
1answer
53 views

Delete empty directories without find

I want to delete empty directories without using find command like the following: Instead of find . -empty -type d -delete use if [ "$(ls -d *)" ]; then echo "Not Empty" else echo "Delete" fi ...
1
vote
2answers
90 views

Delete old files but keep one each week/month/year

I have a folder with log-files each ~10 minutes: alfred_140810-190001.json alfred_140810-191001.json alfred_140810-192002.json alfred_140810-193001.json alfred_140810-194001.json ...
-1
votes
1answer
109 views

What does /bin/rm -f <file> do in Unix?

I came across a line and had no idea what it does. I have also checked Google, but still no luck. $ /bin/rm -f fslvbm2a There is no output on the screen.
1
vote
3answers
67 views

How do I delete a folder but not the contents?

My directory (in Linux) looks like com/com/{various,files} where com and com are folders of the same name and the second com holds the various files. I want the first com removed, but the second and ...
0
votes
0answers
45 views

How to remove files except a list with names files [duplicate]

I need delete some .desktop files in various directories and a text file with a list of file names. I want to delete all these .desktop files except for those listed in my text file). Example $ ls ...
12
votes
2answers
1k views

What is the difference between 'rm' and 'unlink'?

Assuming you know the target is a symbolic link and not a file, is there any difference between using rm and unlink to remove the link?
7
votes
1answer
126 views

Why are rmdir and unlink two separate system calls?

Here's something that kept me wondering for a while: [15:40:50][/tmp]$ mkdir a [15:40:52][/tmp]$ strace rmdir a execve("/usr/bin/rmdir", ["rmdir", "a"], [/* 78 vars */]) = 0 brk(0) ...
-2
votes
2answers
66 views

Getting a propmt when deleteing a non-directory

I want to get a prompt when attempting to delete a non-empty directory with rmdir. Is this possible?
3
votes
2answers
177 views

Deleted /tmp accidently

Accidently, I ran sudo rm -r /tmp, is that a problem ? I recreated it using sudo mkdir /tmp, does that fix the problem ? After I recreated the directory, In the places section in the sidebar in ...
3
votes
2answers
80 views

Cannot delete File on Fedora

I have a file with following permission: -rwSr-s---. 1 1634630331 1818884080 118784 Jun 29 1970 DailyUpdateClass.class If I try to delete this file with root login, I get error. rm: cannot remove ...
0
votes
1answer
83 views

Delete ghost files with special characters

I have read several ways to delete files with special characters, but none of them works for me in one special folder in my cache system. I have no idea how the files got there, and why they turned ...
0
votes
1answer
64 views

How do I delete a file in a read-only directory?

I've got a directory and a file in it, with the directory marked as read-only: $ mkdir directoryname $ touch directoryname/filename $ chmod a-w directoryname I cannot delete the file, even if pass ...
3
votes
5answers
80 views

How to find and empty some directories

I'd like to find and delete the contents while leaving the directories themselves intact. The following find /data1 -name MyTargetDir -type d -exec rm -rv {} \; and find /data1 -name ...
29
votes
8answers
3k views

How to delete this undeletable directory?

I untarred a corrupt tar file, and managed to end up with some directory that I can not delete, If I try to delete it, it seems like it can not be found, but ls shows it's present, both with bash and ...
3
votes
2answers
165 views

fdupes - delete files after comparing two directories

I'm currently trying to solve an issue using fdupes. I'd like to compare two folders with each other, and afterwards delete all duplicate files within one of these directories. Example: Files are ...
1
vote
3answers
169 views

Removing a directory that has no files in it

I recently created a username and a group called gamesForAdmin. Since then I deleted it and the folder I made for it is still there: drwxr-xr-x 5 root root 4096 Jul 4 11:28 . drwxr-xr-x ...
2
votes
2answers
119 views

Remove files and directories even if not empty, except some directories

I am trying to remove all contents of a directory with some exclusions. I'm currently using this: find . -type f | grep -vZf ../../exclude.file | xargs rm -rf The exclude.file contains: *log* ...
1
vote
2answers
342 views

du cannot access file - No such file or directory error

I have lots of subfolders inside a particular folder which in turn contains lots of smaller files. They are created programmatically and so I do not know how many of them are there inside. I decided ...
3
votes
1answer
50 views

Is there a single '03 registered UNIX which can't do rm — -foo at this point?

I'm trying to dispel this uncertainty I have about the use of the double-dash (two hyphens, --) as an end of options delimiter(as opposed to a long option prefix). It's possible some confusion arose ...
5
votes
1answer
354 views

Give user permission to rm without password or sudo

I'm trying to give the ubuntu user on my machine the ability to rm folders and files (mainly in the /www/ folder) without the need to invoke a password or the need to use sudo. I've been following ...
4
votes
2answers
1k views

“no such file or directory” message when deleting a file that exists on NTFS

I have a directory with images. Suddenly I found out that there's a new image with a new name. The image content is similar to another image in another directory but with a different name. I didn't ...
1
vote
1answer
67 views

Minimum file permissions to delete a file [duplicate]

To delete a file in Linux: What minimal permissions do we need to set on it? What minimal permissions do we need to set on its parent directory?
3
votes
1answer
5k views

Cron job to delete files older than 3 days

I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory /a/b/c/1 & /a/b/c/2 & /a/b/c/3) Can this be done ...
2
votes
1answer
268 views

Double rm verification in zsh

When I do a rm * in zsh, I get something like this: 2014-06-08 10:14:23 $ rm * zsh: sure you want to delete all the files in /home/assay/assay/log [yn]? y rm: remove regular file `development.log'? y ...
1
vote
3answers
144 views

How to remove all FIFO files with a shell command

I can't find a shell command to remove all the FIFO files inside a directory. In fact, for the removal of directories, the rm command offers the options -d, --dir, but for FIFOs it offers no option. ...
3
votes
1answer
5k views

Does Linux allow executing the “rm -rf / ” command? [closed]

We all know that we have to use the -rf option of rm command carefully. What I wonder is does Linux allow executing this command: rm -rf /? If so, why? This command could have disastrous ...
1
vote
1answer
86 views

Prevent active file removal on an NFS filesystem

I clear my logs using following script - find "." -mtime 1 -type f -print0 | xargs -0 rm -rf But it deletes the active files also and creates .nfsā€¦ files instead. Is there any way to prevent ...
2
votes
0answers
117 views

Why is my inotifywait loop exiting after removing some subdirectories?

i have the following bash script: #!/bin/sh dir1=/source/dir/path/ while inotifywait -qqre modify "$dir1"; do rm -r /destination/dir/path find /source/dir/path/ -name .svn -exec rm -rf '{}' \; ...
2
votes
1answer
1k views

Delete files/ folders with .nfs files

A lot of time when I delete a folder, it says cannot be deleted because of .nfs files Error - Device or resource busy How can I delete a folder ignoring these errors ( is there any flag in rm ...
4
votes
1answer
142 views

Is there a UNIX command to list all recently removed files from a system

Accidentally a rm -rf command was launched to my root directory instead of current directory. I stopped file removing by Ctrl+C but some files has already been removed. Is there a LINUX command to ...
0
votes
1answer
132 views

dd and rm -r commands

For me, the following commands do exactly the same thing: dd if=/dev/zero of=/dev/sd1 dd if=/dev/null of=/dev/sd1 rm -r /dev/sd1/* meaning, the result of their application is the same. Or least, ...
0
votes
0answers
61 views

named.run file deleted but data left on disk?

Today I had a name-server stop resolving DNS due to the /var directory being full from the named.run cache build up. I tried removing all the files using: rm -rf name* However, although running ls ...
0
votes
1answer
66 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
817 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
315 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 ...
8
votes
5answers
653 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
320 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
36 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
406 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 ...
1
vote
2answers
2k 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
2k 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 ...