Skip to content

Instantly share code, notes, and snippets.

@brahimmachkouri
Last active October 29, 2024 08:32
Show Gist options
  • Save brahimmachkouri/d54f6a8c61ccf0861f40 to your computer and use it in GitHub Desktop.
Save brahimmachkouri/d54f6a8c61ccf0861f40 to your computer and use it in GitHub Desktop.
To Download : wget bit.ly/my-bashrc
umask 077
EDITOR=nano
export EDITOR
HISTFILESIZE=-1
export HISTFILESIZE
alias ll='ls -laFhGH'
alias h='history'
alias cd..='cd ..'
alias df='df -h'
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
bleu="\[\e[0m\]\[\e[00;34m\]"
blanc="\[\e[0m\]\[\e[01;37m\]"
rouge="\[\e[0m\]\[\e[01;31m\]"
violet="\[\e[0m\]\[\e[01;35m\]"
gris="\[\e[0m\]\[\e[00;37m\]"
vert="\[\e[0m\]\[\e[01;32m\]"
jaune="\[\e[0m\]\[\e[01;33m\]"
#ip=$(/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ printf "%s|",$1}' | sed 's/.$//')
#ubuntu 17.10
#ip=$(/sbin/ifconfig | grep 'inet '| grep -v '127.0.0.1' | awk '{ printf "%s|",$2}' | sed 's/.$//')
#ubuntu 18.04..22.04
ip=$(/sbin/ip addr | grep 'inet '| grep -v '127.0.0.1' | awk '{ printf "%s|",$2}' | sed 's/.$//')
#ubuntu 22.04 multipass
#ip=$(multipass exec $vmname -- /sbin/ip addr | grep 'inet '| grep -v '127.0.0.1' | awk '{ printf "%s|",$2}' | sed 's/.$//' | cut -d '/' -f1)
#for macOS :
#ip=$(/sbin/ifconfig | grep 'inet '| grep -v '127.0.0.1' | awk '{ printf "%s|",$2}' | sed 's/.$//')
heure="$jaune\A "
user="$bleu\u "
user+="$blanc[$ip] "
host="$rouge[\H] "
chemin="$violet\w\n"
prompt="$vert\\$ "
end="$gris\[\e[0m\]"
export PS1=$heure$user$host$chemin$prompt$end
export LSCOLORS=ExFxBxDxCxegedabagacad
# Afficher la mémoire totale occupée
echo -e "\n*** Mémoire totale occupée : ***"
free -h | awk '/Mem:/ {print $3 " / " $2 " utilisés"}'
# Afficher la place libre sur le disque dur
echo -e "\n*** Espace disque libre : ***"
df -h --total | grep 'total' | awk '{print $4 " libres sur " $2}'
function cd() {
new_directory="$*";
if [ $# -eq 0 ]; then
new_directory=${HOME};
fi;
builtin cd "${new_directory}" && ll
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment