linux:
# history config
export HISTTIMEFORMAT="%Y-%M-%D %H:%M:%S "
export HISTSIZE=100000
export HISTFILESIZE=1000000
export HISTFILE=~/.commandline_warrior
shopt -s histappend
PROMPT_COMMAND='history -a'
# alias config
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias np='netstat -nltp'
alias npg='netstat -nltp|grep '
alias k9='kill -9 '
alias tree='tree -N'
alias rmmavenlast='find ~/.m2/repository/ *lastUpdated |grep lastUpdated|xargs rm'
指定不同终端执行的命令都存储在同一个文件中
export HISTFILE=~/.commandline_warrior
忽略重复命令
export HISTCONTROL=ignoredups
多个终端同时操作时,避免命令覆盖,采用追加方式
shopt -s histappend
命令操作记录会在终端关闭结束工作后才会写入到history文件中,要想实现实时访问需要添加一下命令
PROMPT_COMMAND=’history -a’
mac专用:
alias np='lsof -nP -iTCP |grep LISTEN'
alias npg='lsof -nP -iTCP|grep LISTEN|grep '
网友评论