bash
sudo !! //sudo 执行上一条命令=sudo !-1
sudo !-n // sudo 执行之前第n条命令
history | grep keyword // 查找keyword的相关命令 然后再 !n 执行历史记录中第n条命令
ctrl+R 然后在输入keyword //反向查找命令之前输入的与keyword相关的命令
!keyword:p //打印已keyword开头的历史命令
vi 搜索并且光标定位(如果搜索为xxx)
/xxx/e
个性化 .bashrc
:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Directory navigation aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# enable color support of grep
alias grep='grep --color=auto'
# handy extract
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Prompt
BGREEN='\[\033[1;32m\]'
GREEN='\[\033[0;32m\]'
BRED='\[\033[1;31m\]'
RED='\[\033[0;31m\]'
BBLUE='\[\033[1;34m\]'
BLUE='\[\033[0;34m\]'
NORMAL='\[\033[00m\]'
PS1="${BLUE}(${RED}\w${BLUE}) ${NORMAL}\h ${RED}\$ ${NORMAL}"
# Man page color support
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
ubuntu:
ctrl+alt+T // 打开新终端
ctrl+shift+T // 在终端中打开新标签
ctrl+shift+F // 在终端中搜索
nautilus . // 用文件浏览器打开此目录
#安装新版本的guake
sudo add-apt-repository ppa:linuxuprising/guake
sudo apt-get update
sudo apt install guake
# git difftool 安装
p4merge # git diff merge工具替换为 p4merge (perforce的diff工具,强烈推荐) check this: https://www.cnblogs.com/memory4young/p/installing-and-configuring-p4merge-for-git-on-ubuntu.html
# or download p4merge, add to path
wget https://cdist2.perforce.com/perforce/r21.1/bin.linux26x86_64/p4v.tgz