-->
Previous | Table of Contents | Next |
If you installed the Slackware distribution of Linux, youll find ls also provides color output for each file type. The color definitions are defined in the configuration file DIR_COLORS in the /etc directory. The default configuration highlights executable files in green, directories in blue, and symbolic links in cyan. To customize the colors, you must copy the DIR_COLORS file to your home directory and change its name to .dir colors. Table 17.2 provides the color definitions available; see the man pages and the DIR_COLORS file for more information.
Value | Description |
---|---|
0 | Restores default color |
1 | For brighter colors |
4 | For underlined text |
5 | For flashing text |
30 | For black foreground |
31 | For red foreground |
32 | For green foreground |
33 | For yellow (or brown) foreground |
34 | For blue foreground |
35 | For purple foreground |
36 | For cyan foreground |
37 | For white (or gray) foreground |
40 | For black background |
41 | For red background |
42 | For green background |
43 | For yellow (or brown) background |
44 | For blue background |
45 | For purple background |
46 | For cyan background |
47 | For white (or gray) background |
NOTE: For the Red Hat distribution, you must type ls -color to get the color effect.
More options are available than those shown here. To find them, consult the man pages for ls.
There are no fixed rules for organizing files in Linux. Files dont have extensions (such as .EXE for executables) as they do in MS-DOS. You can (and perhaps should) make up your own system of naming files, but the classic system of organizing files in Linux is with subdirectories.
More and more, however, Linux applications that have come from the DOS world are bringing their conventions to Linux. Although they may not require it, vendors encourage you to name files that you use with their applications with certain extensions.
If youre going to write your own commands, a useful way to organize your directories is to mimic Linuxs use of the /bin, /lib, and /etc directories. Create your own structure of subdirectories with these names, perhaps under your /home directory, and follow the Linux tradition of placing executable commands in your /bin directory, subsidiary commands in your /lib directory, and initialization files in your /etc directory. Of course, you arent required to do this, but its one way of organizing your files.
You create directories with the mkdir command. Its syntax is simple:
mkdir directory-name
In this syntax, directory-name represents the name you want to assign to the new directory. Of course, you must have write permission in the directory in order to create a subdirectory with mkdir, but if youre making a subdirectory within your home directory, you should have no problem.
Suppose youve written three programs called prog1, prog2, and prog3, all of which are found in $HOME/bin. Remember that $HOME is your home directory. If you want your private programs to run as though they were a standard part of the Linux command set, you must add $HOME/bin to your PATH environment variable. To do so, you would use the following command in the Bourne or Korn shell:
PATH=$PATH:$HOME/bin;export PATH
In the C shell, you would use this command:
setenv PATH $PATH $HOME/bin
NOTE: Remember that $HOME is the placeholder for the complete path that refers to your home directory. If your home directory is /home/ams, $HOME/bin is interpreted as /home/ams/bin.
If your programs call subsidiary programs, you may want to create subdirectories within your $HOME/lib directory. You can create a subdirectory for each program. The private command pgm1 can then explicitly call, for example, $HOME/lib/pgm1/pgm1a.
Similarly, if your command prog1 requires a startup table, you can name that table $HOME/etc/pgm1.rc; your data can be in your $HOME/data/pgm1 directory.
The command for copying files is cp from to. You must have read permission for the file youre copying from and write permission for the directory youre copying to (and the file if youre overwriting an existing file). Other than that, you are not restricted when it comes to copying files.
You need to watch for a few things as you copy files:
NOTE: Because many Linux users also have MS-DOS files on their systems and usually make the DOS file system accessible from Linux, most of the Linux commands recognize when a file is being copied to or from a DOS partition. Thus, Linux can handle the necessary file translation when copying files. This translation is required because most DOS files embed the carriage return/line-feed characters into an ASCII file to indicate a line break. Most Linux and UNIX systems embed only a line-feed character, called newline, in the file to indicate a line break.
Previous | Table of Contents | Next |