SED to append a string to each line of a file

cp test* /home/mydirectory/files

sed "s/$/|`head -1 test.dat.20080917233024`/g" test.dat.20080917233024 > new_test.dat.20080917233024

sed '1d;$d' new_test.dat.20080918233023 > test.dat.20080918233023

Set Command

The set command is used to turn on and off shell options such as tracking or automatic exporting of commands. Its second function is to reset the values of positional parameters ($1).

$ echo hello
hello
$ set -o verbose
$ echo hello
echo hello
hello

http://docs.hp.com/en/B2355-90046/ch23s05.html

Changing UNIX prompt

export PS1='[$PWD] >'

tar and gzip unix files

Most often you find Tar and Gzip used in concert to create "gzipped archives" with .tar.gz extensions (or its abbreviated form, .tgz). While you can obviously use the commands separately, tar's -z option feeds the archive through gzip after packing and before unpacking, Thus:

% tar -czvf archive.tar.gz file1 file2 dir/
Creates a gzipped archive, archive.tar.gz.

% tar -xzvf archive.tar.gz
Extracts all files from the gzipped archive and,

% tar -tzvf archive.tar.gz
Lists the contents of the gzipped archive without extracting them.

To delete files created a week ago

find -name -mtime +2 -exec rm {} \;

find . -mtime +7 -exec rm {} \;

To list unix directory in the order of filesize

ls -l | sort -bn +4 (smallest to largest)
or
ls -l | sort -bnr +4 (largest to smallest)

To list unix directory in the order of filesize

ls -l | sort -bn +4 (smallest to largest)
or
ls -l | sort -bnr +4 (largest to smallest)