Delete files/folder older than 60 days#

Search folder and files:
find . -mtime +60
Delete files
find . -type f -mtime +60 -exec rm {} \;
Delete folders
find . -type d -mtime +60 -exec rm -r {} \;

sftp#

Default port is 22, command list
sftp -oPort=115 <user>@<server>
With Java see jsch

Special characters for putty + shell#

For HP-UX the shell is a ksh. You can configure putty, but the special keys may not work anyway. Therefore you should adjust settings with stty. To get your current settings, do this:
$ stty -a
speed 38400 baud; line = 0;
rows = 37; columns = 100
min = 4; time = 0;
intr = DEL; quit = ^\; erase = ^H; kill = @
eof = ^D; eol = ^@; eol2 <undef>; swtch <undef>
stop = ^S; start = ^Q; susp <undef>; dsusp <undef>
werase <undef>; lnext <undef>
-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crts
-ignbrk brkint -ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
ixon ixany -ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo -echoe echok -echonl -noflsh
-echoctl -echoprt -echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop tab3
You can switch these settings like this, which follows the normal behaviour:
stty intr ^C
stty erase ^\?
stty kill ^U

Version#

uname -r = B.11.23 = HP-UX 11i v2 (PA-RISC and Intel Itanium)

Other infos#

vi /etc/rc.config.d/netconf
vi /etc/hosts
hostname
uname -a
machinfo
getconf KERNEL_BITS
model
netstat -an
/etc/ping <server> -n 5
nslookup
tracert
/usr/contrib/bin/traceroute <server>
  • Profil in ~/.profile
  • Korn-Shell

Memory#

vmstat => shows memory usage in 4KB blocks

Tree view#

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/' 

se also Linux file commands

Change Password#

passwd <user>

Find files#

Search for symbolic links
 find . -type l -name "*mysql*"

Search in files#

grep 'Walsen, Stacey' *

If you want to print the filenames you need to use head or tail, because cat won't do it.
head will diplay the filename like

==> filename <==
So you need to specify that as additional search parameter with option -e.
Parameter -n 99999 searches the first 99999 lines, e.g. should search all.
head -n 99999 *|grep -e '1166682' -e '==>'

Return codes / Exit Codes#

There is no general list, because return codes are application dependant. But you can check
/usr/include/sysexits.h
search for errno.h

Edit files#

more <file>Show file page by page
head -25 <file>Show first 25 lines of file
head -c -n 200 <file>Show first 200 bytes of file
tail -25 <file>Show last 25 lines of file
vi <file>View and edit

Mass rename#

#!/bin/ksh
# 02.08.2011, Markus Ebel
cd sp
j=1
for oldfile in `ls $2`
do
#31945_EBELM_107_F700_107_05_ZPUINFOTYPES_20110731003204.txt
len=`echo $oldfile | wc -c`
len=`expr $len - 1`
start=`expr $len - 20`
newfile=`echo $oldfile|cut -c 1-15`
newfile=`echo $newfile '.txt'`
echo $j: rename $oldfile '>' $newfile
#mv $oldfile $newfile
j=`expr $j + 1`
done
#