clean, comment and classify functions and alias
This commit is contained in:
parent
1041377153
commit
2ce0ec42c8
1 changed files with 74 additions and 48 deletions
124
.bashrc
124
.bashrc
|
|
@ -5,6 +5,10 @@ fi
|
||||||
# . /etc/bash_completion
|
# . /etc/bash_completion
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
|
##############
|
||||||
|
# Networking #
|
||||||
|
##############
|
||||||
|
|
||||||
function proxy()
|
function proxy()
|
||||||
{
|
{
|
||||||
export http_proxy="http://localhost:8888"
|
export http_proxy="http://localhost:8888"
|
||||||
|
|
@ -14,10 +18,42 @@ function proxy()
|
||||||
|
|
||||||
function noproxy()
|
function noproxy()
|
||||||
{
|
{
|
||||||
export http_proxy=""
|
export http_proxy=""
|
||||||
export ftp_proxy=""
|
export ftp_proxy=""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get the current IP adresses on eth0
|
||||||
|
function myip()
|
||||||
|
{
|
||||||
|
MY_IP=$(/sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | sed -e s/adr:// | sed -e s/inet6://)
|
||||||
|
echo $MY_IP
|
||||||
|
}
|
||||||
|
|
||||||
|
# baskcup shortcuts
|
||||||
|
alias rcp='rsync -avz --ignore-existing --progress --rsh "ssh -l nojhan" '
|
||||||
|
alias rcp_443='rsync -avz --ignore-existing --progress --rsh "ssh -p 443 -l nojhan" '
|
||||||
|
|
||||||
|
|
||||||
|
###################
|
||||||
|
# File management #
|
||||||
|
###################
|
||||||
|
|
||||||
|
# Find a file with a pattern in name from the current directory
|
||||||
|
# ff name
|
||||||
|
function ff()
|
||||||
|
{ find . -type f -iname '*'$*'*' -ls ; }
|
||||||
|
|
||||||
|
# move to ~/.Trash instead of rm a file
|
||||||
|
function del()
|
||||||
|
{
|
||||||
|
for i in $* ; do
|
||||||
|
mv $i ~/.Trash
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# move backup files to trash
|
||||||
|
alias clean='mv *~ ~/.Trash/'
|
||||||
|
|
||||||
# Prevents accidentally clobbering files.
|
# Prevents accidentally clobbering files.
|
||||||
alias mv='mv -i'
|
alias mv='mv -i'
|
||||||
alias mkdir='mkdir -p'
|
alias mkdir='mkdir -p'
|
||||||
|
|
@ -33,29 +69,37 @@ alias l='ls -1'
|
||||||
alias la='ls -Al' # show hidden files
|
alias la='ls -Al' # show hidden files
|
||||||
alias lx='ls -lXB' # sort by extension
|
alias lx='ls -lXB' # sort by extension
|
||||||
alias lk='ls -lSr' # sort by size
|
alias lk='ls -lSr' # sort by size
|
||||||
alias lc='ls -lcr' # sort by change time
|
alias lc='ls -lcr' # sort by change time
|
||||||
alias lu='ls -lur' # sort by access time
|
alias lu='ls -lur' # sort by access time
|
||||||
alias lr='ls -lR' # recursive ls
|
alias lr='ls -lR' # recursive ls
|
||||||
alias lt='ls -ltr' # sort by date
|
alias lt='ls -ltr' # sort by date
|
||||||
alias lm='ls -al --color=none|less' # pipe through 'less'
|
alias lm='ls -al --color=none|less' # pipe through 'less'
|
||||||
alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
alias tree='tree -Csu' # nice alternative to 'ls'
|
alias tree='tree -Csu' # nice alternative to 'ls'
|
||||||
|
|
||||||
|
# nautilus file manager in browser mode without destkop management
|
||||||
|
alias nautile='nautilus --no-desktop --browser'
|
||||||
|
|
||||||
|
# Make a directory and move to it
|
||||||
|
function md() {
|
||||||
|
mkdir $1
|
||||||
|
cd $1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#############
|
||||||
|
# Processes #
|
||||||
|
#############
|
||||||
|
|
||||||
alias psg='ps aux|grep ' # grep a process
|
alias psg='ps aux|grep ' # grep a process
|
||||||
|
|
||||||
|
|
||||||
|
##########
|
||||||
|
# Coding #
|
||||||
|
##########
|
||||||
|
|
||||||
alias agrep="ack-grep"
|
alias agrep="ack-grep"
|
||||||
|
|
||||||
# Find a file with a pattern in name from the current directory
|
|
||||||
# ff name
|
|
||||||
function ff()
|
|
||||||
{ find . -type f -iname '*'$*'*' -ls ; }
|
|
||||||
|
|
||||||
# get the current IP adresses on eth0
|
|
||||||
function myip()
|
|
||||||
{
|
|
||||||
MY_IP=$(/sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | sed -e s/adr:// | sed -e s/inet6://)
|
|
||||||
echo $MY_IP
|
|
||||||
}
|
|
||||||
|
|
||||||
# repeat n times command
|
# repeat n times command
|
||||||
# repeat 10 echo "ok"
|
# repeat 10 echo "ok"
|
||||||
function repeat()
|
function repeat()
|
||||||
|
|
@ -67,13 +111,16 @@ function repeat()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# move to ~/.Trash instead of rm a file
|
# ipython shell with correct default apps
|
||||||
function del()
|
alias ipy='ipython -pylab -p scipy --editor="gvim"'
|
||||||
{
|
|
||||||
for i in $* ; do
|
# colored gcc output using the colout command
|
||||||
mv $i ~/.Trash
|
alias cgcc="colout :[0-9]+: yellow standard | colout error | colout warning magenta | colout pragma green standard"
|
||||||
done
|
|
||||||
}
|
|
||||||
|
#################
|
||||||
|
# Configuration #
|
||||||
|
#################
|
||||||
|
|
||||||
# alias I want to learn
|
# alias I want to learn
|
||||||
function h()
|
function h()
|
||||||
|
|
@ -86,6 +133,7 @@ echo "lu : sort by access time"
|
||||||
echo "lr : recursive ls"
|
echo "lr : recursive ls"
|
||||||
echo "lt : sort by date"
|
echo "lt : sort by date"
|
||||||
echo "lm : pipe through 'less'"
|
echo "lm : pipe through 'less'"
|
||||||
|
echo "md : mkdir, cd"
|
||||||
echo "tree : nice alternative to 'ls'"
|
echo "tree : nice alternative to 'ls'"
|
||||||
echo "ff [pattern] : find a file with a pattern in name"
|
echo "ff [pattern] : find a file with a pattern in name"
|
||||||
echo "myip : show the IP address of eth0"
|
echo "myip : show the IP address of eth0"
|
||||||
|
|
@ -98,46 +146,24 @@ echo "rcp : copy with rsync/ssh"
|
||||||
# default editor
|
# default editor
|
||||||
export EDITOR='gvim'
|
export EDITOR='gvim'
|
||||||
|
|
||||||
# move backup files to trash
|
|
||||||
alias clean='mv *~ ~/.Trash/'
|
|
||||||
|
|
||||||
# do not permits to recall dangerous commands in bash history
|
# do not permits to recall dangerous commands in bash history
|
||||||
export HISTIGNORE='&:[bf]g:exit:*>|*::*rm*-rf*:*rm*-f*'
|
export HISTIGNORE='&:[bf]g:exit:*>|*::*rm*-rf*:*rm*-f*'
|
||||||
# append history rather than overwrite
|
# append history rather than overwrite
|
||||||
shopt -s histappend
|
shopt -s histappend
|
||||||
|
# one command per line
|
||||||
|
shopt -s cmdhist
|
||||||
unset HISTFILESIZE
|
unset HISTFILESIZE
|
||||||
HISTSIZE=1000000
|
HISTSIZE=1000000
|
||||||
# ignore commands that start with a space AND duplicate commands
|
# ignore commands that start with a space AND duplicate commands
|
||||||
HISTCONTROL=ignoreboth
|
HISTCONTROL=ignoreboth
|
||||||
# add the full date and time to lines
|
# add the full date and time to lines
|
||||||
HISTTIMEFORMAT='%F %T '
|
HISTTIMEFORMAT='%F %T '
|
||||||
# one command per line
|
|
||||||
shopt -s cmdhist
|
|
||||||
# append history rather than overwritting it
|
|
||||||
PROMPT_COMMAND='history -a'
|
|
||||||
# store history immediately
|
# store history immediately
|
||||||
#; history -n'
|
#; history -n'
|
||||||
|
|
||||||
# baskcup shortcuts
|
# Manually switch to the bépo keyboard layout
|
||||||
alias rcp='rsync -avz --ignore-existing --progress --rsh "ssh -l nojhan" '
|
|
||||||
alias rcp_443='rsync -avz --ignore-existing --progress --rsh "ssh -p 443 -l nojhan" '
|
|
||||||
|
|
||||||
# ipython shell with correct default apps
|
|
||||||
alias ipy='ipython -pylab -p scipy --editor="gvim"'
|
|
||||||
|
|
||||||
# nautilus file manager in browser mode without destkop management
|
|
||||||
alias nautile='nautilus --no-desktop --browser'
|
|
||||||
|
|
||||||
# colored gcc output using the colout command
|
|
||||||
alias cgcc="colout :[0-9]+: yellow standard | colout error | colout warning magenta | colout pragma green standard"
|
|
||||||
|
|
||||||
alias bepo="setxkbmap -layout fr -variant bepo -option"
|
alias bepo="setxkbmap -layout fr -variant bepo -option"
|
||||||
|
|
||||||
function md() {
|
|
||||||
mkdir $1
|
|
||||||
cd $1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Super nice prompt
|
# Super nice prompt
|
||||||
source ~/.prompt.bash
|
source ~/.prompt.bash
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue