Linux Commands

team bbl


Linux commands are programs, developed by GNU or other projects, and included with the Linux distribution. You can see some Linux commands by typing:

 ls /bin 

The output includes many of the Linux commands you use. For instance, the ls command used above to see what's in the bin directory runs a program stored in the bin directory, as shown in the output from the ls command. The commands are binary files. To see the file type, enter:

 file /bin/ls /bin/ls: ELF 32-bit LSB executable, Intel 80386 version... 

This is an executable file. If you tried to display it on the screen with something like cat /bin/ls, the output would be garbage.

You can run this program by typing ls at any command line. You don't need to use the path because the program is on the system path. When you type any command at the command line, Linux searches the system path and executes the first program it finds that matches the command you typed. You can see the system path by typing:

 echo $PATH /usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/janet/bin 

The system path is a series of directory paths, separated by colons (:). Notice that the directories are named bin, which stands for binary. The name is not required, just customary. Different distributions use different paths. This is the path for a Fedora user account. The root account has a different path, including directories containing system administration commands. The following is the path for a SuSE user account:

[View full width]

/home/janet/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:opt/gnome/bin:/opt /kde3/bin:/usr/lib/java/gre/bin

You can add commands to your Linux system by copying a program into any directory on the system path. You can add commands you write and compile yourself or commands you download from the Internet. It's customary to put commands added by the user into /usr/local/bin or /usr/bin. SuSE provides a default bin directory in the home directory that can be used for commands you want to run yourself or perhaps permit only to a few other accounts.

Linux commands can be saved in a file called a shell script. When the script runs, it executes the commands, one by one. Shell scripts can also include control statements, such as if statements and loops. Writing shell scripts is discussed in Chapter 19.

    team bbl



    Spring Into Linux
    Spring Into Linux
    ISBN: 0131853546
    EAN: 2147483647
    Year: 2005
    Pages: 362
    Authors: Janet Valade

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net