Created
August 1, 2016 01:45
-
-
Save hjhjw1991/e587ea1b5cdbed423fa641f098fe7173 to your computer and use it in GitHub Desktop.
bash aliases for ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(d ircolors -b)" | |
alias ls='ls --color=auto' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias df='df -h' | |
alias rm='trash' | |
alias rl='trashlist' | |
alias ur='undelfile' | |
#替换rm指令移动文件到~/.trash/中 | |
trash() | |
{ | |
mv $@ ~/.trash/ | |
} | |
#显示回收站中垃圾清单 | |
trashlist() | |
{ | |
echo -e "33[32m==== Garbage Lists in ~/.trash/ ====33[0m" | |
echo -e "\a33[33m----Usage------33[0m" | |
echo -e "\a33[33m-1- Use 'cleartrash' to clear all garbages in ~/.trash!!!33[0m" | |
echo -e "\a33[33m-2- Use 'ur' to mv the file in garbages to current dir!!!33[0m" | |
ls -al ~/.trash | |
} | |
#找回回收站相应文件 | |
undelfile() | |
{ | |
mv -i ~/.trash/$@ ./ | |
} | |
#清空回收站 | |
cleartrash() | |
{ | |
echo -ne "\a33[33m!!!Clear all garbages in ~/.trash, Sure?[y/n]33[0m" | |
read confirm | |
if [ $confirm == 'y' -o $confirm == 'Y' ] ;then | |
/bin/rm -rf ~/.trash/* | |
/bin/rm -rf ~/.trash/.* 2>/dev/null | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment