The extension in Linux does not indicate which type of file the file belongs.
Whether the file can be executed is not related to the file extension.
Because the File script has no execution permission, it cannot be executed,
Sh-3.2 # touch./script
Sh-3.2 # ls-lh./script
-Rw-r -- 1 root 0 Dec 28 06:15./script
Sh-3.2 #
Sh-3.2 #./script
Sh:/script: Permission denied
Sh-3.2 #
Sh-3.2 # chmod 755./script
Sh-3.2 #./script
Sh-3.2 # echo $?
0
Sh-3.2 #
In Linux, although the extension is also associated with a specific program.
But whether the file can be executed is not related to the extension.
Maybe this association is convenient for management, right?
Common extensions in Linux:
. Sh, usually used to indicate that this file is a shell script file;
. So (shared object), shared library file, which is similar to the dll in windows, which can be dynamically loaded when the program is running;
. Ko (kernel object), which is available only after Linux kernel version 2.6. It is also often called a module );
. O, that is, to compile the target file generated by a source file;
. A, that is, the static library file, will be packaged into the executable program in the compilation phase;
Linux supports. so and. ko, so it makes modularization easy.
Then how can we compile our own. so or. ko as needed?
This depends on how the Makefile file is written. The correct compilation parameters must be passed to the compiler (gcc) through Makefile,
In this way, the compiler will compile the corresponding file according to your needs.
For example, if you specify the-shared parameter to the compiler in Makefile, the compiler knows that you need to compile
. So file.
In short:
The final output result of the compiler is determined by the configuration in Makefile;
Makefile is set by the user as needed.
The command line parameters of gcc include:
Link options, optimization options, and C language options.
Software = program + documentation,
Program = Algorithm + Data Structure
File Types and file extensions in Linux