alias open='open() { sudo open /Applications/$@; };open'/
alias del='del() { mv $@ ~/.Trash; };del'
alias mkdirc='mkdirc() { mkdir $@ && cd $@; };mkdirc'
alias rm='rmr() { rm -rf $@; };rmr'
#find
alias findt='findt() { find .|xargs grep -ri $@ -l; };findt'
alias findtyp='findtype() { find ./ -type f -name $1 | xargs grep $2; };findtype'
#git
#alias gitc='commit() { git add .; git commit -m "$1"; git push origin source ;}; commit'
alias gitc='commit() { git add .; git commit -m "$1"; git push;}; commit'
alias gitinit='remote(){ git init && git remote add origin $@ && git fetch && git checkout -b master origin/master; };remote'
#git branch -D git reset --hard HEAD
#ps
alias kps='kps(){ ps axuf| grep $@|grep -v grep|awk "{print \$2}"|xargs kill -9 ;};kps'
#最常用,复制一个路径过来时,不用修改,可以到达路径的最深一层目录
#if dir,cd into it. if file ,cd into where the file is
alias goto='goto(){ [ -d "$1" ] && cd "$1" || cd "$(dirname "$1")"; };goto'
#交换两个文件
alias switchfile='switchfile() { mv $1 ${1}.tmp && mv $2 $1 && mv ${1}.tmp $2; };switchfile'
#压缩
alias mktar='mktar(){ tar cvf "${1%%/}.tar" "${1%%/}/"; };mktar'
alias mktgz='mktgz(){ tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; };mktgz'
alias mktbz='mktbz(){ tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; };mktbz'
IPAddress=`/sbin/ifconfig -a|grep inet|grep -v 127|grep -v inet6|tr -d "\n"|awk '{print $2}'|tr -d "addr:"`
IPAddress=`/sbin/ifconfig | grep -v 172| grep Bcast | awk '{print $2}' | awk -F: '{print $2}'`
export PS1='[\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m${IPAddress}\e[m \e[4m\w\e[m] \e[1;36m$PS1_INT\e[m\n\$'
#export PS1='\e[m[\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;31m${uerip}\e[m \e[4;36m\w\e[m] \e[1;36m$PS1_INT\e[m\n\$'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias l.='ls -d'
#alias mv='mv -i'
#alias rm='rm -i'
#alias cp='cp -i'
#alias fiddler='sudo mono --arch=32 ~/Downloads/fiddler-mac/Fiddler.exe'
alias pronoun='sudo spctl --master-disable' #允许任何来源
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedahagacad
#alias chmod='chmod -v --preserve-root'
#alias chown='chown -v --preserve-root'
alias df="df -h"
alias du="du -h"
alias last="last -a"
alias free='free -m'
#alias ln='ln -s'
alias .="cd .."
alias ..="cd ../.."
alias ...="cd ../../.."
alias ....="cd ../../../.."
alias -- -='cd -'
alias gu='iconv -f gbk -t utf-8' #两种类型编码转换
alias ug='iconv -f utf-8 -t gbk'
alias vd='vimdiff' #vim diff两个文件
alias tail='tail -f' #动态查看文件变化
alias af="awk -F '\t' '{print NF}'" #查看文件列数,用\t分隔,最常用,其实也可>以搞个通用的,接收参数
alias wc='wc -l' #统计行数
alias dfind='find -type d -name' #查找文件夹
alias ffind='find -type f -name' #查找文件
alias chux='chmod u+x' #该权限
alias psg='ps aux|grep' #查看
alias cls="clear" #清屏
alias dus="du -s" #磁盘
alias du0="du --max-depth=0"
alias du1="du --max-depth=1"
alias sv="sudo vim" #用sudo编辑文件时
alias hpwd='echo -n "`hostname`:";eval pwd' #用scp时,展示hostname和pwd
#杀掉指定程序的所有进程
#ps axuf | grep abc | grep -v grep | awk '{print $2}' | xargs kill -9
#alias kpsp="ps axuf | grep $abc | grep -v grep | awk '{print \$2}' | xargs kill -9"
#for pid in `ps aux|grep pack|grep -v grep |awk '{print $2}'`; do kill -9 $pid ; done
#find
#find ./ -type f -name '*.conf'|xargs grep 'terminal_app'
#find .|xargs grep -ri "IBM" -l #查找所有文件内有字符串"IBM"以列表显示
#find . ++ 文件列表,子目录下所有文件
#find -name "*.txt"
#find . \( -name "*.txt" -o -name "*.pdf" \) ++ 查找拓展命为.txt和pdf -0为or
#find /home -path "*/slynux/*" //list/slynux.txt slynux/eg.css
#find . -regex ".*\(\.py\|\.sh\)$" //./test.py ++正则匹配 .py或.sh文件
#find . ! -name "*.txt" ++否定查找
#find . -maxdepth 1 -name "f*" ++最多查找深度
#find . -type d ++查找文件类型
#find . -type f -atime -7 ++访问时间(-atime) 修改时间(-mtime) 变化时间(-ctime)
#find . -type f -size +2k ++文件大小
#find . -type f -name "*.swp" -delete ++删除
#find . -type f -perm 644 ++权限为644
#find . -type f -user root -exec chown slynux {} \;
#find . -type f -name "*.c" -exec cat {} \;>all_c_files.txt
#find . -type f -mtime +10 -name "*.txt" -exec cp {} OLD \; ++将10天前的 .txt文>件复制到OLD目录中:
#无法在-exec参数中直接使用多个命令,但可以-exec ./commands.sh {} \;
#cat
#cat args.txt | xargs -n 1 ./cecho.sh cecho.sh 内为echo $*'#' ++把args.txt整理为一行
#echo "splitXsplitXsplitXsplit" | xargs -d X -n 2 根据X拆分,分2行显示
#grep
#grep '0e26351d-9454-4f45-83d2-6f0031c91829' --include='laravel-2018-01-0[23].log' |xargs grep 'ads/list'
#文件处理
# awk -F '- -' '{print $2}' smile.rongyi.com.log |awk -F '?' '{print $1}' | uniq -c |sort -nr|head -100
#queue
#ps aux | grep queue
#/etc/init.d
#alias queuestart='sudo /etc/init.d/supervisor restart'
export JAVA_HOME=`/usr/libexec/java_home`
export PATH=${PATH}:$JAVA_HOME/bin:/usr/local/apache-tomcat-7.0.88/bin
网友评论