Ubuntu :: Find Log Files And Delete Them Based On Age?

Aug 18, 2011

I want find a bunch of log files and delete ones that are older than say 5 days. Ideally I would then like to add this my crontab to run once a day.

The log files are in /var/log and are owned by root. They have a standard naming convention which is [date]RootCronRsync-backupHOME.log An example file is 20100621RootCronRsync-backupHOME.log Trying to put together a bash script to do this I think I need something like

Code: find /var/log/ -name *RootCronRsync-backupHOME.log -mtime +5 -exec rm {} ; However if I try this without the -exec rm (ie to see if I can find the right files first) I get the following error find: paths must precede expression: 20090405RootCronRsync-backupHOME.log Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

View 8 Replies


ADVERTISEMENT

Ubuntu :: Find .zip Files And Then Delete Them?

Apr 13, 2011

I want to use the shell to find .zip files in my music directory and all sub directories and then delete only these files. The following will find the files I want to delete

Code:find /home/me/Music/ -name *.zip -lsWhat is the next step to delete *only* these files.Would it be a good idea to move them to another directory before doing the final rm - how would I do this

View 6 Replies View Related

General :: Finding Files Based On Date Without Using `find`?

Aug 11, 2011

I know find can do what I am looking for, but I am wondering if there is an alternative way to find files on the filesystem either created before/after a certain point, or at a certain time.

Typically I rely on updatedb & locate for most of my file searching needs. Issues with those tools, though, are that it only has directory and file names, and it only creates a database of local directories, not anything mounted via CIFS|NFS or via -o loop (eg, .iso images).

So if I need to find files created after yesterday across the entire system (local and remote filesystems), I am currently needing to use find.

What other tools, if any, would accomplish this in a similar fashion?

I have tried ls and grep, but that requires (in my attempts so far) multiple searches:

ls -lR | grep Aug | grep 10
ls -lR | grep Aug | grep 11

View 6 Replies View Related

Software :: Find And Delete String In Text Files?

Mar 6, 2010

I have a series of file names in a text file that I generated by running
Code:

bash-4.1# ls -alt *.txz | awk '{print $8}'
and then copy pasting the output. All of these file names have the version number
Quote:
-4.4.1-x86_64-1alien.txz

I just want a method to remove that version number from all the filenames so that I can then add all the packages without version numbers to a blacklist file.

I've tried kwrite and mousepad and both have a search feature and a replace feature but I haven't been able to just have the text removed successfully.

View 3 Replies View Related

General :: Find Duplicate Files And Delete All Except Most Recent Version

Aug 17, 2010

I have a directory containing a ton of photos, some of which are duplicates but just with different names. Is there any way in linux to find all the duplicates and remove all of them except the most recent version? I know on Windows there are utilities that will do this through a GUI, but I'm using Linux through the CLI only.

View 6 Replies View Related

Ubuntu :: Rsync --delete Doesn't Delete Superflous Files

Sep 25, 2010

I am trying to use an old box as backup server. I have tried a couple of possibilities along the lines of:

Quote:

rsync -a --delete --progress --log-file=/home/$USER/info.txt -e ssh /home /etc root@192.168.0.106:/mnt/back

The problem is it does not delete files that has been removed from my local system?
I run the command as root on the local system.

(I realize I should properly not ssh into the server as the server's root but I'm having trouble with the permissions and I want to make sure everything else works before messing around with it)

View 2 Replies View Related

General :: Delete Old Directories Based On Dates In It's Dirnames?

Jul 13, 2011

I have tried to find the solution for my problem on this site and other sites but haven't found a good enough answer yet. Maybe some of you can help me out here?What i need is a script (bash preferrably) that can delete directories based on a date in its dirname.For example.I have a bunch of directories that is named

data-20110623/
data-20110624/
data-20110625/

[code]...

View 5 Replies View Related

General :: Delete Rows Based On Values In A Column Using Sed?

Jan 18, 2011

I have a lot of files with thousands of rows and usually two columns of data. Column 1 is a coordinate, column 2 is a score. I want to delete rows that have a value in column 2 over, in this case, 50.

For example, here's a clip from a file:

2999898 39
2999899 40.9
2999900 42.7
2999901 44.7
2999902 46.7
2999903 48.9
2999904 51.1
2999905 53.3
2999906 55.7

I want the output to be this:

2999904 51.1
2999905 53.3
2999906 55.7

I know how to use sed for very basic things like deleting rows or ranges of rows but I can't figure out this ostensibly easy command.

View 6 Replies View Related

Ubuntu :: Can Delete These 'un-delete-able' Files In Trash?

Nov 1, 2010

I just can't stand knowing that there's a slight problem with my PC.I have roughly 12.5 Gigs of files, mostly movies that are multiple clones of a particular movie (which was an entirely different problem altogether) and I CANNOT DELETE THESE THINGS! There has to be a simple way to do it from terminal, problem is, I can't seem to find the trash directory in terminal.

View 3 Replies View Related

Programming :: Sort Files In Directories Based On Files Date

Sep 8, 2009

I need a script that will take all the files in a given directory and create new monthly sub-directories and sort all the files based on the creation date into the appropriate directory.For example, all files created between 01/01/09 and 01/31/09 will be placed in 'JAN-2009'

View 5 Replies View Related

Ubuntu :: Permissions For My Home Directory Were Accidentally Changed From 'access Files' To 'create And Delete Files?

Nov 25, 2010

the permissions for my home directory were accidentally changed from 'access files' to 'create and delete files', and I changed them back, but ever since then I am not able to change any preferences/settings at all. power management, themes, panels, emerald, anything. my user account is supposed to be the administrator, and all the user privliges are checked. how to get control of my computer back?

View 9 Replies View Related

General :: How To Find Out What Your Distro Is Based On

Nov 28, 2010

I have been using Linux for quite a while and have gotten pretty good at it, but recently I started using Backtrack in a VM and realized I have no idea what it is based on. Then I got to thinking I have no idea what that even means. For example, OSX is based on Darwin right, but what does that mean? Ubuntu is another that is based on Debian, but I don't know what that means.

The reason I'm asking is because in order to get my screen resolution and networking right in Backtrack I need to know what it is based on so I can download the proper packages to install the VirtualBox guest additions, and I have no idea. Is there a way to get this information from the operating system? Maybe uname -a is giving me the info and I just don't know where to look in the output?

View 7 Replies View Related

Software :: Find Out IP Address Based On MAC

Nov 17, 2010

Using linux, how can I find out the IP address of a computer based on its MAC address?

View 1 Replies View Related

General :: Wget / Delete Files / Getting Bunch Of Filefolders, But No Files, Ex."cccamp07-de-1845?

Oct 11, 2010

I am trying to dl the files located here: http://good.net/dl/bd/CCCamp-2007/video/m4v/ using wget.

Now when I use the command wget -r -A .m4v http://good.net/dl/bd/CCCamp-2007/video/m4v/

I get the just a bunch of filefolders, but no files, ex."cccamp07-de-1845-Freifunk_und_Recht.m4v" but its a folder.

View 4 Replies View Related

General :: Possible To Delete All The Files Including System Files As Root?

Sep 21, 2010

If I am logged in as root in a linux system and I run command rm -rf on / folder, should it remove all the files? also the kernel?

View 4 Replies View Related

Fedora :: Terminal-based Programs Won't Run Because It Can't Find Libtermcap

May 30, 2010

I installed Fedora 12 on a new machine (Intel Core i3) and one of my terminal-based programs won't run because it can't find libtermcap. The specific error is

Quote:

error while loading shared libraries: libtermcap.so.2: cannot open shared object file: No such file or directory

I seem to have this problem every other time I install a new Fedora. I tried a few things with old libtermcap files from other machines, and I tried looking around the YUM repository, but nothing seemed to work.

What's the proper way to get the libtermcap libraries for a Fedora 12 machine on an iCore i3?

View 1 Replies View Related

General :: Download Centos Based Rpm But Only Find Redhat Rpm's On The Net?

May 26, 2010

my problem is sinple, I want to download centos based rpm but i can only find redhat rpm's on the net. can I use redhat rpms for centos?

View 2 Replies View Related

Ubuntu :: Using Sed Or Awk To Find And Delete Lines In A File?

Dec 21, 2010

I have a bunch of text files, all of them have a .txt extension. They are all located in subfolders of the /MyTextFiles folder (but could be anywhere, no idea what depth). If any line in any of the text files has the word "hello" I want to delete that entire line. I know sed and awk are made for this problem but I can't seem to get the syntax correct.

View 1 Replies View Related

Programming :: Find A Dir And Delete It?

Apr 19, 2010

I've got this line find . -type d -name 'elements' -exec rm -rf {} ; put together to find and delete all directories named elements and their contents.

It does work but whenever I run it I get the error/warning
Code: find: `./dir3/elements': No such file or directory
find: `./dir6/elements': No such file or directory

[code]....

View 4 Replies View Related

Software :: Join 2 Text Files Based On First Number Present In Every Line Of The 2 Text Files?

Jan 22, 2010

I have 2 text files : file1.txt and file2.txt

cat file1.txt

15 this is a sentence containing various words and spaces
34 this is a another sentence containing various words and spaces

cat file2.txt

2 this is sentence1file2
6 this is sentence2file2
54 this is sentence3file2

I would like to join these 2 files. The result should look as follows :

cat joinedfile.txt

2 this is sentence1file2
6 this is sentence2file2
15 this is a sentence containing various words and spaces
34 this is a another sentence containing various words and spaces
54 this is sentence3file2

==> so the joined file must be sorted on the first number. Any ideas how this can be achieved ?

View 4 Replies View Related

General :: Dualshock 3 With Ubuntu - Can't Find A Delete Button

Jun 4, 2010

My bad it was the game not the controller I figured it out. I can't find a delete button though..........

View 1 Replies View Related

Ubuntu :: Sorting Files Based On Filename?

Nov 2, 2010

I'm currently trying to organize a media server so that things will be in some kind of logical order rather than the current setup of dumping everything of a certain content type into a single folder. However, the size and diversity of content within these disorganized folders precludes me doing things manually. Does anyone know of a program or script that could sort the files into folders based on part of a filename

View 7 Replies View Related

Ubuntu :: How To Find / Delete Unused Hidden Config Folders

Oct 12, 2010

I recently moved to a new machine, and I copied my entire home folder across. This included lots of hidden (starting with '.') folders, and in many cases they are config folders for packages which I have not installed on the new machine. They are taking up space, so I would like to delete them, but to go through manually and figure out which ones I need would be very laborious. Is there a way to find, and perhaps delete, config folders for packages that are not installed?

View 2 Replies View Related

OpenSUSE :: Find Add/delete Software In Yast

Oct 31, 2010

Where can I find add/delete software in Yast. When I use Gnome I see this entry and on KDE 4.4 that entry seems to be gone.

View 3 Replies View Related

General :: Find And Delete A File Using A Code?

Apr 27, 2011

I am trying to find and delete a file using this Code: find . -type f -name ph2964781400100954291.jpg -exec rm -f {} ; It does not work, I think because by default on my distro rm is iterative.

View 2 Replies View Related

Software :: Package To Find And Delete Duplicates?

Aug 2, 2010

I have about 1TB of data to sort out and need a good GUI package to find and safely delete the duplicate files. I am running Ubuntu 10.04 amd_64. Would appriciate any thoughts on how to get it done.

View 8 Replies View Related

Programming :: Sed: Find Pattern And Delete 5 Lines After It?

Mar 23, 2010

I am trying to edit a print file.

For every occurence of the ^L form feed character I need to remove 5 blank lines after it but still keep the ^L.

I am a rare user of sed and am ok with the basics but am struggling with this.

View 4 Replies View Related

Ubuntu :: Sort Files Into Folders Based On Extension?

Sep 16, 2010

I recovered some 60,000 files with PhotoRec and need a script to sort them into individual folders based on extension. I was able to do this once before but cannot find the script again (sad thing is that I probably saved it on another HD that I'm having partition issues with, but that's another story....).I found this script:

Code:

#!/bin/dash
mkdir "$1"
for file in *.$1; do
mv "$file" "$1"
done

While it does work, I am not looking forward to going through all 132 folders and typing in each extension. The last time I did it, the folder was automatically created based on the extension(s) found.

View 6 Replies View Related

Ubuntu :: Joining Relevant MP3 Files Based On Paths?

Oct 24, 2010

I have a bunch of MP3 files and I have their paths grouped in a text file. Is it possible to join the relevant MP3 files based on the paths in the text file losslessly?

View 2 Replies View Related

Programming :: Separate Out Files Based On Name?

Apr 1, 2011

I have a folder named Pictures that contains a bunch of .jpg files. My problem is that they all have randomly numbered names, then there is a duplicate of the file that is random numbers then the letter a right before the .jpg.for example, there would be 123.jpg and 123a.jpg, where 123a.jpg is just a resized version of 123. What i'd like to do but have NO clue how to, is to have a script or something go through my Pictures folder, then copy the ones that end in a.jpg to a folder called Resized, and ones that dont have that to a folder called Originals. That way my Pictures folder will be in tact, and i'll have copies of them all separated out.I have to do this all through the CLI on a machine, maybe I dont even need a script and can just do it with a slick command?

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved