There are a few concepts you need to know.
In Linux and other *nix a file is executable for a user if the user have execution privileges over the file.
Examples can be shell scripts, python scripts, compiled programs and any other file, you can give execution privileges to a image if you want (although it may not be very useful):
chmod +x image.jpg
An application or program is a sequence of instructions encoded in some language, it may be in a scripting language so it doesn't need compilation and you can open it with any text editor as geany, or it may be machine code (result of writing the program in a compiled language). In the last case the program is a binary file (ie a file which is not encoded in ASCII or any other codification meaningful to a normal text editor).
You can see the bytes of a binary programs encoded in hexadecimal with commands like hexdump
or try to disassemble the program with objdump
, but you can't see the original source code.
If the software you want to analyze is open source and you downloaded it from the Ubuntu repositories you can download its source code with:
apt-get source name_of_the_package
You can get the name of the package with:
dpkg -S /path/to/the/binary
The tools in Linux and many other O.S. can detect the type of a file either by their file extension or by reading a few special bytes from the file (many times the first two or three bytes are enough), those are called a magic number.