What are the common file extensions in Ubuntu?

1,270

Solution 1

File extension are up to the creator of the file. In Linux you can name something music.mp3 but if it is a text file it will open with gedit if that is your texteditor because it will look at the 1st bit/byte(?) where it says what kind of file it is.

When it comes to bash script it is considered best practise to not include .sh at the end. By omitting it you basically create a command so those do not tend to even have an extension. And those commands could be made in bash but also in perl or python.

So looking at the actual name of the file might be misleading!

Linux has a command file to find out what a file is. Syntax file *
Some random samples:

xxxx.sql:    UTF-8 Unicode text, with very long lines
xxxx.sql.gz: gzip compressed data, was "xxxx.sql", from Unix, last modified: 
             Wed May 18 10:21:34 2011
yyyyy:       ASCII text
iffffff:     directory
ghgggg.tar:  POSIX tar archive (GNU)
fhhfhf.pl:   perl script text executable

For a list of extensions Fuddledumpy's post can be used and files ending on .pl will more than likely be perl scripts but to make sure use file.

Solution 2

Be aware that Linux doesn't care too much about file name extensions. It determines the file type based on the file's contents/MIME type, so knowing a file extension doesn't give too much insight into a program's usage pattern.

See What is the relationship between MIME types and File .extensions? and How are file-extensions/mime-types/icons/default applications associated? for more info.

Solution 3

Technically, the list of known file extensions is stored in /usr/share/mime/globs. Here's a copy with nicer formatting.

I'm not sure how to decide which file extensions are "common". This list claims to be "common" but I think I've only ever run across about five percent of it.

Share:
1,270

Related videos on Youtube

bala
Author by

bala

Updated on September 18, 2022

Comments

  • bala
    bala over 1 year

    I'm trying to sharpen images uploaded through paperclip. The sharpen code is working but it causes the styles to not work. The code is like this:

     has_attached_file :photo,
        :styles => {
                    :thumb => {:geometry => "100x100>"},
                    :medium => {:geometry => "300x300>"},
                    :original => {:geometry => "1024x1024>"}
                    },
        :processors => [:sharpen],
        :storage => :s3,
        :s3_credentials => "#{Rails.root}/config/s3.yml",
        :path => "/:style/:id/:filename"
    

    Now if I remove the processors option, the uploaded images are resized as specified. However if I include the processors option, all the resulting images are of original size.

    My sharpen processor looks like this:

    module Paperclip
      class Sharpen < Paperclip::Processor
        def initialize file, options = {}, attachment = nil
          super
          @file = file
          @current_format = File.extname(@file.path)
          @basename = File.basename(@file.path, @current_format)
        end
    
        def make
          dst = Tempfile.new(@basename)
          dst.binmode
    
          command = "#{File.expand_path(@file.path)} -unsharp 1.5×1.0+1.5+0.02 #{File.expand_path(dst.path)}"
    
          begin
            success = Paperclip.run("convert", command)
          rescue PaperclipCommandLineError
            raise PaperclipError, "There was an error converting sharpening the image for #{@basename}"
          end
    
          dst
        end
      end
    end
    

    Any thoughts?

    • Steven
      Steven almost 13 years
      Is this what you are looking for?
    • MestreLion
      MestreLion almost 13 years
      Newbie questions spree tonite, @wojox ? In an OS where file extentions play little role, its quite "weird" to ask about the common ones, specially since most are inherited from Windows.
  • bala
    bala over 13 years
    Awesome, it worked! I really didn't notice that thumbnail processor would be executed by default. Thanks man.
  • RusGraf
    RusGraf almost 13 years
    So why does screenshot.png.odf: PNG image data, 601 x 317, 8-bit/color RGB, non-interlaced open in LibreOffice when I double-click it?
  • RusGraf
    RusGraf almost 13 years
    Linux may not care too much, whatever that means, but GNOME certainly does. Try gnome-opening a file with a misleading extension and you'll see what I mean.
  • enzotib
    enzotib almost 13 years
    That is a nautilus configuration, not using file output information.
  • Rinzwind
    Rinzwind almost 13 years
    Because (of nautilus usage) of mimetypes: there are more than 1 images filetypes that can be openend by more than 1 program. He asked for a way in command line to identify files. screenshot.png.odf is an image from your example. screenshot.png.odf could also have shown you "Microsoft Office Document" if it was created in word ;)
  • Christoph
    Christoph almost 13 years
    yeah, you're right, and I think gnome-open is messed up in that regard.
  • MestreLion
    MestreLion almost 13 years
    @ændrük: Doesnt gnome-open follow MIME/type ? If so, file extension is only a part of the puzzle... not even the most important one