Operating System - HP-UX
1752661 Members
5782 Online
108788 Solutions
New Discussion юеВ

Re: once again time to show off your brain!

 
Todd McDaniel_1
Honored Contributor

once again time to show off your brain!

Okay, I would like to see your favorite one-liners...

NO ; please... make it a TRUE one liner. Yes it can wrap the line but no ";" at all. Since we all know that allows you to put multiple commands on one line.

Here is mine

cat filename.in |awk -F\: '{ print $1 }' |sed 's/rdsk/s/dsk/g'|sort > filename.out
Unix, the other white meat.
14 REPLIES 14
KapilRaj
Honored Contributor

Re: once again time to show off your brain!

ps -ef |grep |egrep -vi "root|grep" |awk '{print $2}' |xargs kill -9

Kaps
Nothing is impossible
Dan Martin_1
Frequent Advisor

Re: once again time to show off your brain!

/usr/sbin/vgdisplay -v | egrep "PV Name|VG Name" | awk '{print $NF}' | sed 's/\(
.*dsk.*\)/ \1/'

Dan
Fred Ruffet
Honored Contributor

Re: once again time to show off your brain!

export DISPLAY=$(who -mu | sed -e "s/:[0-9]$//" -e "s/:[0-9].[0-9]$//" |awk '{print $NF":0.0"}')

Fred
--

"Reality is just a point of view." (P. K. D.)
Sundar_7
Honored Contributor

Re: once again time to show off your brain!

PID=$(UNIX95= ps -ef -o pid,pcpu,args | sort -nbk 2 | tail -1 | awk '{print $1}')

PROCESS=$(UNIX95= ps -ef -o pid,pcpu,args | sort -nbk 2 | tail -1 | awk '{print $NF}')

Finding the PID & the process name of the process with the highest CPU usage.
Learn What to do ,How to do and more importantly When to do ?
Geoff Wild
Honored Contributor

Re: once again time to show off your brain!

Sendmail version:

echo \$Z | /usr/sbin/sendmail -bt -d

Identifies and displays stale extents:

vgdisplay -v | awk '/LV Name/ { print $3 }' | xargs lvdisplay -v | grep -i -e "lv name" -e "lv status" -e stale -e '?'

show top memory users and pid:

UNIX95= ps -e -o 'vsz pid ruser args' |sort -nr|head -30

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sundar_7
Honored Contributor

Re: once again time to show off your brain!

fuser /var/adm/syslog/syslog.log | xargs -n 1 ps -fp

Gives you the process ID of the all the processes using the file.
Learn What to do ,How to do and more importantly When to do ?
Todd McDaniel_1
Honored Contributor

Re: once again time to show off your brain!

Ok,

Only one point assignment per person, but you can post as often as you want...
Unix, the other white meat.
Tom Maloy
Respected Contributor

Re: once again time to show off your brain!

CPU information
echo "selclass qualifier cpu;info;wait;infolog"|cstm
memory information
echo "selclass qualifier memory;info;wait;infolog"|cstm

serial number
echo "sel path system\ninfolog\nexit"|cstm|grep "System Serial Number"
Carpe diem!
Charlie Rubeor
Frequent Advisor

Re: once again time to show off your brain!

UNIX95= ps -eo etime,user,pid,ppid,cpu,stime,tty,time,args | awk '$1 ~ /^[0-9][0-9]:/'

Lists all of the processes that were started in the last 24 hours, but are still running. I run this every morning, around 1:30.