home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Unix Power ToolsUnix Power ToolsSearch this book

Chapter 40. Software Installation

40.1. /usr/bin and Other Software Directories

The location for certain types of installed files is very important. For instance, on many Unix systems, binary files accessible by users are located in the subdirectory /usr/bin or /usr/local/bin. If the applications aren't in these places, they may not be in the PATH environment variable and not easily accessible from the command line.

On my FreeBSD system, I've installed a utility called dos2unix, a file-formatting application that converts DOS newline character combinations to the Unix newline character. I used the FreeBSD Ports system to install the application, which automatically placed the program in my application directory, in my case /usr/local/bin. When I want to execute the application, I can run it from the command line without having to provide the location of the file:

dos2unix some.txt > new.txt

This command reformats the newline character of the contents of some.txt, converting DOS linebreaks to Unix ones.

The /usr/bin subdirectory differs from the /bin directory located directly off of the main root directory. The /bin directory has basic installed binaries built into the Unix operating system, with commands such as cd to change directory and so on. When you install an optional software application, it should not install software in the top-level binary subdirectory, but in /usr/bin, instead.

According to the Filesystem Hierarchy Standard (FHS), subdirectories (Linux- and BSD-specific) shown in Table 40-1 are located directly off the root directory within a standardized directory hierarchy.

Table 40-1. FHS root subdirectories

Subdirectory

Contents

bin

Application binaries

boot

Boot loader static files

dev

Device files

etc

System configuration files

lib

Shared libraries and kernel modules

mnt

Temporary mounting point for filesystems such as CD-ROMs

opt

Larger static software packages

sbin

System binaries

tmp

Temporary files

usr

User hierarchy, which has its own subdirectory with the following entries:

 
  • bin

  • doc

  • etc

  • games

  • include

  • kerberos

  • lib

  • libexec

  • local

  • man

  • sbin

  • share

  • src

  • X11R6

var

Variable data

If you install an application and the binaries aren't placed into the bin directory, you'll need to add the binary location to your PATH environment variable to access the application from the command line.

NOTE: For more information about FHS, see the home page at http://www.pathname.com/fhs/. Many Unix systems support this hierarchy, including the BSD systems such as FreeBSD and NetBSD, as well as Red Hat Linux and others. However, your own Unix admin may adjust this hierarchy to fit the needs of your enterprise, so you'll want to check subdirectory locations before proceeding with manual software installation.

-- SP



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.