((lambda (x) (x x)) (lambda (x) (x x)))

Sunday, September 7, 2008

SPR720 Command Lab

The system used for this lab is running Ubuntu 8.04 with a handful of extra packages installed.

Blog about your experience and what you've found.

1. Examine the /bin, /usr/bin/, /sbin, and /usr/sbin directories. For each directory, examine the number and type of commands (use ls|wc -l to count the number of files, and ls to view the filenames).

/bin: This directory contains 110 files on this system, mostly basic GNU utilities which were preinstalled with the distro's default packages. No executables related to GUI packages or user-installed packages appear to be currently located in this directory.

/usr/bin/: This directory contains 1726 files. While most executables related to packages installed by the user are visible in this directory, the majority of the files here are ones preinstalled with the distro's default packages. More GUI application packages, like xterm, own binaries located here.

/sbin: There are 153 files located here, most of these are binaries for programs related to management tasks likely to only be used by privileged users. These include programs for things like management of users, management of the hardware, and management of storage devices.

/usr/sbin: There are 264 files located here. The general purposes of most packages owning the binaries located here are for the most part similar to those in /sbin. The largest clear distinction I can make is that those located in this directory seem more like things that the user could choose to remove from the system, should they wish, while those in /sbin look far more critical and like they should properly be left alone for the system to function as the creators of the distribution intended.

2. Go through the files in /usr/bin and for each file, note whether it's a command you have used. Select 25 of the commands you haven't used and research what they do (use manpages and online resources).

The full list of which programs on my system I have used and not used is quite lengthy and can be found here.

as - This is an assembly language compiler -- not likely to be useful to me right now, as I'm not currently writing any assembly language code.
bashbug - This helps the user compose and send bug reports relating the the bash shell. At least this thing isn't set to go off automatically, the way the 'erorr reporting' features in some other operating systems are -- that's always really irritating to have to disable.
botti - This lets you run an irrsi module without a visible UI, and is apparently a popular way of writing bots. Nevertheless, I think I'm going to stick with doing the whole job of the IRC bot for our channel in perl, rather than as an irssi module.
dirname - This program strips the filename from a filepath, returning the path to the directory in which the file is located, I.E., doing 'dirname `realpath ./file`' should print the current working directory. Should be useful for scripts.
dirsplit - This program takes a directory of files and splits it into multiple directories each containing files up to a specified size limit. Should be useful for splitting up files to DVD sized folders for backup.
display - This program is part of image magic, and displays a specified image on an X server.
expity - This command checks whether the users password is near expiry, and if so, can force them to change it, if called with the '-f' option.
GET - This program stood out to medue to it's capitalized name. It turns out that it's something that comes with LWP. It issues an HTTP GET request against a provided URL and returns the requested resource or an appropriate error. Similar programs exist for HEAD and POST.
identify - This program identifies the format of an image file as well as additional information about various characteristics of the image.
id - This command prints information regarding a specified user. The default output seems to include the uid, gid and group memberships.
locale - This program provides information regarding vaious locale specific information like paper sizes, name, phone number and time/date formats. The output looks like it's formatted so it can be easily executed to set environment variables in a shell.
mogrify - This appears to be a command line program for modifying images. The manpage describes a variety of filters (blur, crop, dithe, etc.) that can be applied to the input file as well as several other operations such as resizing that may be performed upon it.
montage - This program creates a composite image out of a set of discrete images. The images can be tiled, and a border, fram or name applied to the resulting output file.
mousetweaks - This program is a daemon providing mouse related accessibility functions within the GNOME desktop environment. It appears to normally be called with the '-e=STRING' switch, in which string is a string specifying the accessibility features to enable.
nl - This program is a filter which adds line numbers to a file. I can think of a few times back in OPS435 that this program would have come in useful...
on_ac_power - Unsurprisingly, this application does exactly what it's name implies, returning true if the computer is plugged into AC power and false if it is running off of a battery. I was more surprised that this already existed as a command than by what it does, it's one that could prove handy so I'll have to make note of it in case it should prove useful in a script.
realpath - Another one that looks like it could be very useful in scripts, it returns a canonicalized absolute path when provided with a filename as it's argument.
rev - This program is a filter which reverses the order of characters on each line of either standard input or an input file specified as an argument.
setarch - This program alters the output of uname -m, causing programs to believe they are running on a different architecture than they really are and behaving accordingly.
shred - This program overwrites a file with a series of random bytes, and optionally unlinks the file as well. This is useful to make a deleted file more dificult to recover, making deletion of files containing critical data somewhat more secure.
shuf - This program is a filter, randomizing the order or lines recieved via standard input and then outputting the result to standard output.
strfile - This file accepts a file containing a series of strings delimited by lines containing only a '%' sign (or other delimiter specified using the '-c' switch) and produces a datafile containing both these strings in a binary format and a table of contents containing offsets to locate the beginning of each string, allowing random access to strings contained within the datafile.
toe - At first I figured this might somehow be related to head or tail, but it turns out that this command lists the terminal types available to terminfo.
unstr - This program goes along with 'strfile', reversing the process, accepting the datafile as input and producing the corresponding plain text file as it's output file.
volname - This program returns the volume name of a CD-ROM containing an ISO-9660 file system.
w - This command stood out because of it's single character name, and turns out to be a utility listing logged in users along with the processes they are running, as well as various details about these processes.

3. That's what this post is. ;)

No comments: