LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices



Old

Removing files with find, and LVM snapshots

Posted 04-24-2012 at 12:21 PM by sag47
Tags find, lvm, snapshot

Take an LVM snapshot using a loopback device
Create the snapshot
Take a look at the devices in your volume group. First there needs to be sufficient space in the volume group for a snapshot to occur. Check this by typing: vgdisplay and checking for Free PE / Size
Code:
vgdisplay -v
Create a loopback device to use for the snapshot. My volume group is named vg_echo360. I want my snapshot to be 9.9GB in size so I'm creating a loopback device which is 10GB in size....
Senior Member
Posted in Uncategorized
Views 1024 Comments 0 sag47 is offline
Old

Recursively generate MD5 checksums

Posted 10-26-2011 at 10:53 AM by Garda
Tags find, md5, md5sum, xargs

I wanted to generate MD5 checksums of a whole bunch of files in a directory. It turns out that this is not as straightforward as it should be. IMO it should be completed with: md5sum -br *

Unfortunately it was not as straightforward. I found this blog entry after searching for a while and adapted this to what I needed. To generate checksums, I used the following:

Code:
find . -type f -print0 | xargs -0 md5sum -b
(Note: for the above to work, "cd"...
Member
Posted in Uncategorized
Views 2920 Comments 0 Garda is offline
Old

Simulate -print0 with ls

Posted 09-07-2011 at 04:39 AM by sag47
Tags find

Recently I wanted to manipulate files only in the current directory (not sub-directories). I usually use the following combination...

Code:
find . -type f -print0 | xargs -0 somecommand
The only problem I had with that was it ran through all sub-directories as well. Then I remembered the -m switch for ls and decided to depend on my good old friend sed.

Code:
ls -m | sed 's/, /\x0/g' | xargs -0 somecommand
Though I guess it would be better to do it...
Senior Member
Posted in Uncategorized
Views 1637 Comments 0 sag47 is offline
Old

batch resize images using find, xargs and convert

Posted 02-20-2011 at 05:30 PM by dr_agon

applies to: linux, find, xargs, convert, image processing

'convert' command, which is a part of ImageMagick package can be used for image resizing, but it lacks ability to process multiple files (in version of ImageMagick 6.5.7-8 2010-12-02). Instead of writing a shell script you can use find and xargs commands to collect filenames and invoke convert with one filename at a time, like this:

Code:
find -iname "*.jpg" -printf "%f\0" \
 | xargs -0 -I {} convert
...
Member
Posted in Uncategorized
Views 3730 Comments 0 dr_agon is offline
Old

Inode and its corresponding filename

Posted 07-21-2009 at 09:58 AM by Mr. ameya sathe (Tantra Yantra Swatantrya)

We refer to a file by its name. Computer refer to the file by its inode numbers. For every filesystem; there is an inode table. This table consists of Inode numbers & its correspondingmetadata. On the contrary; the mapping of filenames to inode numbers is stored in the directory containing the file.
To display the inode number of a file; say hindu one must issue the command
Code:
ls -i hindu
To display the total number of inode numbers in the filesystem ; you must issue the command...
Member
Views 4620 Comments 0 Mr. ameya sathe is offline

  



All times are GMT -5. The time now is 05:53 PM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration