What are the common file extensions in Ubuntu?
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
.
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.
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.