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