My very own UNIX cheatsheet

A B C D E F G H I J K L N M O P Q R S T U V W X Y Z

My very own UNIX cheatsheet - see last update info at end of file. This page is encoded in ISO-8859-1.

A

Apache

Apache folder browsing -- set column widths in httpd.conf:

        IndexOptions DescriptionWidth=* NameWidth=*

Apache codes:

Successful Client Requests
200      OK
201      Created
202      Accepted
203      Non-Authorative Information
204      No Content
205      Reset Content
206      Partial Content
Client Request Redirected
300      Multiple Choices
301      Moved Permanently
302      Moved Temporarily
303      See Other
304      Not Modified
305      Use Proxy
Client Request Errors
400      Bad Request
401      Authorization Required
402      Payment Required (not used yet)
403      Forbidden
404      Not Found
405      Method Not Allowed
406      Not Acceptable (encoding)
407      Proxy Authentication Required  
408      Request Timed Out
409      Conflicting Request
410      Gone
411      Content Length Required
412      Precondition Failed
413      Request Entity Too Long
414      Request URI Too Long
415      Unsupported Media Type
Server Errors
500      Internal Server Error
501      Not Implemented
502      Bad Gateway    
503      Service Unavailable    
504      Gateway Timeout        
505      HTTP Version Not Supported

ASCII

ASCII Characters

ASCII and other control characters and sets - various notes.

Decimal values of upper case ASCII characters
6....7....7....8....8....9....9....
5    0    5    0    5    0    5
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Decimal values of lower case ASCII characters
9...10...10...11...11...12...12....
5    0    5    0    5    0    5
  abcdefghijklmnopqrstuvwxyz

Some ASCII Control characters:

^@      Ctrl+@ null character    NUL \0 0x00 octal 00 decimal  0
        Ctrl+I horizontal tab    HT  \t 0x09 octal 11 decimal  9
^J      Ctrl+J line feed         LF  \n 0x0A octal 12 decimal 10
^K      Ctrl+K
^L      Ctrl+L form feed         FF  \f 0x0C octal 14 decimal 12
^M      Ctrl+M carriage return   CR  \r 0x0D octal 15 decimal 13

See Wikipedia entry here for really nice tables.
See also http://skyprod.net/pub/HintsAndTips/ASCIIendline/
http://www.asciitable.com/
http://en.wikipedia.org/wiki/C0_and_C1_control_codes
http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch03s02.html#fullstop
http://www.unix.com/unix-dummies-questions-answers/41277-how-convert-m-appearing-end-line-unix-newline.html
See also vi and vim below.

ASCII Escape Sequences - Colours etc.

Escape and reset at the end of line to destroy settings: this can be done by using \033[0m at the end of the line.
Specify $EINS\033[x;y where x is text attributes, y is text foreground .. and THEN
Specify $EINS\033[x;y;z where x is text attributes, y is text foreground, z is background.

Non-printing escape sequences have to be enclos`d in \[\033[ and \]. For colour escape sequences, they should also be followed by a lowercase m. See http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html as of 2010-05-20.

#
# Text attributes
# 0     All attributes off
# 1     Bold on
# 4     Underscore (on monochrome display adapter only)
# 5     Blink on
# 7     Reverse video on
# 8     Concealed on
#
#Foreground colors
# 30    Black
# 31    Red
# 32    Green
# 33    Yellow
# 34    Blue
# 35    Magenta
# 36    Cyan
# 37    White
# 
#Background colors
# 40    Black
# 41    Red
# 42    Green
# 43    Yellow
# 44    Blue
# 45    Magenta
# 46    Cyan
# 47    Whit

Some examples as you might use them in a Bash script:

echo -en "$EINS\033[1;031\033[1;031;47m 24 bold red on white OK\033[0m\n";
echo -en "$EINS\033[1;030\033[1;030;46m 25 bold black on l blue OK\033[0m\n";
echo -en "$EINS\033[44;1;31m 26 - light red fg blue back test #1 OK \033[0m\n";
echo -en "$EINS\033[44m\033[1;31m 26 - light red fg blue back #2 OK \033[0m\n";
echo -en "$EINS\033[0m\033[0;00m 26 - should be normal OK \033[0m\n";

awk

Awk is most oftem used to split a delimited stream into tokens:

echo `date` | sed 's/\// /g' | awk '{print " " $1 " " $2 " " $3 " " $4 " " $5 " " $6}'
Thu 22 Dec 2011 18:40:10 CST

Awk default delimiter

Awk uses a blank as the default delimiter:

while read line
do
echo $line | awk '{print $0}' # prints the whole string
echo $line | awk '{print $1}' # prints the 1st part of the string delimited using a blank.
done

Kill a particular process ID using ps, grep, awk and kill commands

ps;kill `ps | grep xterm | grep system.log | grep -v grep | awk '{print $1}'`

Split a string using a delimiter (using Sed and Awk)

There are lots of ways to do this but here's one simple example that is not very hard to read:

# Using sed and awk to split the actual $HOME string directly into string variables part1 and part2 .. 
#  splits the tokens of the folder name assuming it's a UNIX-styler home folder name formatted like /token1/token2

part1=`echo $HOME | sed 's/\// /g' | awk '{print $1}'` 
echo $part1

part2=`echo $HOME | sed 's/\// /g' | awk '{print $2}'`
echo $part2

Top

B

Bash scripts

Bash is a big subject but here are things I have found very useful and want to have a quick reference to.

Check if a file has non-zero length

if [ -s "/tmp/$NOW.html" ]
        then open -a Firefox.app "/tmp/$NOW.html"
else echo "No results"

fi

For loop ...

# Split the tokens of the $HOME folder name - assuming it's a UNIX-style name formatted like /token1/token2

SRCDpart1=`echo $HOME | sed 's/\// /g' | awk '{print $1}'`
echo $SRCDpart1

SRCDpart2=`echo $HOME | sed 's/\// /g' | awk '{print $2}'`
echo $SRCDpart2

# Set up a list of sub-folder names (single level)

FOLDERS="Documents Downloads Library Sites Xcode"

# Process the list 

        for folderName in $FOLDERS
                do
                        NOW="$(date +%Y-%m-%d.%H%M)"
                        echo "    starting $foldername at $NOW"
                        tar -cvzf $TGTD/$HOST.$SRCDpart1.$SRCDpart2.$folderName.$NOW.tgz $SRCD/$folderName
                        echo "          using command tar -cvzf $TGTD/$HOST.$SRCDpart1.$SRCDpart2.$folderName.$NOW.tgz $SRCD/$folderName"
                        echo "    starting $foldername at $NOW"
                        NOW2="$(date +%Y-%m-%d.%H%M%S)"
                        echo "    ended $foldername at $NOW2"
                done

I/O redirection

There are always three default files open, stdin (the keyboard), stdout (the screen), and stderr (error messages output to the screen). These, and any other open files, can be redirected. Redirection simply means capturing output from a file, command, program, script, or even code block within a script and sending it as input to another file, command, program, or script.

Each open file gets assigned a file descriptor. The file descriptors for stdin, stdout, and stderr are 0, 1, and 2, respectively. For opening additional files, there remain descriptors 3 to 9. It is sometimes useful to assign one of these additional file descriptors to stdin, stdout, or stderr as a temporary duplicate link. This simplifies restoration to normal after complex redirection and reshuffling.

Examples:

  # Single-line redirection commands (affect only the line they are on):
      # --------------------------------------------------------------------

   1>filename
      # Redirect stdout to file "filename."
   1>>filename
      # Redirect and append stdout to file "filename."
   2>filename
      # Redirect stderr to file "filename."
   2>>filename
      # Redirect and append stderr to file "filename."
   &>filename
      # Redirect both stdout and stderr to file "filename."
      # This operator is now functional, as of Bash 4, final release.

   do_something 2>&1 | tee -a some_file
#  Redirects stderr and stdout to tee, which prints it to both a file and stdout.

See http://tldp.org/LDP/abs/html/io-redirection.html

Read through a file ...

#!/bin/bash

ls data.*.txt | cut -c 1-28 > "/tmp/datalist.txt"

# open file "/tmp/datalist.txt" for reading
exec 6<"/tmp/datalist.txt"
# read until end of file
while read -u 6 dta
do
   echo "$dta"; dta2=$dta; # echo "$dta2" 
done
# close file 
exec 6<&-

echo "Last file listed was: $dta2"

exit

Selection using case

        case "$HTTPcode" in
                "304" )
                        echo -en "$EINS\033[43m$line\033[0m\n"
                        ;;
                "400" )
                        echo -en "$EINS\033[41m$line\033[0m\n"
                        ;;
                "404" )
                        echo -en "$EINS\033[45m$line\033[0m\n"
                        ;;
                * )
                        echo -en "$EINS\033[32m$line\033[0m\n"
                        ;;
        esac

Set a string variable to the current date and time

NOW="$(date +%Y-%m-%d.%H%M)";echo "$NOW" will output: 2010-10-18.1738

Set the date and time from the command line

This sets the date to Tue Feb 14 15:17:54 CST 2017:
# MMDDHHMMCCYY.ss
sudo date 021415172017.54

Set a string variable from a file

HTTPcode=`cat readlog.work.file.txt`
echo "HTTPcode is $HTTPcode"

Split a string using a delimiter (using Awk)

Awk uses a blank as the default delimiter:

while read line
do
echo $line | awk '{print $0}' # prints the whole string
echo $line | awk '{print $1}' # prints the 1st part of the string delimited using a blank.
done

Split a string using a delimiter (using Sed and Awk)

There are lots of ways to do this but here's one simple example that is not very hard to read:

# Using sed and awk to split the actual $HOME string directly into string variables part1 and part2 ..
#  splits the tokens of the folder name assuming it's a UNIX-styler home folder name formatted like /token1/token2

part1=`echo $HOME | sed 's/\// /g' | awk '{print $1}'`
echo $part1

part2=`echo $HOME | sed 's/\// /g' | awk '{print $2}'`
echo $part2

Substitution

Evaluate (execute or run) a variable:

eval "${command:2}"

Substitute a command line parameter within a quoted string:

echo "select Code from Strings where (Code like '%${1}%'); " | sqlite3 ./addtest.sqlite

Substitute a variable within a double-quoted string (a.k.a. "Weak Quoting"):

echo "-- assuming your table is called Strings and
-- was created like this:
create table Strings( ID integer primary key, Code text );
create table StringsImport( Code text );
.import $prefix.file.txt StringsImport
insert into Strings ( Code ) select * from StringsImport;
drop table StringsImport; " | sqlite3 ./$prefix.sqlite

You can also use this form:

 
echo " ..... ${prefix}.file.txt ...."

This does not work inside single quotes a.k.a. 'Strong quoting', where variable substitution does not take place.

Single-quoting means you have to handle apostrophes this way:

echo 'Why can'\''t I write '"'"'s between single quotes?'
echo 'It'"'"'s interesting that using apostrophes doesn'\''t work between single quotes.'

The previous example must be coded this way if using single quotes:

echo '-- assuming your table is called Strings and
-- was created like this:
create table Strings( ID integer primary key, Code text );
create table StringsImport( Code text );
.import '"${prefix}"'.file.txt StringsImport
insert into Strings ( Code ) select * from StringsImport;
drop table StringsImport; ' | sqlite3 ./$prefix.sqlite

bc

bc is a command line calculator. For example:
echo "1+3;./2" | bc
will return ..
4 2

Another example:
hostname:~ user$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
41.19+119+30+28+67+91
376.19

Top

C

Cron

cron for OSX

See http://hints.macworld.com/article.php?story=2001020700163714 for a good discussion.


In OSX, /etc/crontab says:
-------------------------

# The periodic and atrun jobs have moved to launchd jobs
# See /System/Library/LaunchDaemons
#
# minute        hour    mday    month   wday    who     command

1) Use cp -pr /etc/crontab ~/.crontab to copy this

2) Use crontab .crontab to add this to cron's list

3) Now use crontab -e to edit and then check the crontab   

# Format used in /etc/crontab:
#
# minute        hour    mday    month   wday    who     command
#
# Format to be used in ~/.crontab:
#
# minute        hour    mday    month   wday    command
#
# NOTE: Use TAB to separate entries!
#
# Here are mcook's crontab entries:
#
0       *       *       *       *       cd ~/Sites/bm;chmod +r *;logger mcook ~Sites/bin chmod +r
15      *       *       *       *       cd ~/Sites/bm;chmod +r *;logger mcook ~Sites/bin chmod +r
30      *       *       *       *       cd ~/Sites/bm;chmod +r *;logger mcook ~Sites/bin chmod +r
45      *       *       *       *       cd ~/Sites/bm;chmod +r *;logger mcook ~Sites/bin chmod +r

4) Use crontab -l to list your cron tables.

Here are some more examples of entries in root's format:

# minute        hour    mday    month   wday    who     command

23 17 * * * /etc/webmin/cron/tempdelete.pl #Delete Webmin temporary files
7 12 * * * /etc/webmin/cron/tempdelete.pl #Delete Webmin temporary files

cron for Linux


In Linux:
--------

sudo crontab -l

25 23 * * * /etc/webmin/cron/tempdelete.pl #Delete Webmin temporary files
0,15,30,45 * * * * chmod -R +r /var/log/* && logger  -i -s -p local3.info system.info -t root_cron_set_var_log_star_chmod_R_plus_r -- root_cron_set_var_log_star_chmod_R_plus_r

css

Embed an external stylesheet like this:

<head>
<link rel=stylesheet href="http://skyprod.net/css/css2.css" type="text/css">
</head>

Top

D

date

date returns e.g. Mon Dec 26 03:26:44 CST 2011 on OSX 10.4.11 (PPC).

date returns e.g. Mon 26 Dec 2011 03:29:15 CST on OSX 10.7.2 (x64).

Use man strftime to review how the output of the date command can be formatted.

NOW="$(date +%Y-%m-%d.%H%M)" gets the current date and time in YYYY-MM-DD.HHMM format useful for timestamping files in Bash.

RFC-822 date format (RSS "pubDate") is Mon, 26 Dec 2011 03:29:15 CST.

date "+%a, %b %d %Y %H:%M:%S %Z" will return Mon, Dec 26 2011 03:51:39 CST on PPC and x64.

date "+%s" returns the number of seconds since the Epoch as expressed by gettimeofday, for example 1324895338 was Mon 26 Dec 2011 04:28:58 CST. The time is expressed in seconds and microseconds since midnight (0 hour), January 1, 1970 UTC. Use date -r 1324895338 to reverse this to Mon 26 Dec 2011 04:28:58 CST.

Set the date and time from the command line

This sets the date to Tue Feb 14 15:17:54 CST 2017:
# MMDDHHMMCCYY.ss
sudo date 021415172017.54

See also T

other commands starting with "d"

df -- display (list) space per volume

diff f1 f2

date;diff -qr '/Library/Apache2/htdocs/skyprod.net' \ '/Volumes/FILE SYSTEM/var/www/Documents2/skyprod.net' | \ grep -v -e 'DS_Store' -e 'Thumbs' | sort > \ diffs.MONAwwwskyprod.net.BERTHAwwwskyprod.net.2008-01-09g.txt;date

df -k -F cifs -- display (list) active cifs shares, gives output like this:

mcook@bertha:/mnt/mona/mcook/Documents$ df -k -F cifs
Filesystem           1K-blocks      Used Available Use% Mounted on
//mona/mcook         156155904 104329216  51826688  67% /mnt/mona/mcook

df -k -F smbfs -- display (list) active smbfs shares

du -- displays (lists) the size in blocks of all files in all sub-folders

du -s -- just works in this folder

du -sh -- human output (e.g. 4.5G, 250M)

du -csh -- total, summary only, human output (e.g. 4.5G, 250M)

Top

E

eject

Use the eject command to open your CD-ROM drive

emacs

See emacs.3.html as of 2011-12-31.

Top

F

find

The find command searches folders recursively.

find by name

List files whose names include the string "fseek1d":

find . -type f | grep fseek1d
# -type d for directories

List all objects whose names include the string "fseek1d":

find . -print | grep fseek1d

Alternatively:

find . -print | grep -e fseek1d | less
# -e specifies a regexp to match
# -E specifies an extended regexp to match

find and delete

To remove multiple files such as *.jpg or *.sh with one command find, use:

find . -name "FILE-TO-FIND" -exec rm -rf {} \;

OR

find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;

The difference between the two examples is that the first command removes directories and files whereas the second command only removes files.

find by content

List files that contain the string "fseek1d":

find . -type f | xargs grep -l fseek1d | less
# -l print the name of each input file name that contains matching data 
# -L print the name of each input file name that does not contain matching data 

Note that grep may report "No such file or directory" if names include blanks. You may need to use find -print 0 and xargs -0 like this:

find . -type f -print0 | xargs -0 grep -l fseek1d | less 

find and then list content

List matching lines within files that contain the string "fseek1d":

find . -print | xargs grep -e fseek1d | less

Again, grep may report "No such file or directory" if names include blanks, or sometimes xargs will object to special characters (like quotes and blanks) in file names and you will get a message such as "xargs: unterminated quote". If so you can use the following:

To find all file names in the current folder that contain the string "fseek1d":

find . -type f -print0 | xargs -0 grep -l 'fseek1d'
# -print0 tells find to use the NUL character (rather than line feed) to separate the output
# -0 tells xargs to use the NUL character as the separator.  

To find all lines within files in the current folder that contain the string "fseek1d" (with folder recursion):

find . -type f -print0 | xargs -0 grep -e 'fseek1d'

find - other uses

Find using globbed name:

find ~/Journalism -name '*.txt'

Find using globbed regex for pathname (any depth):

find ~/Programming -path '*/src/*.c'

FTP

Using FTP from batch

Use .netrc in home folder to control auto-login.

machine ftp.isp.net login mylogin password mypassword

.netrc can also contain macros like this:

macdef myput1
  hash
  bin
  delete index.new2.html
  put index.new2.html
  quit

Invoke macros like this:

echo $myput1 | ftp ftp.isp.net

Easier to embed FTP commands in a script like this:

#!/bin/bash
#
# See http://lowendmac.com/2009/automating-ftp-on-the-mac/ as of 2014-11-13.
# ~/.netrc alrady exists
#
/usr/bin/ftp -d ftp.isp.net << ftpEOF
   prompt
   cd pub
   delete "index.html"
   put "index.html"
   quit
ftpEOF

Top

G

gshred

See zeroize.

grep

This will show only lines containing the expression defined by -e:

cat skyprod.net.access_log.0-text.txt | grep -e 's0106001346a25c35.wp.shawcable.net' | less

This will show only lines that do not contain the expression:

cat skyprod.net.access_log.0-text.txt | grep -v -e 's0106001346a25c35.wp.shawcable.net' | less

See also the section on the diff command above.

Use grep together with wc to count instances of a word in a file:

    
    # Now count instances of "RSSpermalink"
    count=`grep -o RSSpermalink production-feed2.xml.tmp | wc -w`

GNU Interactive Tools (gitfm aka gnuit)

Ctrl-X, d ... go to directory

Home Esc < ... go to first line of panel

End Esc > ... go to last line of panel

Esc+s+d ... sort this panel by last modified date

Esc+s+n ... sort this panel by name

^S, ^Xs

Incremental search forward a file name in the current panel
(isearch-forward).  Pressing ^S or ^Xs again will
force gitfm to go to the next entry that matches the current
isearched string.  When the end of the panel is reached, the isearch is
restarted from its beginning.

^R, ^Xr

Incremental search backward a file name in the current panel
(isearch-backwardâ).  Pressing ^R or ^Xr again will
force gitfm to go to the next entry that matches the current
isearched string.  When the beginning of the panel is reached, the
isearch is restarted from its end.

^X 0
        
Enlarges the other panel to use the entire screen.  It also changes the
minor mode to Enable all.  The current panel will become
invisible (enlarge-other-panel).

^X 1
        
Enlarges the current panel to use the entire screen.  It also changes
the minor mode to Enable all.  The other panel will become
invisible (enlarge-panel).

^X 2
        
Switches back to the two panel mode (two-panel-mode).

Top

H

hexdump

Use hexdump -C <filename> to show ASCII and Hex contents of the file.

Top

I

Top

J

Jobs (UNIX)

& -- starts the named program in the background

Ctrl+Z -- halts the program (e.g. vim if you're stuck in visual mode and don't know how to get out of it).

jobs -- lists jobs in the background (usually "Stopped")

jobs -l -- lists the process numbers so you can use kill.

fg -- brings the job marked with + back to the foreground

fg %3 -- brings job number 3 back.

bg %2 -- resumes job 2 if stopped, but leaves it in the background

stop %2 -- stops that job.

Top

L

Linux version check

To check Linux version:

mcook@bertha:~$ cat /etc/issue
Ubuntu 8.04.2 \n \l

mcook@bertha:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"

mcook@bertha:~$ uname -a
Linux bertha 2.6.24-24-generic #1 SMP Wed Apr 15 15:54:25 UTC 2009 i686 GNU/Linux

logger

See examples in the section above on cron

Top

M

META tag in HTML

Used to specify character set in HTML "head" and/or XML, e.g.:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

..etc. ..

Other common character sets ..

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

mc - Midnight Commander

You can use this as an alternative to GNU Interactive Tools (gitfm a.k.a gnuit).

Some commands are similar, others are different:

Similar to gnuit:
----------------

Esc+p   recalls the last command on the mc commands line.

Different to gnuit or not available:
-----------------------------------

Copy directory name of the opposite panel to the command line.

mkisofs

To make an ISO image file fropm a CD or DVD:

dd if=/dev/dvd of=dvd.iso # for dvd
dd if=/dev/cdrom of=cd.iso # for cdrom
dd if=/dev/scd0 of=cd.iso # if cdrom is scsi

To make an ISO image from files on your hard drive, create a directory which holds the files you want, then:

mkisofs -o /tmp/cd.iso /tmp/directory/ 

Top

mount

mount /dev/sdb1 /mnt/sdb1

mount -t smbfs -o username=uuuuuuu,password=ppppppppp //Workgroup/Host/Share-D /Volumes/Host-Share-D

sudo mount -t cifs //mona/mcook /mnt/mona/mcook -o / username=user,password=password,uid=1000,gid=1000,file_mode=0640,dir_mode=0750,iocharset=utf8 -- mounts the share for the same username and password on both systems but overrrides user number and group number from the current system for use when the target system uses different user number and group number.

mount -o loop -t iso9660 file.iso /mnt/test

Top

N

NTP

You can check NTP status using these commands:

sudo ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*time.apple.com  17.254.0.49      2 u  22h  36h  177   92.508   16.888  28.547

sudo ntpdc
ntpdc> sysstats
time since restart:     283107
time since reset:       283107
packets received:       20
packets processed:      17
current version:        17
previous version:       0
bad version:            0
access denied:          0
bad length or format:   0
bad authentication:     0
rate exceeded:          0
ntpdc> 

Top

O

OSX

Command+S - usually "save"

Command+Tab -- show active applications in a tabbable list

Command+W -- close the active window (e.g. in Textedit or Finder).

open -a iCal.app -- to open iCal from the command line (e.g.).

open-x11 xterm -- to open an X11 application (e.g.). Starts X11 first. Does not pass any parameters.

Option+Command+Escape -- brings up Force Quit dialog.

Top

R

Redirection

See I/O Redirection.

Rename files in OSX terminal

OSX includes no rename command (unlike Linux).

This command will rename *.JPG files to *.jpg:

for i in *.JPG; do mv "$i" "${i/.JPG}".jpg; done

This command will remove "73" from the list of files 73mcookt22.*:

for i in 73mcookt22.*; do mv "$i" "${i/73}"; done

This command will remove .Z from a list of files *.Z:

for i in *.Z; do mv "$i" "${i/.Z}"; done 

Remote install of OSX using tftp and nfs from Ubuntu 8.04

Work in progress on this section.


After two attempts at re-installing via tftp/nfs "net install", and still getting IO errors on the HD, also having broken the DVD-ROM connector on the
motherboard riser, I took the Mac Mini in to Mac Helper. 

Fri 08 Jan 2010 04:50:47 PM CST 

Still working towards netinstall of OSX on Mac mini with broken hard DVD drive. 

See http://www.linuxquestions.org/questions/linux-networking-3/netinstall-341580/ ... simplest menu so far.

Installed tftpd .... 

Selecting previously deselected package tftpd.
(Reading database ... 271257 files and directories currently installed.)
Unpacking tftpd (from .../tftpd_0.17-15ubuntu1_i386.deb) ...
Setting up tftpd (0.17-15ubuntu1) ...
--------- IMPORTANT INFORMATION FOR XINETD USERS ----------
The following line will be added to your /etc/inetd.conf file:

tftp            dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd /srv/tftp

If you are indeed using xinetd, you will have to convert the
above into /etc/xinetd.conf format, and add it manually. See
/usr/share/doc/xinetd/README.Debian for more information.
-----------------------------------------------------------

Removed tftp as above.

Install tftp-ha instead ...

Preconfiguring packages ...
(Reading database ... 271264 files and directories currently installed.)
Removing tftpd ...
Purging configuration files for tftpd ...
Selecting previously deselected package tftpd-hpa.
(Reading database ... 271257 files and directories currently installed.)
Unpacking tftpd-hpa (from .../tftpd-hpa_0.48-1ubuntu1_i386.deb) ...
Setting up tftpd-hpa (0.48-1ubuntu1) ...
--------- IMPORTANT INFORMATION FOR XINETD USERS ----------
The following line will be added to your /etc/inetd.conf file:

tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

If you are indeed using xinetd, you will have to convert the
above into /etc/xinetd.conf format, and add it manually. See
/usr/share/doc/xinetd/README.Debian for more information.
-----------------------------------------------------------

All following steps as root ...

Updated /etc/inetd.conf ...

## netbios-ssn     stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/smbd
####tftp                dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd /srv/tftp
tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

Edited /etc/default/tftpd-ha ... RUN_DAEMON="yes"

Mounted Tiger install disk and as root:

cp /cdrom/System/Library/CoreServices/BootX /var/lib/tftpboot/BootX (not actually renamed)
cp /cdrom/mach_kernel /var/lib/tftpboot/mach.macosx
cp /cdrom/System/Library/Extensions.mkext /var/lib/tftpboot/mach.macosx.mkext

Unmounted cd and make a simple image of the Mac Install CD in the TFTP server root.

dd if=/dev/scd0 of=/var/lib/tftpboot/tiger.img

Then etc/init.d/tftpd-hpa start and sudo /etc/init.d/nfs-kernel-server restart.

Updated NFS exports ... for 192.168.2.100 ...

/var/lib/tftpboot/ mac-ip-address(ro)

Restart the TFTP server and NFS server.

On the Mac ... boot into open firmware (by holding command+option+O+F) and issue the following commands:

setenv boot-device enet:ip-address-of-linux-server,BootX
setenv boot-args rp=nfs:ip-address-of-linux-server:/var/lib/tftpboot/:tiger.img
boot

Had to change username for tftpd from nobody (nogroup) to root as above.

Now I get the network boot screen, then a big black square after ...
Jan 10 06:00:41 bertha mountd[6028]: refused mount request from 192.168.2.100 for /var/lib/tftproot/ (/): not exported

Top

Remote X login

From MONA, to get remote X session on BERTHA:

                        1) Start X on MONA
                        2) In xterm: ssh -X mook@bertha  (or can go ...  ssh -2 -Y mcook@bertha .. not tried today)
                        3) Note that echo $DISPLAY should return: localhost:10.0
                        4) Run (e.g.): xterm &, or mahjongg & (or can go ... gnome-panel, or: startkde ... not tried today).
                        NOTES:
                        a) Did not first check Xforwarding is enabled in /etc/ssh_config and sshd_config
                        b) gnome-session has a bug.
                        c) After mahjongg & exits from xterm on BERTHA I get 1 error like below.
                        d) gnome-session does not start

Top

rsync

Basic rsync commands

Have username and password identical on both source and target systems.

To copy all *.txt files to named folder (without replacement or folder recursion):

rsync -t *.txt 192.168.2.107:/home/mcook/bin/test-rsync

To synchronize files/directories between the local and remote system.

rsync -avz $SOURCE_FILESPEC $RHOST:$REMOTE_FILESPEC

Top

Automating remote login for rsync, ssh, etc.

Again, have username and password identical on both source and target systems.

rsync --password=<filename> will not work if rsync uses ssh. In this case, to avoid having to enter ssh password manually:


        Source system                                   Target system
        +-----------------+                             +-----------------+
        |                 |                             |                 |
        |                 |                             |                 |
        |     OSX         |                             |     Ubuntu      |
        | 192.168.2.106   |                             | 192.168.2.107   |
        |  mona.local     |                             |   bertha.local  |
        |                 |                             |                 |
        |                 |                             |                 |
        +-----------------+                             +-----------------+     

First, you have to generate an ssh public key on the source system  like this:

        ssh-keygen -t rsa

        -- type enter (default) after each question even for password, press enter
        -- it will generate 2 files : the private key and the public key (id_rsa.pub is your public key)

        Generating public/private rsa key pair.
        Enter file in which to save the key (/Users/mcook/.ssh/id_rsa): 
        Enter passphrase (empty for no passphrase): 
        Enter same passphrase again: 
        Your identification has been saved in /Users/mcook/.ssh/id_rsa.
        Your public key has been saved in /Users/mcook/.ssh/id_rsa.pub.
        The key fingerprint is:
        a0:16:24:a7:28:63:ef:ae:58:49:c0:cd:9f:fa:33:02 mcook@mona.local
        The key's randomart image is:
        +--[ RSA 2048]----+
        |  . o            |
        |..o=             |
        |=o.o. .          |
        |oo. .o..         |
        |  ..oo  S        |
        | E.o.            |
        |  +o             |
        |.....o           |
        |......o          |
        +-----------------+
                
You then have to copy your public key to the target system:

        scp ~/.ssh/id_rsa.pub 192.168.2.107:.ssh/authorized_keys

Now try ssh 192.168.2.107 echo ... it should no longer ask for a password!
                        
        -- you might need to restart sshd on either system
        -- check your security log on the target system if you are still having a problem
        -- from the public key generated on MONA (source system) ~/.ssh/id_rsa.pub ..
                -- You must create the file (e.g. /home/mcook/.ssh/authorized_keys) on the target system if it does not already exis.
                        (this must NOT be a directory). 
                -- Use cat or an editor to add extra public keys to an existing authorized_keys file (per user).
                        
ssh, rsh, and rsync should no longer require a password going to target host bertha.local from source host mona.local.

To set this up in reverse:

        1) on bertha.local ssh-keygen -t rsa
        2) Concatenate the public key with~/.ssh/authorized_keys on the OSX system.

Top

S

Sed

Sed is a non-interactive editor. Instead of altering a file by moving the cursor on the screen, you provide sed with a script of editing instructions. sed can edit files in place or redirect its output. You can also describe sed as a filter.

Here are some examples:

$sed 's/to_be_replaced/replaced/g' /tmp/dummy

Sed replaces the string 'to_be_replaced' with the string 'replaced' and reads from the /tmp/dummy file. The result will be sent to stdout (normally the console) but you can also add '> capture' to the end of the line above so that sed sends the output to the file 'capture'.

sed is often used to edit a file in place:

sed -i "" 's/\|/ /' file_to_be_edited_in_place.txt

NOTE: -i "" specifies in-place editing AND the default "backup extension", which is zero-length (i.e. NULL), meaning NO backup will be saved. Editing in place is NOT recommended, and the -i flag is required to edit in place on OSX, although not on Ubuntu.

$sed 12, 18d /tmp/dummy

Sed shows all lines except lines 12 to 18. The original file is not altered by this command.

See also: http://www.grymoire.com/Unix/Sed.html

More examples:-

Replace all occurrences of a string:-


    # REPLACE ALL ====RSSpubdate==== with newRSSdate

    sed "s/====RSSpubdate====/${newRSSdate}/g" dateforRSS.production-feed2.template.xml > production-feed2.xml.tmp   

Replace only the first occurrence:

  
    # THIS REPLACES THE FIRST OCCURRENCE THEN STOPS
    
    # Replace only the FIRST occurrence
    #       of "RSSpermalink" in each new generation of the work file
    #            AND THEN STOPS
    
    sed "1,/====RSSpermalink====/s/====RSSpermalink====/${nowms}/" \
    production-feed2.xml.tmp2 > production-feed2.xml.tmp.$counter
    

ss

ss is a useful and flexible alternative to using netstat.

In the simplest form ss is equivalent to netstat with some small deviations.

ss -t -a dumps all TCP sockets
ss -u -a dumps all UDP sockets
ss -w -a dumps all RAW sockets
ss -x -a dumps all UNIX sockets

Option -o shows TCP timer state. 
Option -e shows some extended information.

Without option -a sockets in states TIME-WAIT and SYN-RECV are skipped.

The format of UNIX sockets coincides with tcp/udp.

The default is to dump only TCP sockets.

By default ss does not resolve numeric host addresses. This is enabled using option -r.
 
Service names, usually stored in local files, are resolved by default. 

For example, try: ss -o state established '( dport = :http or sport = :http )'

Gives output like:

mcook@bertha:/usr/share/tomcat5.5/bin$ ss -o state established '( dport = :http or sport = :http )'
Recv-Q Send-Q                                                       Local Address:Port                                                           Peer
Address:Port   
0      0                                                            192.168.2.107:47746
66.249.81.100:www     

stat

The stat command lists inode information for the named file. In MacOS this includes four time stamps:

  1. Time when file data last accessed.
  2. Time when file data last modified.
  3. Time when file status was last changed (inode data modification).
  4. Time of file creation. Only set once when the file is created. This field is only available in the 64 bit inode variants. On filesystems where birthtime is not available, this field is set to 0 (i.e. epoch).

stat filename on Linux will print output like this:

stat .gdbinit
  File: `.gdbinit'
  Size: 55              Blocks: 1          IO Block: 4096   regular file
Device: 803h/2051d      Inode: 16267       Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2010-06-09 19:19:34.000000000 -0500
Modify: 2009-02-17 20:31:26.000000000 -0600
Change: 2010-06-09 18:57:46.000000000 -0500

On older (non-64 bit) OSX you will get:

stat xtab
234881026 44591 -rw-r--r-- 1 root wheel 0 0 "May 27 12:05:27 2005" "May 27 12:05:27 2005" "Feb 19 10:42:00 2010" 4096 0 0 xtab

Or to see times in seconds from 00:00 on 1 Jan 1970:

stat -r xtab
234881026 44591 0100644 1 0 0 0 0 1117213527 1117213527 1266597720 4096 0 0 xtab

On newer OSX and MacOS (64-bit) you will see:

stat .gnuitrc.xterm-color 
16777220 29004526 -rw-r--r-- 1 mcook staff 0 21524 "Sep 22 22:44:01 2016" "Jul 11 14:00:08 2015" "Sep 22 22:42:39 2016" "Jul 11 14:00:08 2015" 4096 48 0 .gnuitrc.xterm-color

Top

T

Terminals

gnome-terminal and xfce4-terminal are common Linux "wrappers" for xterm.

The default size of the gnome terminal window in Fedora Core 3 can be modified by editing /usr/share/applications/gnome-terminal.desktop. Modify the Exec= entry to read:

Exec=gnome-terminal --geometry=120x30

Otherwise, to override size, start like this:

gnome-terminal --geometry=120x32

Time

How to get all three timestamps for a file

See the information on the stat command above.

How to get time in milliseconds, or even nanoseconds

Different versions of the date command

The output from date varies depending on the version. For example, in OSX 10.4.11 the BSD version of date only gives time in seconds.

If using GNU date (on Linux), this script ..

#!/bin/bash
# Returns date in nanoseconds (GNU date version 6) - does not work when using BSD date in OSX 10.4.11 PPC or OSX 10.7.2 x64.
echo $0
uname -a
date
date "+%s"
date --version|head -n1
NS=`date +%s%N`
echo $NS

Will return output like this ..

./get-tod-in-nanosec.sh
Linux cara 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37 UTC 2011 i686 GNU/Linux
Mon Dec 26 05:21:17 CST 2011
1324898477
date (GNU coreutils) 7.4
1324898477646624489
How to get time in nanoseconds using Perl

You can use a Perl script from Bash like this:

#! /bin/bash
i=0              
while [ $i -le 60 ]
do   
ms=$( perl -MTime::HiRes -e 'print int(1000 *
Time::HiRes::gettimeofday),"\n"' )
sec=$( date '+%S' )
printf '%2d %d\n' "$sec" "$ms"
sleep 1
i=$(( $i + 1 ))
done

See also D

How to get utilization information for a program

Using the time command

time Program_name Parameters will run the named program passing the parameters and then report like this:

real    0m0.364s
user    0m0.001s
sys     0m0.008s

More explanation:

     
The time [command] executes and times [the named program, passing paramters to it if specified.  
After the program finishes, time writes the total time elapsed, the time consumed by system overhead,
and the time used to execute [the program] to the standard error stream.  Times are reported in seconds.

Available options:

     -l      The contents of the rusage structure are printed.
     -p      The output is formatted as specified by IEEE Std 1003.2-1992 (``POSIX.2'').

An example:

mona:/usr/bin mcook$ time -p date
Wed Jun 16 16:52:08 CDT 2010
real 0.05
user 0.00
sys 0.00
Using the times Bash builtin

Bash has a builtin C function called times. You find this on Linux and OSX and it can be run both from the command line or within a script provided you are using Bash.

The times() function returns the value of time in CLK_TCK's of a second
     since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Univer-
     sal Time.

     It also fills in the structure pointed to by tp with time-accounting
     information.

     The tms structure is defined as follows:

           struct tms {
                   clock_t tms_utime;
                   clock_t tms_stime;
                   clock_t tms_cutime;
                   clock_t tms_cstime;
           };

     The elements of this structure are defined as follows:

     tms_utime   The CPU time charged for the execution of user instructions.

     tms_stime   The CPU time charged for execution by the system on behalf of
                 the process.

     tms_cutime  The sum of the tms_utimes and tms_cutimes of the child pro-
                 cesses.

     tms_cstime  The sum of the tms_stimes and tms_cstimes of the child pro-
                 cesses.

     All times are in CLK_TCK's of a second.

Here is an example, with results to 1/1000 of a second:

mona:~/bin mcook$ times
0m0.024s 0m0.036s
0m6.323s 0m1.973s
mona:~/bin mcook$ 

The first column is user time, the second is system time. The first row is times for the shell and the second row is all reaped children.

NOTE: because times uses accounting information, the results [seem to?] accumulate for successive executions of times within the current shell instance only. This means it [might not be?] suitable for iteritave use within a script when trying to time command execution.

top

The top command in Linux provides several useful hot keys:

Hot Key Usage
t       Displays summary information off and on.
m       Displays memory information off and on.
A       Sorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.
f       Enters an interactive configuration screen for top. Helpful for setting up top for a specific task.
o       Enables you to interactively select the ordering within top.
r       Issues renice command.
k       Issues kill command.
z       Turn on or off color/mono
1       Toggles multiple CPU information 
?       Prints help information.

The top command in OSX is a BSD variant: command line options and interactive keys differ.

Use top -X for compatibility mode.

     State  Command        Description
            ?              Display this help screen, regardless of context.
            ^L             Redraw the screen.
         n  c        Set event counting mode to {a|d|e|n}.
        on  f              Toggle shared library reporting.
2147483647  n      Only display  processes.
      -pid  O        Set secondary sort key to  (see o).
      -pid  o         Set primary sort key to : [+-]{command|cpu|pid
                           |prt|reg|rprvt|rshrd|rsize|th|time|uid|username|vprvt
                           |vsize}.
            q              Quit.
        on  r              Toggle process memory object map reporting.
            S\n  Send signal  to pid .
         1  s       Set the delay between updates to  seconds.
       off  t              Toggle uid to username translation.
            U        Only display processes owned by , or all.
    narrow  w              Toggle wide/narrow delta mode.

touch

touch -a -m -t 200905252300 mcookt22.mac.2009-05-25.txt; ls -lisa mcookt22.mac.2009-05-25.txt

Top

V

Vi and Vim

My very own totally incomplete vi reference

Moving and Deleting

h/j/k/l -- move left/down/up/right

0 (zero) -- move the cursor to the start of the current line

$ -- move the cursor to the end of the current line

1G -- move to the top of the file

nnnG -- move the cursor to line nnn

999G -- move to the end of the file (or not)

b -- move the cursor to the beginning of the previous word (use w to move forward)

D -- deletes the content of the current line

dd -- deletes the current line

G -- moves to the end of the file

g -- does the same

w -- moves the cursor to the beginning of the next word

Ctrl+F and Ctrl+B -- page up and down

Top

Commands

Esc -- get into (or leave) command mode when you can enter commands prefixed with a colon, including:

:a -- append to the end of the current line

:e filename -- edits the new file -- use with :n and :rew to edit multiple files in one vi session.

:file -- displays the current file name.

:history -- displays vi's command history.

:i -- insert at the current cursor position

:j -- join this line and the next

. -- when used after text insertion, duplicates the inserted text

:n -- moves to the next file (this does not loop back to file 1 of n, use :rew for that)

: -- then use arrow keys to scroll through vi command line history.

:r filename -- reads and appends filename

:rew -- moves back

:redo -- redoes last undo

:%s/old/new/g -- search and replace: on all lines %, or specify from/to line numbers as from_line_number, to line_number, e.g. 1,10)

:%s/old/new/gc -- search and replace with confirmation (line specified as above)

:%s/^M/^M /g followed by :%s/^M//g to replace ^M characters in file (use Ctrl+V then Ctrl+M to get the ^M).

:se nocp OR :set nocompatible

Creating ~/.vimrc can help - read :help compatible

:set nu -- show line numbers

:set nonu -- remove line numbers

:u -- undo

Top

UNIX commands from vi

To edit text in hex use :%!xxd use %!xxd -r to return to regular ASCII mode.

:%!colrm 1 4 -- delete columns 1 to 4 throughout the data (shift left 4 columns).

Try :\tp if you are stuck in insert mode after using visual and/or some other rare key combination.

Top

End-of-line characters

If you are using vi on a UNIX-like system, the [CTRL][V] tells the computer NOT to execute the next command [CTRL][M] -- which is a new line or carriage return 0x0D -- but to write it instead.

If you are using vim in Windows, you have to use [CTRL][Q] instead of [CTRL][V] since on Windows [CTRL][V] is mapped to "Paste". The [CTRL] character will always appear as '^' in the file.

Windows programs end each line with two characters: <new-line><carriage-return> \n\r or 0x0A0x0D, whereas UNIX ends a line with only one character <new-line> \n or 0x0A.

I believe a new-line character is [CTRL][L] and the carriage return is [CTRL[M].

Use this to replace Ctrl+M (CR, 0x0D, octal 015, \r) with a newline character (LF, 0x0A, octal 012, \n):

tr '\015' '\n' < input_file > output_file

The C programming language provides the escape sequences '\n' (newline) and '\r' (carriage return). However, contrary to popular belief, these are in fact not required to be equivalent to the ASCII LF and CR control characters.

On Unix platforms, where C originated, the native newline sequence is ASCII LF (0x0A), so '\n' was simply defined to be that value.

Writing '\n' to a text mode stream works correctly on Windows systems, but produces only LF on Unix, and smthing completely different on more exotic systems. Using "\r\n" in binary mode is slightly better, as it works on many ASCII-compatible systems, but still fails in the general case. One approach is to use binary mode and specify the numeric values of the control sequence directly, "\x0D\x0A". Java also provides '\n' and '\r' escape sequences. In contrast to C, these are guaranteed to represent the values U+000A and U+000D, respectively.

With some Debian Linux distributions, the keys for using vi/vim may be different. For example, if you press 'i', then the 'del' key, it should delete blank lines, but it won't. Also, if you try to use the arrow keys to move up and down to different lines vi/vim instead starts typing random letters and making them capital and lower case. To resolve this, first, try to run:

:se nocp OR :set nocompatible

See How to change or remove end-of-line characters for a more complete discussion of this topic on this web site.

See also:

Top

vi quick references

There are lots of quick references for vi, including:

This list is work in progress.

Top

vi tutorials

Some good tutorials for vi:

This list is work in progress.

Top

vi fanboy pages

Top

W

Windows -- see http://notthere.dyndns.org/pub/HintsAndTips/Windows/

Top

X

xterm

xterm common parameters

xterm -e 'command_name parameter parameter' &                   # Run xterm to execute the command
xterm -font -*-helvetica-*-*-*-*-20-*-*-*-*-*-*-* &             # Use xfontsel to list and select font spec to the clipboard) 
xterm -ls &                                                     # Run xterm as login shell to execute ~/.profile
xterm -t &                                                      # Run Tek terminal (the default is usually VT100)
xterm -sb -rightbar -fg green -bg black -geometry '128x64' -ls
xterm -sb -rightbar -fg white -bg black -geometry '+60+645' -T "$HOST skyprod.net.error.log" /
        -e 'tail -f /var/log/httpd/skyprod.net.error_log' &

xterm copy and paste keys

Use Shift+Ctrl+C to copy from xterm and middle mouse button to paste.

xterm menus

Use Ctrl+mouse buttons left to right to show Main Options menu, VT Options menu, VT Fonts menu.

xterm - various useful commands

clear clear the terminal window.

editres is the X Resource Editor.

infocmp displays xterm info.

reset resets the terminal.

resize prints the size of the xterm (COLUMNS and ROWS environment variables, when using Bash).

showrgb to show colors db.

tput cup X Y moves the cursor to the (X,Y) coordinates in the current terminal.

tput longname lists xterm version info.

xflock4 lock the screen (at window manager level).

xfontsel list and select X11 fonts.

xlsfonts lists installed X11 fonts.

xrdb -query -all lists Xserver resources (see also the system Xresources file in /etc/X11, and/or ~/.Xresources).

Top

Z

zeroize files

To zeroize a file, you can use the following utilities:

- zeroize	writes zeroes, preserves LF, CR characters, is very slow
- gitwipe	writes random junk, does not delete, fast
- scrub		inadequate (see notes below)
- wipe		not installed
- shred		not installed
- gshred	writes random junk, can delete, fast

gshred

Use:

	gshred -n4 -v -x -z filename.txt .. to zeroize, or 
	gshred -n4 -v -x -z -u filename.txt .. to zeroize and delete.

Flags:

       -f, --force
              change permissions to allow writing if necessary
       -n, --iterations=N
              overwrite N times instead of the default (3)
       --random-source=FILE
              get random bytes from FILE
       -s, --size=N
              shred this many bytes (suffixes like K, M, G accepted)
       -u, --remove
              truncate and remove file after overwriting
       -v, --verbose
              show progress
       -x, --exact
              do not round file sizes up to the next full block;
              this is the default for non-regular files
       -z, --zero
              add a final overwrite with zeros to hide shredding
       --help display this help and exit
       --version
              output version information and exit

Examples:

              
	gshred -n1 -v -x -z -u gshred.test1
	gshred -n4 -v -x -z filename.txt				

To delete a file permanently, simply type the following command:

gshred -f -v -z -u /path/to/file

To delete all files permanently in a specific directory:

find . -type f -exec gshred -f -v -z -u '{}' \; ; 

scrub

scrub can allegedly write patterns compliant with DoD 5220.22-M:

scrub -p dod mysensitive.file.txt 

This only seems to pad the file with zeroes and write a junk header: some data is still viewable!

Top


This page published by:

Michael Cook
Email: UNIXnotes@michaelcook.ca.

This page is encoded in ISO-8859-1.

Last edited:
mona.local 2018-11-29 Added another example of using bc; changed address; re-validated.
mona.local 2017-02-14 Added another example how to set the date.
mona.local 2016-09-23 Added more info about stat; updated the style sheet.
mona.local 2014-11-14 Added notes on FTP; re-validated.
mona.local 2012-05-20 Added new example for sed #T; re-validated.
mona.local 2012-05-17 Added new example and link to I/O Redirection #T
mona.local 2012-05-03 Add notes on Bash substitution #S
mona.local 2012-04-29 Add reference to ASCIIendline document in vi section #R
mona.local 2012-03-22 reviewed find examples, added gshred info #Q
echo.local 2012-01-09 for ASCII table href change #P
echo.local 2011-12-31 added vi referencs #P
echo.local 2011-12-26 added another awk example #P
echo.local 2011-12-26 added more info about date command and date and time formats #P
echo.local 2011-12-21 added META character set examples; re-validated #P
mona.local 2011-08-01 added more find examples
mona.local 2011-06-26 added info about shifting columns left in vi
mona.local 2011-05-30 added info about xterm commands
mona.local 2010-10-18 added info about hexdump command #J.
cara.local 2010-09-17 Validated XHTML 1.0, #I (validated).
mona.local 2010-09-07 added info about NTP commands and vi. #H.
mona.local 2010-08-29 added info about undo.redo in vi. Updated #G.
mona.local 2010-06-17 added info about various time functions. #G
mona.local 2010-06-14 added info about Bash I/O redirection. #F
bertha.local 2010-06-06 Validated XHTML 1.0, #E.
mona.local 2010-05-20+ added some Bash stuff, top, etc. #D
mona.local 2010-05-09 #C
bertha 2010-04-09 #B
mona 2008-05-11 #6

Valid XHTML 1.0 Transitional2010-09-17, 2011-12-21, 2012-05-17, 2014-11-14, 2018-11-29.

Valid CSS!2010-09-17, 2011-12-21, 2012-05-17, 2014-11-14, 2018-11-29.

I heart Validator