Wednesday, September 10, 2008

SPR720 Command Lab - Examining core Linux directories and commands

I've spent some time in the last week examining the /bin, /sbin, /usr/bin and /usr/sbin directories on my Ubuntu Linux box and my first conclusion is that a week is not nearly enough time to gain a clear understanding of their contents. Thus I turned to the Internet to get help on the subject and found the following links helpful:

http://www.tuxfiles.org/linuxhelp/linuxdir.html
http://doc.vic.computerbank.org.au/tutorials/linuxdirectorystructure/

/bin - 106 files
The /bin directory contains programs that provide basic text and file manipulation along with basic system information. These programs are so basic that they are used by both end user and system administrator alike. Examples of programs in this directory include ls, pwd, rm, cp, bash, su, mkdir, rmdir and touch. One thing I notice is that Gnome and KDE (among other graphical shells) are evolving to the point where even these basic progams will not be needed by casual users.

/sbin - 153 files
The /sbin directory contains the most basic and most critical system configuration programs. Anyone who's had to struggle with installing Linux will have had to learn some of these commands. They include mkfs, fsck, parted, hdparm for disk manipulation; ifconfig, ifup, ifdown, iptables, route and others for network management; sysctl, lsmod and modprobe for kernel information and control.

/usr/sbin - 236 files
This directory contains many essential tools for system administration. While they are not essential for getting a system up and running, they are essential for getting it set up properly. User and group manipulation commands include: adduser, addgroup, deluser, delgroup. It
also contains programs to control system programs called daemons including: cupsd, cron, ntpd, tcpd.

/usr/bin - 1279 files
This directory contains end-user applications and numerous tools and utilities. To start with, just about every application one can invoke from the Gnome menus can be invoked from the command line in this directory. Many supplemental programs related to the "menu-available" applications but which are not available from the menus are in here too. Finally there are many small but powerful and useful utilities. Here's a small list of some of the programs I found interesting:

Sound Control - alsa, alsamixer, amixer, amidi, pacmd, pactl, paplay

Software Installation - apt-get, aptitude

Batch Command Execution - at, batch

System Settings / System Information - charset, charmap, free, getconf, getkeycodes, locale, lspci, peekfd, pmap, w

CD/DVD Creation - cdrdao, cdrecord

Miscellaneous Tools
bc - a powerful calculator
expand - converts tabs to spaces
find - find files
file - tries to determine a file type
fmt - text formatter
fold - text wrapper
head - display the top of a file
tail - display the end of a file
join - joins files together
ftp, lftp, sftp - file transfer programs
lp - prints files
man - displays system documentation
nice - run a program with modified scheduling priority
passwd - change user password
paste - merge lines of files together
pg - browse pagewise through text files
sort - sorts text files
split - splits a file into pieces
ssh - securely login to another system over the network
watch - runs a program and occasionally displays the output
xxd - make a hex dump of a file
yelp - a graphical help browser that can display and navigate info files


Some final notes:

There are many symbolic links in the directories. These serve to give access to the same program under many different names. The reason for doing this is to preserve compatibility between current and older version of Linux. It also provides some compatibility between the Ubuntu/Debian flavour of Linux and other Linuces and Unices.

The above lists are not meant to be comprehensive. They represent a snapshot of what I now know and am interested in. Please bear this in mind.

No comments: