Compress the contents of the current directory, but compress the smallest files first (handy when short of disk space for intermediate files):

ls -s | awk NR!=1 | sort -n | awk '{print $2}' | xargs bzip2 -9v

Use 7-Zip and tar together with standard input/output:

tar cf - (directory_path) | 7za a -si -mx=7 directory.tar.7z
7za x -so directory.tar.7z | tar xpf -

Find the largest file in a directory tree:

find /path -type f -exec ls -s {} \; | sort -n | tail -1

Print the number of regular files in each subdirectory of the current directory:

for x in *; do printf "%40s %g\n" $x $(find $x -type f -print | wc -l); done

Print the total bytes of files in a directory grouped by date (useful for Oracle archived log volume summaries):

ls -l|awk 'length($6)==3{x[$6" "$7]+=$5};END{for(i in x)printf"%s:\t%d\n",i,x[i]}'

Burn a CD of the current directory on Linux without an intermediate ISO file (check size with "du -sm ." first; also check "cdrecord -scanbus" for the right device ID):

nice --18 mkisofs -r -T -J -V "Volume Label" . | cdrecord -v fs=6m speed=8 dev=ATA:1,1,0 -eject -

Convert cdparanoia-style tracks to cdda2wav (for cdrecord's useinfo):

x=1;while true;do f=$(printf "track%02g.cdda.wav" $x);[ ! -f $f ] && break;mv $f $(printf "audio_%02g.wav" $x);((x++));done

Burn a DVD with a volume label:

growisofs -Z /dev/cdrom -V "Volume Label" -r -J .

Burn a pre-existing ISO file with growisofs:

growisofs -dvd-compat -Z /dev/cdrom=file.iso

Send a message to a remote syslog (works in bash and ksh93 [most commonly /usr/dt/bin/dtksh] - ksh seems to need an IP address, not a hostname). The remote syslog might need to be running with the "-r" option:

 echo message to remote syslog >> /dev/udp/remote.syslog.host.com/514

Remove spaces from filenames in the current directory (use with caution; examine the output before you pipe to the shell).

ls|awk '{a=$0;gsub(/ /,"",a);print "mv '"'"'"$0"'"'"' "a}'|sh

Remove blank lines and comments (lines beginning with #). Either syntax works.

egrep -v '(^[ \t]*#|^$)' /path/to/file.txt
awk '!/(^[ \t]*#|^$)/' /path/to/file.txt

Use gawk to generate a 20 byte alphanumeric stream suitable for a random password (does not include the letter "O" or the number "0" to avoid confusion; syntax also workable in DOS):

gawk "BEGIN{srand(systime()+PROCINFO[\"pid\"]);for(l=0;l<20;l++){t=rand()*((!!l)*10+24);t>14?t++:7;p=p (t>26?int(t-25):sprintf(\"%c\",65+t))}print p}"

Tell Oracle to let you see the time as well as the date:

alter session set nls_date_format = "RRRR/MM/DD HH24:MI"

How big is your Oracle database?

select v.name, d.mb from v$database v, (select sum(bytes)/1024/1024 mb from dba_data_files) d;

Under a command prompt on Windows, find all files larger than 250 million bytes and print their size, date, and path delimited by semicolons, then piped to sort (this needs DOS/Win32 ports of awk and a UNIX sort):

dir /s /-c | gawk "BEGIN{OFS=\";\"};$1==\"Directory\"&&$2==\"of\"{d=$0;sub(/^ Directory of /,\"\",d)};$3~/^(AM|PM)$/&&$4~/^[0-9]+$/{if($4>250000000){m=substr($0,1,20);gsub(/[ ]+/,\" \",m);f=substr($0,40);gsub(/\r/,\"\",f);print $4,m,d\"\\\\\"f}}" | gsort -n