Created Wed 27/12/2006
This document describes the userspace programs in the GNU Linux environment.
The typescript(1) tool starts a subprocess within the current shell that captures all interaction with the tty attached to that shell. By default, output is directed to a file called typescript in the current directory. Output from the tty is continuously captured until the typescript process is terminated (e.g., with ctrl+d, or the the process is sent a signal such as SIGKILL, SIGQUIT or etc).
The following shows an example which starts the typescript process (started by man?script(1)) and captures tty interaction for 3 commands echo(1), pwd(1) and date(1).
bash $ script Script started, file is typescript
bash $ echo $LOGNAME foo
bash $ [1002:2:0]$ pwd /home/foo
bash $ date Sat Apr 23 16:41:01 CEST 2005
bash $ exit Script done, file is typescript
The contents of the above typescript session, recorded to the default typescript file within the current directorty are as follows (note the control characters for enter and backspace and so on):
bash $ cat typescript Script started on Sat 23 Apr 2005 16:45:27 CEST bash $ echo $LOGNAME foo bash $ pwd /home/foo bash $ datt[Ke Sat Apr 23 16:45:38 CEST 2005 bash $ Script done on Sat 23 Apr 2005 16:45:40 CEST
The /dev/zero file is a character special device that returns ASCII NULL 0x0. The device will constantly return 0x0 for each byte requested, so it can be used to create a stream of NULLS. This is useful for creating a character stream for overwriting existing information or for generating a clean file of a specific size. BSD uses mmap(1) to map /dev/zero to RAM in it's shared memory implemention.
To create a 100Mb file:
bash $ dd if=/dev/zero of=foo.img count=100 bs=1M or: bash $ dd if=/dev/zero of=foo.img count=1 bs=100M
Note that dd(1) supports a bunch of multiplicative indicators, such as M, G, K, etc. Generally, suffixes like MB, GB, KB are decimal (e.g., KB=1000, MB=KB*1000, GB=MB*1000), whereas single character suffixes like K, M, G are binary (e.g., K=1024, M=K*1024, G=M*1024).
To create an initialized parition of /dev/hda7:
bash $ dd if=/dev/zero of=/dev/hda7
The /dev/zero device can be thought of as a data source, whereas /dev/null is a sink. All write operations to /dev/null will succeed and all /dev/zero return as many NULL bytes as are read. This entry is sourced from http://www.answers.com/topic/dev-zero
The [[man?dd|dd(1)]] program can be used to read and write raw bytes to devices. This is useful for creating images on cd or hdd media, for creating large empty files or for copying part of a file image.
To create a large empty file, (note, empty in the sense that the file contains only ASCII NULL 0x0) use the dd(1) command as follows (see also /dev/zero, in #2 above):
bash $ dd if=/dev/zero of=foo.img count=1 bs=100M
This creates a file of 100*1024 bytes, with the contents read from /dev/zero (indicated by if=), which continuously answers bytes of ASCII NULL. The output is written to the file foo.img (as indicated by of=). In the above command, one count is read with a block size of 100 M (count=1, bs=100M). The same results can be achieved by reading 100 counts of block size 1M or 50 counts of 2M and so on. Note also that M is a power of 2 (M=1024*1024).
A configure script is usually created with automake and is typically bundled with platform-independent source tarballs. The configure script sets preferences for the local machine and determines which libraries are available and the location of required libraries and header files.
Once the configure process is completed, a Makefile is written, which can then be used to build, test and install the application being built. The configure parameters are written to config.log. If the configure process fails, then the reason for the failure is written to config.log.
By default, configure generates a Makefile that installs with a prefix of /usr/local. This means binaries are installed to /usr/local/bin, man pages to /usr/local/man, libraries to /usr/local/lib and so on. The installation location can be changed using configure switches. In the broadest sense, the installation prefix can be changed with the --prefix= option. Installation locations can also be changed for individual components (like binaries, documentation, libaries and etc).
To change the installation prefix to match a typical distro installation, simply change the prefix and system configuration directory options:
bash $ ./configure --prefix=/usr --sysconfdir=/etc
See the configure script itself for a list of the installation options that can be changed.
Often configure may fail to find a libary, failing with a cryptic message like lib_a >= 1.0 required, when in fact lib_a 1.0 may indeed already be installed. The reason for this is that configure may find the libary but not the headers (configure often needs to provide -L libary switches and -I include switches). To resolve this be sure that the headers for the missing libary are available and accessible.
With rpm, binaries and headers are packaged separately. For example lib_a.i386.rpm and lib_a-devel.i386.rpm
If a libary or header files are installed in a location not specified by LD_LIBRARY_PATH nor in /etc/ld.so.conf.d/* files, then it's possible specify different libary locations with options to configure such as with --libdir=. Typically, individual configure scripts provide literally thousands of different options. Check the generated configure script to see which options are available for the software being built.
The tr(1) program which is part of the gnu linux user programs provides transliteration support. Examples include character translation, upper- or lower-case conversion. The tr reads from stdin and transliterates the character class listed in the first argument to those in the second. Much like egrep(1) and etc, special character classes such are [:upper:] which stands for All uppercase characters and it's converse [:lower:] are supported. The following converts stdin to uppercase.
bash $ tr '[:lower:]' '[:upper:]'
Transliterate (tr(1)) can also be used to delete characters, which is done by specying the -d option and the character to delete. For example, to delete all newline (\n) characters from stdin:
bash $ cat somefile | tr -d '\n'
Use touch(1) to change the access and modification times on a file. the format of the date string given to touch(1) is specified in the format **touch(1) uses the current date and time, so specify -t with a date string to use a different one. To change only the access time specify -a and to change only the modification time specify the -m option. If the modification option (-m) nor access option (-a) are not specified, then touch(1) will alter both the access time and modification time attributes.
This example changes the modification time of foo.txt to 12:30pm December 1, 2004
bash $ touch -t 200412011230 -m foo.txt
Tip: To change the modification time to Today (the current system date), simply omit the -t option: 'touch -m foo.txt'')
Alter the acess time of the same file to today.
bash $ touch -a foo.txt
To change both the access and modification time of a file, simply omit the -m and -a options. In the following, the access and modification time of foo.txt are changed to 12:30pm, 12 May 2004. To specify the current system date as the modification and access time, simply omit the -t option as well. opd
bash $ touch -t 200405121230 foo.txt
Tip: To change the modification and access time to today, specify no options other than the filename, as in: touch foo.txt
An OpenXML document (.docx) can be converted to an Open Office document (.odt) using Open Ninja'a OdfConverter. There's no need to install the entire rpm as long asn open office is installed. Simply extract OdfConverter from the rpm using rpm2cpio(1) and cpio(1), then copy the OdfConverter binary to (e.g.,) /usr/local/bin. After insallation, document conversion can be done simply by:
bash $ OdfConverter /i some.docx
The preceeding will create some.odt, which can then be opened in OpenOffice (oowriter)
There are many diff and merge tools. This is small list:
Stuart Moorfoot © 27 Dec 20076 foo@bund.com.au