rm's questions - English 1answer

567 rm questions.

Make `rm` move to trash

7 answers, 20.449 views shell rm
Is there a Linux script / application which, instead of deleting files, moves them to a special “trash” location? I’d like this as a replacement for rm (maybe even aliasing the latter; there are pros ...

Can you please check this command? It's deleting the files and the current directory itself. Script is run via cron. Directories: /log/dir/ /log/dir/tmp/ Commands in script: find /log/dir/ -mtime +...

I've a bash file on my project root with this line $ ls | grep -P '^some_pattern_matching_regex_goeshere.txt$' | xargs rm -f The above line removes all the .txt files from the project root but when ...

I want to find some files based on some pattern in their paths and then I want to keep only the 3 latest files of that pattern and the others I want to delete.

I'm using CentOS 7. In a specific directory, I want to delete all the "*.log" files except the newest one. I tried this [rails@server ~]$ ls -t ~/.forever | tail -n +2 | xargs rm -- rm: cannot ...

I want to remove files that have not the string '999' (without the '') in their name. I have tried: grep -vlr 999 . | xargs -0 rm -f -- find . -print0 | grep --null-data -v 999 | xargs -0 rm -- But ...

We have a Kafka production machine on Red Hat Enterprise Linux. How can we remove all the files under /var/kafka/kafka-logs that end with .index? How can we move all the files that end with .index ...

rm -rf /some/path/* deletes all non-hidden files in that dir (and subdirs). rm -rf /some/path/.* deletes all hidden files in that dir (but not subdirs) and also gives the following error/warning: rm:...

In bash (and over ssh) running rm FILENAME gives the error: rm: cannot remove 'FILENAME': Disk quota exceeded. I've seen the other posts (and everyting down the first page of google) on this topic and ...

I got this weird error when I try to delete some file. And the filename doesn't contain any specific characters. Does anyone know why ? It is centos [root@sandbox ~]# rm -rf /var/log/zookeeper rm: ...

I want to delete all the files in a folder which are not created today. I know how to get the list of files which are created today using find . -type f -mtime -1 But, I am not getting how to get ...

I have a directory with several duplicate files, created by a program. The duplicates have the same name (except for a number), but not all files with the same name are duplicates. What's a simple ...

I need a command that deletes all files, folders and sub-folders that were not updated longer than 31 days. I tried this one find . -mindepth 1 -mtime +31 -exec rm -rf "{}" \; But if I have ...

giving grep output to rm

4 answers, 44.459 views bash grep rm
I'm trying to pipe grep output to rm, but it outputs useless stuff. Is any switch required for rm? Or can rm can be provided a regexp directly? ls | grep '^\[Daruchini'| rm rm: missing operand Try `...

This command: rm -rf "$HOME/.quicklock/locks/"* does seem to remove files or folders in the locks directory, which start with "." how can I remove those files too? Any other filenames that would ...

On my Linux Mint 18.3 installation I had troubles with my locale setting which caused the generation of a folder that has invalid encoding in its name. I would now like to delete said folder but I ...

I'm looking for a solution to be used as a response to "rm: remove write-protected regular file [x] ?" I was thinking of issuing a character followed by carriage return for several amount of times, ...

How to delete different empty directories from current directory using rmdir ?

I have a folder on my Mac called "␀␀␀␀HFS+ Private Data". I'm trying to delete it but it contains a bunch of odd characters that are choking unlink, rm and mv, making it difficult to remove it and ...

I am short on storage, so I tried to delete files, but I couldn't. It just gave me the following message: rm: cannot remove . ~ : Permission denied In my case, I've accessed as root, and every file ...

I made a symlink to a directory like this: ln -s /some/directory symlink Now I'd like to remove the symlink: rm symlink/ This doesn't work. The error message is: rm: cannot remove 'symlink/': Is ...

Recently I needed to delete a large number of files (over 1 million) and I read that doing: rsync -av --delete `mktemp -d`/ ~/source && rmdir ~/source Was one of the most optimized ways to ...

I have the following entries in a .gitignore file and I want to remove them. The reason why is because these files are temporary-junk files created during a TeX compilation and I want to be able to ...

I have 1 folder with image .jpg file, and I'm sure that folder image older than 5 years. Now I must delete image older than 3 year. I know i can find it with this find /path/to/files* -mtime +1095 ...

How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory: tohru:~ $ ls -l total 8 -rw-r--r-- 1 me ...

I usually delete directories by using rm: rm -r myDir However I am aware of another command, rmdir, which seems to do the job just as well: rmdir myDir What is the difference between these two ...

I am doing a bash script to create a back-up of my mysql databases. Actually, I would like to delete the old ones. So, I create my script with variable for maintability. The whole script is actually ...

I want to restrict "rm" command to user who have a sudo access. example: bob ALL=(ALL) NOPASSWD:ALL I have given SSH Access to"bob". i want to restrict "bob" to run "rm" command. Even though if ...

working on a server, operating system is SLES 11.4 x86-64. There are many files, and folders, under the /tmp directory. As root, I cannot remove anything under /tmp. Such as rm -f sort5BtEdh or rm /...

I have some output that is formatted like so: foo: /some/long/path_with_underscores-and-hyphens/andnumbers1.ext exists in filesystem foo: /another/one.ext exists in filesystem bar: /another/path/and/...

We were having a discussion about this today and Google wasn't helpful. One argument was the rm -rf *.* would corrupt your filesystem while rm -rf / would not do this.

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 ...

I'm still learning the bash shell. I want to recursively find and remove svn files within the child directories of a given folder. I made the mistake of checking out instead of just cloning, so I'm ...

I am using SuperPutty on Windows 10 to connect to the recently Upgraded RHEL server (from 6.X to 7.3 Maipo). One of my friends is getting strange â character in the output of the rm command after ...

Using rm -rf LargeDirectory to delete a large directory can take a large amount of time to complete depending on the size of the directory. Is it possible to get a status update or somehow monitor ...

removing a directory

1 answers, 39 views linux rm
I'm trying to remove a directory called cc by running the command rm -rf cc, but it has trouble removing a file inside the directory. I get the following error: rm: cannot remove 'boy.mp4' : Input/...

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?

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 authorize....

I have a script running on the 1st of each month. On this script I want to delete all files modified before the first of the previous month. For instance. The script will run on the 1st of March. I ...

Missing operands - rm command

1 answers, 198 views bash rm
In the below code, #!/bin/bash sDir=/a/b/c dDir=/d/e/f rDir="$dDir/recent" shopt -s nullglob : rm $rDir/$deviceName* : problem line rm $rDir/$deviceName* shows missing operands without echo ...

If you create an executable file with the following contents, and run it, it will delete itself. How does this work? #!/bin/rm

how to remove files that could be with lower/upper case for example, the file_name could be: STOCK.Repo or Stock.REPO or stOCK.repo or stock.repo ... etc I would run: rm -f $file_name the ...

this is simple CLI to remove couple file on remote machine ssh 182.2.34.1 "rm -f /etc/yum.repos.d/repo.1 master.er top.fg REPO.l" but only repo.1 file was deleted what is wrong with my syntax

I use Bash 4.3.48(1) and I ran the following command pattern on a testing VPS machine: rm -rf ${drt}/${pma}* This command deleted the entire operating system (Ubuntu). That was evident by executing ...

bash rotation script

2 answers, 90 views linux find backup rm
I have a directory structure as follows: backup-2018-01-12 backup-2018-01-13 backup-2018-01-14 backup-2018-01-15 backup-2018-01-16 backup-2018-01-17 backup-2018-01-18 backup-2018-01-19 backup-2018-01-...

With the command: ls -la * I can list all my symbolic links. How can I remove all symbolic links which are linked to a special folder? For example: In my directory usr/local/bin I have the ...

On my 3 TB external hard drive, I have a 2.7 TB directory containing relatively small files. I would like to compress this 2.7 TB directory and remove it to keep only the compressed version. The issue ...

What command do I have to use to delete all directories that begin with "graphene-80" What can I add to the "rm" command as option?

Inspired by this post, Do we get more disk space when we call rm insert_filename? The linked UNIX stackexchange post says: "the file gets unlinked. The data is still sitting there on disk, but the ...

I ran rm -rf on /var/cache/lxc, not realizing it was full of symlinks. I've lost a bunch of files, including most of /dev. I have a mlocate.db from 16 hours ago. How do I compare the list of files ...

Related tags

Hot questions

Language

Popular Tags