Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - News > Syndicated Linux News
User Name
Syndicated Linux News This forum is for the discussion of Syndicated Linux News stories.


  Search this Thread
Old 05-29-2008, 07:11 AM   #1
LXer NewsBot
Registered: Dec 2005
Posts: 95,583

Rep: Reputation: 96
LXer: Simple Shell One-Liner To Enumerate File Types In Linux and Unix

Published at LXer:

How to inventory your filesystem using a simple shell one-liner in Linux and Unix, for all shells from ash to zsh.

Old 05-29-2008, 01:44 PM   #2
LQ Newbie
Registered: May 2008
Posts: 1

Rep: Reputation: 0
Alternative one-liner without awk

find -maxdepth 1 -exec file {} \;|sort -t \: -k 2|uniq -f 2 -c|sed 's/^\( *[0-9]*\).*:\(.*\)/\1\2/'
Old 05-30-2008, 09:47 AM   #3
Registered: Jul 2004
Distribution: LFS, I felt the itch and scratched it
Posts: 227

Rep: Reputation: 31
Originally Posted by partner55594039 View Post
find -maxdepth 1 -exec file {} \;|sort -t \: -k 2|uniq -f 2 -c|sed 's/^\( *[0-9]*\).*:\(.*\)/\1\2/'
Or even more simply than that:
find . -exec file -b {} \; | sort | uniq -c

Last edited by kjordan; 05-30-2008 at 09:48 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
unix shell script:How to delete the first line in a file?? rche3252 Programming 6 03-03-2010 08:32 AM
what types of services do telecomm firm like t-moble,celtel,mtn use linux/unix for yawe_frek Linux - Networking 4 12-06-2007 03:58 PM
simple unix file system problem alokatzenith Programming 16 11-01-2007 07:02 PM
How to turn a file to a one liner thru sh script? jillann Linux - Newbie 15 04-18-2007 10:32 AM
LXer: Understanding UNIX/Linux file system LXer Syndicated Linux News 0 01-29-2006 08:01 PM > Forums > Linux Forums > Linux - News > Syndicated Linux News

All times are GMT -5. The time now is 07:23 AM.

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