1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
eval "`dircolors -b`"
shopt -s histappend
shopt -s checkwinsize
####################
# ALIASES #
####################
# Colors
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias grep='grep --color=auto'
# Classic ls derivatives
alias lc='ls -C'
alias ll='ls -la'
alias lla='ls -laR'
# Paged ls
alias lll='ls -l | less'
# Security
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Print $PATH
alias path='echo $PATH'
# Edit the config files
alias bashrc='vi ~/.bashrc'
alias xdef='vi ~/.Xdefaults'
# Classic cd derivatives
alias cd..='cd ..'
alias ..='cd ..'
alias cd...='cd ../..'
alias ...='cd ../..'
alias cd....='cd ../../..'
alias ....='cd ../../..'
alias cd.....='cd ../../../..'
alias .....='cd ../../../..'
alias cd......='cd ../../../../..'
alias ......='cd ../../../../..'
alias old='cd $OLDPWD'
# Goto home
alias home='cd ~ && clear'
# Goto previous directory and ls
alias up='.. && ls'
# Quick aliases
alias md='mkdir'
alias c='clear'
alias p='pwd'
alias g='grep'
alias h='head'
alias t='tail'
alias r='cd /'
alias l='ls'
alias k='killall'
alias b='~/.bashrc'
alias tc='touch'
# For keyboard errors
alias xs='cd'
alias vf='cd'
# File owners
alias mine='chmod 700'
alias public='chmod 777'
# Other ls derivatives
alias ls..='ls ..'
alias ls...='ls ../..'
alias ls....='ls ../../..'
# Archives
alias targz='tar xzvf'
alias tarbz2='tar xjvf'
# GCC aliases
alias gccw='gcc -W -Wall -ansi -pedantic'
alias g++w='g++ -W -Wall'
alias gccopt='gccw -O0'
alias g++opt='g++w -O0'
alias gccmain='gccw main.c -o main'
alias g++main='g++w main.cpp -o main'
# The man command with other pagers than less
alias mrman='man -Pmore'
alias msman='man -Pmost'
alias prman='man -Ppr'
alias pgman='man -Ppg'
alias lvman='man -Plv'
alias cman='man -Pcat'
# All aliases
alias aliases='cat ~/.bashrc | grep alias'
# Grep derivatives
alias agrep='aliases | grep'
alias hgrep='history | grep'
alias lgrep='ls | grep'
alias pgrep='ps | grep'
# Terminal
alias term='urxvt'
alias cmd='urxvt -e'
# Apt-get aliases
alias inst='sudo apt-get install'
alias update='sudo apt-get update'
# Showing logs
alias logs='tail -f /var/log/system.log'
# Vim practices
alias :q='exit'
alias :wq='exit'
alias :q!='exit'
# Qt project compilation
alias qt='qmake -project && qmake && make'
####################
# FUNCTIONS #
####################
# Create a directory and go in it
function mkcd() { mkdir $1 && cd $1 }
# Save a file
function savefile() { cp $1 $1-`date +%H:%M:%S-%m%d%Y` }
# Take a screenshot
function screenshot() { scrot $1-`date +%H:%M:%S-%m%d%Y` }
# Use a trash
trash='~/trash/'
function del() { mv $1 $trash }
# Go into a directory and ls
function cdl() { cd $1 && ls -l }
# Grep functions
function ugrep() { grep $1 | uniq }
function mgrep() { grep $1 | more }
function lsgrep() { grep $1 | less }
function sgrep() { grep $1 | sort }
function umgrep() { grep $1 | uniq | more }
function ulgrep() { grep $1 | uniq | less }
function smgrep() { grep $1 | sort | more }
function slgrep() { grep $1 | sort | less }
function sumgrep() { grep $1 | sort | uniq | more }
function sulgrep() { grep $1 | sort | uniq | less }
####################
# COLORS #
####################
red='\e[0;31m'
RED='\e[1;31m'
green='\e[0;32m'
GREEN='\e[1;32m'
yellow='\e[0;33m'
YELLOW='\e[1;33m'
blue='\e[0;34m'
BLUE='\e[1;34m'
magenta='\e[0;35m'
MAGENTA='\e[1;35m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
white='\e[0;37m'
WHITE='\e[1;37m'
export PS1='${debian_chroot:+($debian_chroot)}$white[ __ $blue -> \u$white@$blue\h <- $white___ $cyan[ \t ] $white___ in $blue\W $white__ ] $cyan\$ ' |
Partager