What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags





Btrfs: Find file names with checksum errors

Terminal - Btrfs: Find file names with checksum errors
dmesg | grep -Po 'csum failed ino\S* \d+' | sort | uniq | xargs -n 3 find / -inum 2> /dev/null
2014-03-20 06:27:15
User: Sepero
Functions: dmesg find grep sort uniq xargs
Btrfs: Find file names with checksum errors

Btrfs reports the inode numbers of files with failed checksums. Use `find` to lookup the file names of those inodes.


There is 1 alternative - vote for the best!

Terminal - Alternatives
dmesg | grep -Po 'csum failed ino\S* \d+' | awk '{print $4}' | sort -u | xargs -n 1 find / -inum 2> /dev/null
2014-03-22 12:22:46
User: Sepero
Functions: awk dmesg find grep sort xargs
Tags: find inode btrfs

Btrfs reports the inode numbers of files with failed checksums. Use `find` to lookup the file names of those inodes. The files may need to be deleted and replaced with backups.

grep "btrfs: checksum error at logical" /var/log/messages | egrep -o "[^ ]+$" | tr -d ')' | sort | uniq
2014-07-01 08:15:26
User: jcoll
Functions: egrep grep sort tr

Filter entries in OpenSuse /var/log/messages like:

timestamp servername kernel: [83242.108090] btrfs: checksum error at logical 1592344576 on dev /dev/sda5, sector 5223584, root 5, inode 2652, offset 282624, length 4096, links 1 (path: log/warn)

echo "btrfs checksum error(s) on: " && grep "btrfs: checksum error at logical" /var/log/messages | sed -e 's/^.*\( dev .*\)\(, sector.*\)\(path\: .*\))/\t\1, \3/' | sort | uniq
2014-07-01 08:56:05
User: jcoll
Functions: echo grep sed sort

btrfs checksum errors console report.

Know a better way?

If you can do better, submit your command here.

What others think

Er... I don't have a damage btrfs filesystem to hand, but surely that command can't work.

grep is going to output sets of four "words", e.g.

csum failed ino 1234

csum failed ino 5678

You want to extract just the number (but you don't).

Next, sort and uniq (sort -u would be more efficient).

Then you "xargs -n3" to find. find can only take one parameter to -inum.

Therefore most calls to find will fail.

I'd change the command to:

dmesg | grep -Po 'csum failed ino\S* \d+' | awk '{print $4}' | sort -u | xargs -n 1 find / -inum 2> /dev/null
Comment by flatcap 88 weeks and 3 days ago


I had a Btrfs with corrupted files, so indeed it did work, but perhaps it wasn't portable? In my usage, the "xargs -n3" made it chop off all but the 4th argument (inode number). I have little experience with xargs. Anyway, I posted your suggestion as an alternative because I like it also.

Comment by Sepero 88 weeks and 1 day ago


Perhaps this output on my system explains it, and all errors from the original command were simply redirected to /dev/null.

$ echo "1 2 3 4" | xargs -n3 echo

1 2 3


Comment by Sepero 88 weeks and 1 day ago

Your point of view

You must be signed in to comment.