Re: once again time to show off your brain! (1002 Views)
Reply
Honored Contributor
Todd McDaniel_1
Posts: 1,387
Registered: ‎08-26-2002
Message 1 of 15 (1,002 Views)

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.
Honored Contributor
KapilRaj
Posts: 1,375
Registered: ‎03-07-2000
Message 2 of 15 (1,002 Views)

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
Frequent Advisor
Dan Martin_1
Posts: 64
Registered: ‎02-19-2003
Message 3 of 15 (1,002 Views)

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
Honored Contributor
Fred Ruffet
Posts: 1,366
Registered: ‎08-17-2003
Message 4 of 15 (1,002 Views)

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.)
Honored Contributor
Sundar_7
Posts: 1,938
Registered: ‎11-07-2000
Message 5 of 15 (1,002 Views)

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 ?
Honored Contributor
Geoff Wild
Posts: 7,170
Registered: ‎06-04-2001
Message 6 of 15 (1,002 Views)

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.
Honored Contributor
Sundar_7
Posts: 1,938
Registered: ‎11-07-2000
Message 7 of 15 (1,002 Views)

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 ?
Honored Contributor
Todd McDaniel_1
Posts: 1,387
Registered: ‎08-26-2002
Message 8 of 15 (1,002 Views)

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.
Respected Contributor
Tom Maloy
Posts: 221
Registered: ‎04-07-2002
Message 9 of 15 (1,002 Views)

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!
Frequent Advisor
Charlie Rubeor
Posts: 66
Registered: ‎05-14-2000
Message 10 of 15 (1,002 Views)

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.
Honored Contributor
Sundar_7
Posts: 1,938
Registered: ‎11-07-2000
Message 11 of 15 (1,002 Views)

Re: once again time to show off your brain!

Last login time of all the users

logins | awk '{print $1}' | xargs -tn1 getprpw -m slogint
Learn What to do ,How to do and more importantly When to do ?
Esteemed Contributor
Abdul Rahiman
Posts: 232
Registered: ‎03-23-2004
Message 12 of 15 (1,002 Views)

Re: once again time to show off your brain!

Top users taking space on home directories..

# du -sk /home/* | sort -n -r | more
No unix, no fun
Honored Contributor
Michael Tully
Posts: 7,905
Registered: ‎04-15-1999
Message 13 of 15 (1,002 Views)

Re: once again time to show off your brain!

Here's my favourite. It looks in the sulog for bad root attempts. I actually run this out of cron at defined periods, but just as easy from the command line.

# cat /var/adm/sulog | awk '$4 == "-" {print $0}' | grep 'root$'
Anyone for a Mutiny ?
Frequent Advisor
Dan Martin_1
Posts: 64
Registered: ‎02-19-2003
Message 14 of 15 (1,002 Views)

Re: once again time to show off your brain!

There should be a tab or spaces before the "\1" in my previous one-liner, so that the PV names are indented.
Regular Advisor
Michael D. Zorn
Posts: 129
Registered: ‎06-10-2004
Message 15 of 15 (1,002 Views)

Re: once again time to show off your brain!

(Try doing any of those in a GUI.....)

One I use a lot - show the most recently changed/created files in a directory:

ll -t | head -23

I make it an alias for "llast".


The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.