Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

once again time to show off your brain!

Honored Contributor 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
Honored Contributor 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
Frequent Advisor 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
Honored Contributor 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.)
Honored Contributor 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 ?
Honored Contributor 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.
Honored Contributor 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 ?
Honored Contributor 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.
Respected Contributor 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!
Frequent Advisor 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.
Honored Contributor Honored Contributor

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 Esteemed Contributor

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 Honored Contributor

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 Frequent Advisor

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.
Highlighted
Regular Advisor Regular Advisor

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".