I declare not so stupid unix tricks thread open

Jason Hellenthal jhellenthal at dataix.net
Fri Mar 14 15:52:44 EDT 2014

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}'\''`

# Kill or list some zombies
alias zomkill='kill `ps a -o stat,pid |awk '\''/^Z /{print $2}'\''`'
alias zomlist='ps -p `ps a -o stat,pid |awk '\''/^Z /{print $2}'\''`

# 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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20140314/f4e38196/attachment.html>

More information about the talk mailing list