Outils pour utilisateurs

Outils du site


linux:installation:bashrc

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
linux:installation:bashrc [2022/11/02 08:47] tutospistolinux:installation:bashrc [2025/09/29 19:06] (Version actuelle) tutospisto
Ligne 1: Ligne 1:
 +Pour changer les infos du PS1 plus facilement : [[https://bashrcgenerator.com]]
 +
 <hidden ====== Mon fichier bashrc ======> <hidden ====== Mon fichier bashrc ======>
  
Ligne 37: Ligne 39:
  
 if [ "$color_prompt" = yes ]; then if [ "$color_prompt" = yes ]; then
-    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '+    PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;11m\]\@\[$(tput sgr0)\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 else else
     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
Ligne 255: Ligne 257:
     # Comment in the above and uncomment this below for a color prompt     # Comment in the above and uncomment this below for a color 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[38;5;11m\]\A\[$(tput sgr0)\] \[$(tput bold)\]\[\033[38;5;46m\]\u\[$(tput sgr0)\]\[\033[38;5;28m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 
  
  
Ligne 393: Ligne 396:
 </hidden> </hidden>
  
 +
 +
 +====== Ajouter une fonction de recherche au bashrc ======
 +
 +<code bash>
 +        trouve() {
 +                if [[ -z $2 ]]
 +                then
 +                        dossier="/home/user/repertoireParDefaut"
 +                else
 +                        dossier=$2
 +                fi
 +                find $dossier -iname "*"$1"*" -type f -exec du -h '{}' + | sort -hr | head
 +        }
 +</code>
 +<code bash>iname = insensible à la casse</code>
 +<code bash>head = ne conserve que les 10 premiers résultats</code>
 +<code bash>sort -hr = permet de trier les fichiers (plus grands en premiers)</code>
 +<code bash>    function extract() {
 +        if [ -f $1 ] ; then
 +            case $1 in
 +                *.7z)       7z x $1         ;;
 +                *.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   ;;
 +                *)          echo "'$1' Ne peut pas être extraite via cette commande." ;;
 +            esac
 +        else
 +            echo "'$1' ne semble pas un fichier valide."
 +        fi
 +    }</code>
linux/installation/bashrc.1667378857.txt.gz · Dernière modification : de tutospisto