alias
: 列出所有别名
isaac@hp:~/Notes/linux$ alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias another_name=some_command
指定别名:
isaac@hp:~/Notes/linux$ alias saymyname='echo `whoami`'
isaac@hp:~/Notes/linux$ saymyname
isaac
unalias some_alias_name
: 取消some_alias_name
这个别名
isaac@hp:~/Notes/linux$ unalias saymyname
history
history
: 列出所有历史命令history n
: 列出最后n条历史命令history -c
: 清空当前历史记录history -w
: 将历史记录写入~/.bash_history
中history -a file
: 将历史记录写入file
中,若未指定file
则默认写入~/.bash_history
中!n
: 执行第n条历史命令!command
: 查找历史中第一条以command开头的命令并执行!!
: 执行上一条命令