Hide

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.


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

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:

Hide

News

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!
Hide

Top Tags

Hide

Functions

Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Command for getting the list of files with perms, owners, groups info. Useful to find the checksum of 2 machines/images.

Terminal - Command for getting the list of files with perms, owners, groups info. Useful to find the checksum of 2 machines/images.
find / | xargs ls -l | tr -s ' ' | cut -d ' ' -f 1,3,4,9
2009-07-21 08:41:59
User: pavanlimo
Functions: cut find ls tr xargs
-2
Command for getting the list of files with perms, owners, groups info. Useful to find the checksum of 2 machines/images.

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

man find

find -exec ls -l {} \;

I don't really understand what you are trying to do with splitting the ls output but I bet you'd better off with awk

if you show the desired output I'll tell you how

Comment by unixmonkey4704 385 weeks and 1 day ago

@unixmonkey4704: xargs is better, because it's much more efficient. -exec ... \; executes ls once for every single file, while xargs executes ls fewer times, using as many files per invocation as possible.

Some implementatons of find(1) support a non-standard syntax (e.g. -exec ... +) that mimics xargs, but this is not portable.

However, i agree that awk is better in this case:

find / | sort | xargs ls -ld | awk '{print $1,$3,$4,$9,$10,$11}'

This fixed two problems with the OP's command: First, the -d option must be specified to the ls command so that directory entries are listed themselves (not their contents). Second, the output from find is not sorted. If you want to compare the output between two machines, you need to sort it first.

Comment by inof 385 weeks and 1 day ago
find -exec $cmd {} \;

executes $cmd for each file, but

find -exec $cmd {} \+

executes $cmd once with all files as arguments, just like xargs.

Comment by spatz 385 weeks and 1 day ago

@spatz: You have read my comment above, haven't you? :-)

Comment by inof 385 weeks and 1 day ago

Your point of view

You must be signed in to comment.