Linux File Extension Learning

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.