Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

What have you tried so far? You can find all the file names having an extension by means of the find command using a proper pattern, then fetch the output to sed to extract the extension and finally sort the result removing duplicates. Looking for files all over the system might take a long time, anyway. May I ask what is the purpose of this?

At any rate, I think the approach has to start with find, since you intend to traverse the entire filesystem. The result would then have to be piped to either a file for subsequent processing, or directly to some script that finds and counts filename extensions. The latter would probably best be done with some language that understands associative arrays, since you are going to keep track and count of lists of things that are non-numeric. The script will have to use some of your own definition of what constitutes a filename extension. My own would look something like this (untested):

There are at least a couple of different classes of 'not working', so it behooves you to spell out for us what you mean by 'not working'.
One case is where the tools you try to use complain about the syntax or values of the arguments you supply. That might occur in a bash shell command when you, for instance, fail to provide proper quoting by using either the wrong characters, or use unbalanced quoting. Another type of error might be that you've provided a commandline argument to which the tool you intend to use it makes no sense. Usually, this will result in an error message that you would find helpful in fixing the error. Finally, there are errors in programming logic, where the algorithm you implement does not perform the task you intended. In such cases, it is helpful to describe how the result differs form the intended result.
In all cases, when posting programming code, it is imperative that you use [/CODE]your code here[/CODE] tags to distinguish the characters you type as fully literal, and not to be interpreted as smilies, or have quote marks transformed into other formats.
--- rod.