BLPCh1: basic programming knowledge in Linux

Source: Internet
Author: User
BLPCh1: Linux programming basics-Linux general technology-Linux programming and kernel information. For details, see the following. There are two types of programs that can run on Linux: executable files and scripts. At the user level, there is no difference between the two.

In Linux, we will deal with a command line environment. This is Shell.

Shell can find the program we are looking for, based on a shell environment variable-PATH. The PATH can be configured by the Linux administrator.

PATH stores the location where the system program is stored. Including:

/Bin binary file, the program used during system startup
/Usr/bin user's binary file, user's Standard Program
/Usr/local/bin local binary file, specific to an installed program

The system administrator can also use the following two paths:

/Sbin
/Usr/sbin

You do not need to easily delete a PATH in the PATH unless you are sure of the consequences.

PATH uses ':' To separate paths, rather ';'
Linux uses '/' to separate directories, rather '\'

Linux development roadmap

A Linux developer must know where the required tools and development resources are located.

Applications

Applications are stored in their respective directories.
The system provides programs for general purpose in/usr/bin
Append programs specific to the host or local network to/usr/local/bin or/opt
The Administrator prefers/usr/local, which stores third-party files and attachments different from the programs provided by the system.
The author recommends compiling programs and accessing required files from the/usr/local directory structure.
Gcc is usually in/usr/bin or/usr/local/bin. this is specified when compiling the compiler and system type variables. for Linux, the path may be a specific version path/usr/lib/gcc-lib

Header file

When programming in c and other languages, we need to library function call header files.
For C language, it is usually located in/usr/include.
Other languages also have their own header file paths, which can be found by relevant compilers.

Library files

The standard system library is in/lib or/usr/lib.
The default path of the c compiler is only the c standard library. The search path of other libraries must be told to the c compiler.
A library file name always starts with lib, followed by c (indicating the c library), or m (indicating the math library ). the suffix is. a (indicating a traditional static library), or. so (indicates a shared library ).
To include a library other than the standard C Runtime Library, gcc must use the-l item

Static Library

The traditional method is to link the Code together and stay on standby.

Shared Library

One advantage of shared libraries is that they can be updated independently of the main program.

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.