Linux Programs(摘自Linux程序设计英文原版)

         Linux applications are represented by two special types of files: executables and scripts. Executable files are programs that can be run directly by the computer; they correspond to Windows .exe files. Scripts are collections of instructions for another program, an interpreter, to follow. These correspond to Windows .bat or .cmd files, or interpreted BASIC programs.

         Linux doesn’t require executables or scripts to have a specific filename or any extension whatsoever. File system attributes, which  are used to indicate that a file is a program that may be run. In Linux, you can replace scripts with compiled programs (and vice versa)without affecting other programs or the people who call them. In fact, at the user level, there is essentially no difference between the two.

         

         The search path (to which you can add) is configured by your system administrator and will usually contain some standard places where system programs are stored. These include:
❑ /bin: Binaries, programs used in booting the system
❑ /usr/bin: User binaries, standard programs available to users
❑ /usr/local/bin: Local binaries, programs specific to an installation

         Optional operating system components and third-party applications may be installed in subdirectories of /opt, and installation programs might add to your PATH variable by way of user install scripts.

 

          Standard system libraries are usually stored in /lib and /usr/lib.

          A library filename always starts with lib.

             ❑ .a for traditional, static libraries
          ❑ .so for shared libraries

          $ gcc -o fred fred.c /usr/lib/libm.a

          $ gcc -o fred fred.c -lm(An addi-tional advantage of the -lm notation is that the compiler will automatically choose the shared library when it exists.)

 

           Although libraries are usually found in standard places in the same way as header files, you can add to the search directories by using the -L (uppercase letter) flag to the compiler. For example,$ gcc -o x11fred -L/usr/openwin/lib x11fred.c -lX11

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值