Find files newer than x days
# make a file dated Jan 25 – you change it to what you need touch -t 201101250000 dummy find /path/to/files -newer dummy -exec ls -l {} \; via Find files newer than x days – The UNIX and Linux Forums.
Extracting text using sed and regular expressions Linux/UNIX/AIX Brian Smith’s AIX / UNIX / Linux / Open Source blog
$ lsvg rootvg | sed -n ‘s/.*FREE PPs:.*(\([0-9][0-9]*\) megabytes.*/\1/p’ 6400 Extracting text using sed and regular expressions Linux/UNIX/AIX Brian Smith's AIX / UNIX / Linux / Open Source blog.
Solaris PATH
Check the following .profile /etc/profile /etc/default/login
Awk Tips Tricks
Awk to sort by line length: $ wc -l /usr/share/dict/words 483523 /usr/share/dict/words $ awk ‘{ print length(), $0 | “sort -n” }’ /usr/share/dict/words Remove blank lines and print the 7th field awk ‘NF > 1 {print $7}’ input Quick Combo Demonstration: # cat /tmp/freemem.drmets total used free shared buffers cached Mem: 125 9 115 0 […]
Find large files Solaris
find /tmp -type f -print | xargs ls -l | sort -r -n -k 5,5 | head -10 du -ko / |sort -r -n | head -10 du -sh *
Fsck
UX:vxfs fsck: WARNING: V-3-20836: file system had I/O error on meta-data. log replay in progress log replay failed to clean file system file system is not clean, full fsck required full file system check required, exiting .. # fsck -F vxfs -o full -o nolog -y /dev/dsk/rlvol6
mount: file system table may be corrupt
# mv /etc/mnttab /etc/mnttab.old # mount -a
mxdomainmgr
1. Edit the /etc/opt/mx/config/mx.properties file and add: MX_DEBUG_TRACE=on 2. Verify that the mx daemons are not running: # ps -ef | grep mx [Should not be processes for mxdomainmgr, mxdtf, or mxagent.] 3. If the daemons are running, stop them: # mxstop 4. Run mxinitconfig: # /opt/mx/bin/mxinitconfig -a 5. Capture any output from the mxinitconfig […]
Delete weird files
Note the “-” says that there are no more options (flags) on the commandline. rm -i – —
create a huge file
Prealloc is the way to do it on HP-UX: prealloc test.100mb 102400000 creates a 100MB file.