Sep 15, 2010

Configuraciones de alias de linux

Los siguientes alias me llegaron por medio una lista de distribución de linux, y me parece muy copados para compartir


#### alias stuff
## Note: to include a single-quote in the body of a csh or tcsh alias, use the 4 characters: '\''
alias aliases 'vim ~/.aliases && echo "\n Sourcing aliases... \n" && source ~/.aliases'
alias alias-list 'cat ~/.aliases | grep alias | grep -v ^#'

#### host info
alias host-info 'ls /etc/*release | xargs head -1 /.image'
alias cpu-info-set 'set tcpu_allcores=(`grep "core id" /proc/cpuinfo | wc -l`); setenv cpu_allcores $tcpu_allcores; set tcpu_count=(`grep "core id" /proc/cpuinfo | grep 0 | wc -l`); setenv cpu_count $tcpu_count; @ tcpu_cores
= $cpu_allcores / $cpu_count; setenv cpu_cores $tcpu_cores; set tcpu_model=(`grep "model name" /proc/cpuinfo | head -n1 | cut -d: -f2 | tr -s " " | sed -e "s/(R)//g" -e "s/^ //" -e "s/ /-/g"`); setenv cpu_model "$tcpu_model"'
alias cpu-info 'cpu-info-set && echo "total cores = "$cpu_allcores;
echo "cores per proc = "$cpu_cores; echo "processors = "$cpu_count;
echo "processor model = "$cpu_model'
alias cpu-info-short 'cpu-info-set && echo "total="$cpu_allcores"
proc_cores="$cpu_cores" procs="$cpu_count" model="$cpu_model'
alias cpu-info-2short 'cpu-info-set && echo $cpu_allcores" "$cpu_cores" "$cpu_count" "$cpu_model'

#### grep stuff
alias gvg 'grep -v grep'

#### ssh stuff
alias sshpkill 'ssh \!* "ps -elf | head -1 && ps -elf | grep $USER | grep -v grep | grep -v ps && echo && echo "^^^^ processes running on host that will be killed ^^^^ " && echo && pkill -15 -u $USER " && (echo "ran SIGTERM, sleeping 20 seconds then running SIGKILL...\n"; sleep 20; ssh \!* "pkill -9 -u $USER") || echo "\nNo processes by $USER were running on that host!"'

#### ps stuff
alias psu 'ps -U \!* -u \!* u'
alias psc 'ps -eo
bsdtime:10,etime:13,pid:10,euser:10,%cpu:5,%mem:5,comm:20,command --no-header'
alias psc-head 'ps -eo bsdtime:10,etime:13,pid:10,euser:10,%cpu:5,%mem:5,comm:20,command | head -1'
alias ps-eda '(psc | grep -i "\/eda\/" | sort -n && psc-head)'
alias ps-eda-clean '(psc | grep -i "\/eda\/" | sort -n | cut -c -66 && psc-head)'
alias ps-users '(psc | grep -v -E " root | nobody | daemon | messagebus | nmetrics | intelmta |sbin/|sort -n" | sort -n && psc-head)'
alias ps-proc '(ps -p \!* -o bsdtime:10,pid:10,euser:10,%cpu:5,%mem:5,comm:20,command && psc-head)'
alias ps-grep '(psc | grep -i \!* | gvg | sort -n && psc-head)'
alias ps-grep-clean '(psc | grep -i \!* | sort -n | cut -c -66 && psc-head)'

#### package / rpm stuff
alias rpm-find-file 'rpm -qf \!*'

#### build stuff
alias ld-path 'ld --verbose | grep SEARCH | tr " " "\n" | cut -d\" -f2'
alias dlinker-path 'readelf -l /bin/echo | grep interpreter | cut -d: -f2 | cut -d" " -f2 | cut -d] -f1 | xargs ls -l'

#### fun stuff
alias rot13 tr \'a-zA-Z\' \'n-za-mN-ZA-M\'

#### vnc stuff
alias vncserv 'vncserver -geom 1600x1200 -randr 1580x1170,1600x1200,1920x1200,2560x1600'

#### cdislookup stuff
alias cvg '/usr/intel/bin/cdislookup -w "\!*"'
alias cvi '/usr/intel/bin/cdislookup -i "\!*"'

#### ls stuff
alias ls 'ls --color=auto'
alias lt 'ls -lart'
alias ll 'ls -al'
alias lld 'll -d */ .*/'
alias newest-file 'ls -1atr "\!*" | tail -n1'
alias newest-file-ls 'ls -altr "\!*" | tail -n1'

#### du / df stuff
alias dush 'du -smc * | sort -n | tail'

#### printer stuff
alias print-me 'genscript -v -G -j -r -U 2'

#### screen stuff
alias screen-reattach 'screen -raAd'

No comments:

Post a Comment