Re: UNIX Command Idioms

Re: [twitter:@riywo]'s UNIX Command Idioms

and I love aliases:

  • alias pa='ps auxwwww'
  • alias pspgid='ps axwww -o "ppid pgid pid user fname args"'
  • alias iops='ps auxwwww -L|awk "\$10 ~ /(D|STAT)/{print}"'
  • alias u='cd ..'
  • alias uu='cd ../..'
  • alias uuu='cd ../../..'
  • alias uuuu='cd ../../../..'
  • alias ddu='du -sm ./*|sort -n|tail'
  • iname() { find . -type d -name .svn -prune -o \( -iname "*$1*" -print \); }
  • alias inaem=iname (for typo)
  • alias fnuniq='cut -d: -f1|uniq'
    • iname foo | fnuniq
  • alias ipsort='sort -nt. +0 -1 +1 -2 +2 -3 +3'
  • alias sortpw='sort -t: -k3n /etc/passwd'
  • alias sortgrp='sort -t: -k3n /etc/group'
  • alias eman='LC_ALL=C LANG=C man'
  • alias FORORENO='for i in host host host; do'
    • FORORENO echo $i; command; done
  • alias cert2text='openssl x509 -text -in '
  • alias priv2text='openssl rsa -text -in '
  • https2text
https2text() { # FQDN[:PORT]
  case $1 in
    *:*)
      URL=$1
      ;;
    *)
      URL="$1:443"
      ;;
  esac
  echo | openssl s_client -connect $URL 2>/dev/null | \
    sed -n -e '/BEGIN /,/END /p' | \
    openssl x509 -text
}
  • alias perlck='perl -Mstrict -Mwarnings -wc'
  • alias pmk='perl Makefile.PL; make && make test'
  • alias perldoc-type='perldoc Mouse::Util::TypeConstraints'
  • pmver
pmver () {
  do_cd=
  if [ "$1" = '-cd' ]; then
    do_cd=1
    shift
  fi
  module=$1
  perl -M${module} -e "print \$${module}::VERSION,\"\n\""
  fullpath=$(
    perldoc -ml ${module} 2>/dev/null
    [ $? -eq  255 ] && perldoc -l ${module}
  )
  echo $fullpath
  if [ "$do_cd" = '1' ]; then
    \cd $(dirname $fullpath)
  fi
}
  • alias dates='date "+%Y-%m-%d %T.%N"'
  • alias today="date '+%Y%m%d'"
  • alias today-="date '+%Y-%m-%d'"
  • alias now="date '+%Y%m%d_%H%M%S'"
  • alias now-="date '+%Y-%m-%d_%H%M%S'"
  • alias wdump='curl -i'
    • or alias wdump='lynx -source -mime_header'
    • or alias wdump='w3m -dump_both'
  • I love alias letter :D
    • alias a='alias'
    • alias c='clear'
    • alias d='cd /usr/oreno'
    • alias h='cd ~'
    • alias l='ls -F'
    • alias m='cd /var/tmp/making'
    • alias s='cd ~/repos'
    • alias u='cd ..'
    • alias v='less'
    • alias x='exit'
      • a | grep 'alias .=' | wc -l -> 12