How to list all file extensions within a directory

by

Here’s a simple command to list all file extensions (recursively) within the current directory
(thanks to this forum posting

find . -type f | sed -e 's/.*\.//' | sort | uniq -c | sort -rn

When you have, for example, a large codebase with lots of files that have no extension (e.g., Makefile, README, etc.), the above lists them with their full path.

Here’s a modified version of this to remove any /path/to/file/ and so just list those files too:

find . -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq

Advertisements

One Response to “How to list all file extensions within a directory”

  1. www.cypnetwork.com Says:

    Hi, all is going sound here and ofcourse every one is
    sharing facts, that’s really excellent, keep up
    writing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: