File extensions in Linux and Unix

On Unix and Linux systems, the file extensions are a matter of convention. They are used to help the user choose a program to read/open the file.

A few extension conventions:

Usually, the regular files have extensions: file.txt, file.pdf.

The files whose names start with dot (.) are usually configuration files: .bashrc, .zshrc.

The files having upper case names, such as: TODO or README are usually text files.

The directories and the files that are ment to be invoked directly do not have extensions.

Linux and Unix famous extensions:

  • .tar : tar archive
  • .tar.gzip or .tgz : gzipped tar
  • .tar.bz2 or .tbz : bzip2 tar
  • .a : archive
  • .cpio : cpio archive
  • .xz : lzma2 archive
  • .conf : configuration file
  • .deb : debian package
  • .rpm : rpm package
  • .pl : perl script
  • .py : python script
  • .sh : shell script
  • .h : linux headers
  • .ko : kernel module extension
  • .o : compiled code file
  • .pub : public key
  • .bak : backup file

The Linux and Unix systems do not need the extensions to know what programs to choose for working with the files, like Windows does.

The file command displays detailed information about the file types. Read more about how to find file types here.

$ file pl
pl: a /usr/bin/perl script text executable

$ file py
py: a /usr/bin/python script text executable

$ file /usr/share/man/man1/ssh.1.gz
/usr/share/man/man1/ssh.1.gz: gzip compressed data, from Unix, max compression


Tagged with: , , , , , ,
Posted in The Linux and Unix Articles!
One comment on “File extensions in Linux and Unix
  1. besthacksdll says:

    It’s an awesome post in favor of all the online people; they will take benefit from it I am sure.

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!