[talk] I declare not so stupid unix tricks thread open

Jason Hellenthal jhellenthal at dataix.net
Sat Mar 15 11:25:05 EDT 2014


Lol I was waiting for that. But a attempted head(1) shot is worthwhile anyway !

I had some process's that actually took the headshot and exited. Always worth a shot.

-- 
 Jason Hellenthal
 Voice: 95.30.17.6/616
 JJH48-ARIN

> On Mar 15, 2014, at 10:27, Dan Cross <crossd at gmail.com> wrote:
> 
>> On Fri, Mar 14, 2014 at 3:52 PM, Jason Hellenthal <jhellenthal at dataix.net> wrote:
>> These should all be posix compliant sh(1) FreeBSD compatible. Not sure about other systems.
>> 
>> # Kill or list some stopped processes
>> alias stopkill='kill `ps a -o stat,pid |awk '\''/^T /{print $2}'\''`'
>> alias stoplist='ps -p `ps a -o stat,pid |awk '\''/^T /{print $2}'\''` 2>/dev/null'
>> 
>> # Kill or list some zombies
>> alias zomkill='kill `ps a -o stat,pid |awk '\''/^Z /{print $2}'\''`'
> 
> This one doesn't make a lot of sense to me.  You can't kill a zombie; zombies are by definition already dead, and just hanging around until their parent wait()'s for their exit status (or the parent dies, in which case they're inherited by init, which will wait for them unless your system is totally messed up).  The only resource a zombie occupies is a slot in your process table.
>  
>> alias zomlist='ps -p `ps a -o stat,pid |awk '\''/^Z /{print $2}'\''` 2>/dev/null'
>> 
>> # Need a new 10 char[] password ?
>> alias newpass='LANG=C tr -ucd [:alnum:][:punct:] </dev/urandom |tr -ud OZkl |tr -us [:alnum:][:punct:] |head -c 10 && echo'
>> 
>> # cisco Systems like ping(1)
>> alias cping='sudo /sbin/ping -n -c 5 -t 2 -i 0.1 -s 72'
>> 
>> # Sweep through sizes when ping'ing a host
>> alias sweep='ping -D -G 56 -h 7'
>> 
>> # Need some specific permissions of files devices or directories ?
>> alias permof='stat -f "%p %Sp %Su %Sg %N"'
>> 
>> # List major minor and type of a device ?
>> alias lsdev='stat -f "%nName:%t%N%nType:%t%HT%nMajor:%t%Hr%nMinor:%t%Lr%n%n"'
>> 
>> 
>>> On Fri, Mar 14, 2014 at 11:29 AM, Marc Spitzer <mspitzer at gmail.com> wrote:
>>> We need to share our not so stupid unix tricks.  Here is one:
>>> 
>>> ssh key access audit script:
>>> for i in $(seq 254) ; do x="192.168.49.$i"; echo -n "$x: " ; ssh -o PasswordAuthentication=no -o NumberOfPasswordPrompts=0 $x hostname  ;
>>> 
>>> this will give you one of 3 things:
>>> 1: hostname
>>> 2: failed login
>>> 3: unreachable error
>>> 
>>> Easy way to find out where your keys work, who's next?
>>> 
>>> Marc
>>> -- 
>>> Freedom is nothing but a chance to be better.
>>> --Albert Camus
>>> 
>>> The inherent vice of capitalism is the unequal sharing of blessings; the inherent virtue of socialism is the equal sharing of miseries. 
>>> -- Winston Churchill
>>> 
>>> Do the arithmetic or be doomed to talk nonsense.
>>> --John McCarthy
>>> 
>>> _______________________________________________
>>> talk mailing list
>>> talk at lists.nycbug.org
>>> http://www.nycbug.org/mailman/listinfo/talk
>> 
>> 
>> _______________________________________________
>> talk mailing list
>> talk at lists.nycbug.org
>> http://www.nycbug.org/mailman/listinfo/talk
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20140315/35b26638/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6118 bytes
Desc: not available
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20140315/35b26638/attachment.bin>


More information about the talk mailing list