[KLUG Members] Submit your favorite Unix command examples

Patrick Mc Govern members@kalamazoolinux.org
Tue, 18 Dec 2001 23:30:36 -0500


I am compiling a categorized listing of common Unix command examples.  This 
listing will allow users to understand unix commands via a 1 or 2 line text 
description and an example.  Each command section will start with simple 
examples then graduate to more complex commands if they are available.  

The results of this work will be available to anyone that is interested.

While any Unix command will be considered, the following are the most 
desireable:
at, change, chgrp, chmod, chown, cmp, col, column, comm, cp, crontab, 
cut, date, dd, df, diff, du, grep, env, expr, find, finger, fmt, fold, free, 
ftp, gzip, gunzip, head, hostname, id, ifconfig, ispell, kill, killall, less, 
logger, ln, lpq, lpr, lprm, ls, merge, modprobe, mount, more, mv, netstat, 
paste, pr, printf, ps, rm, rmdir, rpm, rsh, sort, split, stty, su, symlinks, 
tail, tar, tee, telnet, top, touch, tr, umount, uniq, useradd, usermod, w, 
wc, who, xargs

The following are some simple "cut" command examples that show the format:

#cut: A versitile command to parse strings.
    The contents of variable "a"
    $  a="12345/67/89/"
    $   echo $a
    $   12345/67/89/
 
    #To cut a range of characters from 2 to 5:
    $ echo $a | cut -c2-5
    2345
 
    #To cut characters from character 1 to 5:
    $ echo $a | cut -c-5
    12345
 
    #To cut from character 5 to the end of the string:
    $ echo $a | cut -c5-
    5/67/89/
 
    #To cut a range of fields from 2 to 3:
    $ echo $a | cut -d/ -f2-3
    67/89
 
    #To cut the second field:
    $ echo $a | cut -d/ -f2
    67
 
    #To cut from the beginning of string to end of field 2:
    $ echo $a | cut -d/ -f-2
    12345/67
                                                                              
 
   Below is a more advanced use of the tar command
    ( Adam showed me this a while back.)
   It has 2 comment lines, the first describes WHAT it is doing, and the     
second line should explain HOW it worked.  This second line should be 
reworded to be more explanatory, but the idea is that more complex examples 
need more development for a better understanding of what is happening.

   #To move large files efficiently ( > 100 Mb size).   
   #Creates a read/write process in 10k blocks.
    tar -cvf - /home/my_home_dir | (cd /opt/backup ; tar -xvf-)

If you wish to contribute, please make sure your commands really work and are 
original.
Thanks!!
Pat