The PATH Where Commands Are Searched For

When you type a command at the shell prompt, it has to be read off disk out of one or other directory. On UNIX, all such executable commands are located in one of about four directories. A file is located in the directory tree according to its type, rather than according to what software
package it belongs to. For example, a word processor may have its actual executable stored in a directory with all other executables, while its font files are stored in a directory with other fonts
from all other packages.The shell has a procedure for searching for executables when you type them in. If you type in a command with slashes, like /bin/cp , then the shell tries to run the
named program, cp, out of the /bin directory. If you just type cp on its own,then it tries to find the cp command in each of the subdirectories of your PATH . To see what your PATH is, just type

echo $PATH

You will see a colon separated list of four or more directories. Note that the current directory is not listed. It is important that the current directory not be listed for reasons of security. Hence, to execute a command in the current directory, we hence always ./command .
To append, for example, a new directory /opt/gnome/bin to your PATH , do

export PATH=”$PATH:/opt/gnome/bin”
export PATH

LINUX supports the convenience of doing this in one line:

export PATH=”$PATH:/opt/gnome/bin”

There is a further command, which , to check whether a command is locatable from the PATH . Sometimes there are two commands of the same name in different directories of the PATH . [This is more often true of Solaris systems than LINUX.] Typing which  locates the one
that your shell would execute. Try:
which ls
which cp mv rm
which which
which cranzgots

which is also useful in shell scripts to tell if there is a command at all, and hence check whether a particular package is installed, for example, which netscape.


The -- Option

If a file name happens to begin with a ‘-‘ then it would be impossible to use that file name as an argument to a command. To overcome this circumstance, most commands take an option -- ( the two hyphens written together) This option specifies that no more options follow on the command-line after -- and everything else must be treated as a literal file name.
For instance,

touch -- -stupid_file_name
This creates an empty file with name -stupid_file_name.
rm -- -stupid_file_name
This removes the file with name -stupid_file_name.

Multimedia Commands for Fun

You should practice using each of these commands if you have your sound card configured. [I don’t want to give the impression that LINUX does not have graphical applications to do all the functions in this section, but you should be aware that for every graphical application, there is a text-mode one that works better and consumes fewer resources.] You may also find that some of these packages are not installed, in that case you can install them easily with simple commands.


  • play [-v <volume>] <filename>

       Plays linear audio formats out through your sound card. These formats are .8svx , .aiff , .au , .cdr, .cvs , .dat , .gsm , .hcom,
      .maud , .sf , .smp, .txw , .vms , .voc , .wav , .wve, .raw , .ub , .sb , .uw, .sw , or .ul files. In other words, it plays almost every            type of “basic” sound file there is: most often this will be a simple Windows .wav file.
       Specify <volume> in percent.                                                                                                                                                                  If the package is not installed type,  sudo apt-get install sox  to install it.


  •  rec <filename>                                                                                                                                                        Records from your microphone into a file. ( play and rec are from the same package.)
  • mpg123 <filename>

        Plays audio from MPEG files level 1, 2, or 3. Useful options are -b 1024 (for increasing the buffer size to prevent jumping)           and –2to1 (down-samples by a factor of 2 for reducing CPU load). MPEG files contain sound and/or video, stored very              compactly using digital signal processing techniques that the commercial software industry seems to think are very sophisticated. If the package is not installed type,  sudo apt-get install mpg321  to install it.


  • cdplay

        Plays a regular music CD. cdp is the interactive version.                                                                                                                       If the package is not installed type,  sudo apt-get install cdtool  to install it.


  • aumix

       Sets your sound card’s volume, gain, recording volume, etc. You can use it interactively or just enter aumix -v <volume>             to immediately set the volume in percent. Note that this is a dedicated mixer program and is considered to be an  application separate from any that play music. Preferably do not set the volume from within a sound-playing application, even,  if it claims this feature–you have much better control with aumix .                                                                                         If the package is not installed type,  sudo apt-get install aumix  to install it.


  • mikmod –interpolate -hq –renice Y <filename>

        Plays Mod files. Mod files are a special type of audio format that stores only the duration and pitch of the notes that
        constitute a song, along with samples of each musical instrument needed to play the song. This makes for high-quality
        audio with phenomenally small file size. mikmod supports 669, AMF, DSM, FAR, GDM, IMF, IT, MED, MOD, MTM, S3M,
        STM, STX, ULT, UNI, and XM audio formats–that is, probably every type inexistence. Actually, a lot of excellent
        listening music is available on the Internet in Mod file format. The most common formats are .it, .mod , .s3m, and .xm.
       [Original .mod files are the product of Commodore-Amiga computers and had  only four tracks. Today’s 16 (and more)
        track Mod files are comparable to any recorded music.]                                                                                                                        If the package is not installed type,  sudo apt-get install mikmod  to install it.