Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
utilisateurs:arpinux:config:bashrc [02/07/2016 18:41] arpinux fix name |
utilisateurs:arpinux:config:bashrc [27/01/2024 22:07] (Version actuelle) arpinux updates |
||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | ||
# for examples | # for examples | ||
+ | |||
+ | # base ################################################################# | ||
+ | PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games | ||
+ | EDITOR="/usr/bin/vim" | ||
+ | PAGER="/usr/bin/most" | ||
+ | BROWSER="/usr/bin/w3m" | ||
+ | TERM="rxvt-unicode-256color" | ||
+ | ENV=$HOME/.bashrc | ||
+ | |||
+ | export PATH EDITOR PAGER BROWSER TERM ENV | ||
# colors & char ######################################################## | # colors & char ######################################################## | ||
Ligne 9: | Ligne 19: | ||
red='\e[0;31m' | red='\e[0;31m' | ||
blue='\e[0;34m' | blue='\e[0;34m' | ||
+ | magenta='\e[0;35m' | ||
cyan='\e[0;36m' | cyan='\e[0;36m' | ||
green='\e[0;32m' | green='\e[0;32m' | ||
yellow='\e[0;33m' | yellow='\e[0;33m' | ||
+ | orange='\e[38;5;172m' | ||
# text bright colors | # text bright colors | ||
bred='\e[0;91m' | bred='\e[0;91m' | ||
bblue='\e[0;94m' | bblue='\e[0;94m' | ||
+ | bmagenta='\e[0;95m' | ||
bcyan='\e[0;96m' | bcyan='\e[0;96m' | ||
bgreen='\e[0;92m' | bgreen='\e[0;92m' | ||
Ligne 22: | Ligne 35: | ||
NC='\e[0m' | NC='\e[0m' | ||
- | # alias ################################################################ | + | # dir_colors ########################################################### |
- | # ls & grep ------------------------------------------------------------ | + | test -r "~/.dir_colors" && eval $(dircolors ~/.dir_colors) |
- | 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' | + | |
- | alias ll='ls -l' | + | |
- | alias la='ls -A' | + | |
- | alias l='ls -CF' | + | |
- | # cd & goto ------------------------------------------------------------ | + | |
- | alias cd..='cd ..' | + | |
- | alias ...='cd ..' | + | |
- | alias ....='cd ../..' | + | |
- | alias gm='cd /media' | + | |
- | # utils ---------------------------------------------------------------- | + | |
- | # process using web | + | |
- | alias ports='lsof -i -n -P' | + | |
- | # make parent directory if needed | + | |
- | alias mkdir='mkdir -p' | + | |
- | # packages ------------------------------------------------------------- | + | |
- | alias debin='apt-get install' | + | |
- | alias debrm='apt-get autoremove --purge' | + | |
- | alias debsh='apt-cache search' | + | |
- | alias debvs='apt-cache policy' | + | |
- | alias debup='apt-get update && apt-get dist-upgrade' | + | |
- | # quit, exit & reboot -------------------------------------------------- | + | |
- | alias :q='exit' | + | |
- | alias oust='echo "bye $USER..."; sleep 2s && systemctl poweroff' | + | |
- | alias comeback='echo "be back right now..."; sleep 2s && systemctl reboot' | + | |
- | # bash cfg ------------------------------------------------------------- | + | |
- | alias bcfg='$EDITOR ~/.bashrc' | + | |
- | alias brld='source ~/.bashrc' | + | |
- | # end of alias ######################################################### | + | |
- | # functions ############################################################ | + | # alias & functions files ############################################## |
- | # misc ----------------------------------------------------------------- | + | if [ -f ~/.bash_aliases ]; then |
- | # find from name in current directory | + | . ~/.bash_aliases |
- | function ff() { find . -type f -iname '*'$*'*' -ls ; } | + | fi |
- | # generate a dated .bak from file | + | if [ -f ~/.bash_functions ]; then |
- | function bak() { cp $1 $1_`date +%Y-%m-%d_%H:%M:%S`.bak ; } | + | . ~/.bash_functions |
- | # minical | + | fi |
- | function today() { echo -n "Today's date is:\n"; date +"%A, %B %-d, %Y"; } | + | |
- | # infos ---------------------------------------------------------------- | + | |
- | # generate space report | + | |
- | function space() { du -skh * | sort -hr ; } | + | |
- | # hardware ------------------------------------------------------------- | + | |
- | # processor | + | |
- | function core() { cat /proc/cpuinfo | grep "model name" | cut -c14- ; } | + | |
- | # graphic card | + | |
- | function graph() { lspci | grep -i vga | cut -d: -f3 ; } | + | |
- | # ethernet card | + | |
- | function ethcard() { lspci | grep -i ethernet | cut -d: -f3 ; } | + | |
- | # wireless card | + | |
- | function wfcard() { lspci | grep -i network | cut -d: -f3 ; } | + | |
- | # public ip address ---------------------------------------------------- | + | |
- | function my_eip() | + | |
- | { | + | |
- | if [ "$(cat /sys/class/net/eth0/operstate)" = "up" ] || [ "$(cat /sys/class/net/eth1/operstate)" = "up" ] || [ "$(cat /sys/class/net/wlan0/operstate)" = "up" ];then | + | |
- | MY_EXIP=$(wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g') | + | |
- | else | + | |
- | MY_EXIP=$(echo "not connected") | + | |
- | fi | + | |
- | # output | + | |
- | echo -e " $MY_EXIP" | + | |
- | } | + | |
- | # archives ------------------------------------------------------------- | + | |
- | # extract | + | |
- | function extract() | + | |
- | { | + | |
- | if [ -f $1 ] ; then | + | |
- | case $1 in | + | |
- | *.tar.bz2) tar xvjf $1 ;; | + | |
- | *.tar.gz) tar xvzf $1 ;; | + | |
- | *.bz2) bunzip2 $1 ;; | + | |
- | *.rar) unrar x $1 ;; | + | |
- | *.gz) gunzip $1 ;; | + | |
- | *.tar) tar xvf $1 ;; | + | |
- | *.tbz2) tar xvjf $1 ;; | + | |
- | *.tgz) tar xvzf $1 ;; | + | |
- | *.zip) unzip $1 ;; | + | |
- | *.Z) uncompress $1 ;; | + | |
- | *.7z) 7z x $1 ;; | + | |
- | *.xz) unxz $1 ;; | + | |
- | *) echo "'$1' cannot be extracted via >extract<" ;; | + | |
- | esac | + | |
- | else | + | |
- | echo "'$1' is not a valid file" | + | |
- | fi | + | |
- | } | + | |
- | # compress | + | |
- | mktar() { tar cvf "${1%%/}.tar" "${1%%/}/"; } | + | |
- | mktgz() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } | + | |
- | mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; } | + | |
- | mktxz() { tar cvJf "${1%%/}.tar.xz" "${1%%/}/"; } | + | |
- | # end of functions ##################################################### | + | |
# If not running interactively, don't do anything | # If not running interactively, don't do anything | ||
Ligne 128: | Ligne 54: | ||
# don't put duplicate lines or lines starting with space in the history. | # don't put duplicate lines or lines starting with space in the history. | ||
# See bash(1) for more options | # See bash(1) for more options | ||
- | HISTCONTROL=ignoreboth | + | # ignore duplicate commands, ignore commands starting with a space |
+ | export HISTCONTROL="ignoreboth:erasedups" | ||
# append to the history file, don't overwrite it | # append to the history file, don't overwrite it | ||
Ligne 134: | Ligne 61: | ||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | ||
- | HISTSIZE=1000 | + | export HISTSIZE=1000 |
- | HISTFILESIZE=2000 | + | export HISTFILESIZE=2000 |
+ | |||
+ | # ignore specified commands in history | ||
+ | export HISTIGNORE="bm:clr:ls:cd*:blag*:debsh*:debup*:debvs*:debrm*:man*:convert96*:history:exit" | ||
# check the window size after each command and, if necessary, | # check the window size after each command and, if necessary, | ||
Ligne 166: | Ligne 96: | ||
if [ -n "$force_color_prompt" ]; then | if [ -n "$force_color_prompt" ]; then | ||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | ||
- | # We have color support; assume it's compliant with Ecma-48 | + | # We have color support; assume it's compliant with Ecma-48 |
- | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | + | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such |
- | # a case would tend to support setf rather than setaf.) | + | # a case would tend to support setf rather than setaf.) |
- | color_prompt=yes | + | color_prompt=yes |
else | else | ||
- | color_prompt= | + | color_prompt= |
fi | fi | ||
fi | fi | ||
if [ "$color_prompt" = yes ]; then | if [ "$color_prompt" = yes ]; then | ||
- | # uncomment for 'livarp' prompt | + | # arp prompt |
- | #echo -en "\e[1;37mlivarp\e[m0.5\e[0;32mGNU/Linux\e[01;34mDebian\e[m\n" | + | PS1='${debian_chroot:+($debian_chroot)} \e[01;32m\u\e[m@\e[0;36m\h\e[m \e[01;34m\w\e[m\n \$ ' |
- | PS1='${debian_chroot:+($debian_chroot)} \e[01;32m\u\e[m@\e[0;36m\h\e[m \e[01;34m\w\e[m\n $ ' | + | |
- | # uncomment for a guantas_style prompt. sources: http://crunchbang.org/forums/viewtopic.php?pid=277970#p277970 | + | |
- | #PS1="\[\e[00;32m\]\A \[\e[00;35m\]\[\e[00;37m\]\n\[\e[00;35m\]●\[\e[00;33m\] ●\[\e[00;31m\] ●\[\e[01;35m\]\[\e[0m\] " | + | |
# regular Debian colored prompt: | # regular Debian colored prompt: | ||
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | ||
Ligne 199: | Ligne 126: | ||
fi | fi | ||
- | export EDITOR="vim" | ||
- | export BROWSER="surf" | ||
- | export PAGER="most" | ||
</file> | </file> |