AMEMOS A LAIN! - .bashrc

Guía rápida:

$cd /home/usuario
$mousepad .bashrc

Contenido del archivo:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

#HISTSIZE: si el valor es 0 no se guardan los comandos en el historial
HISTFILESIZE: el número de líneas de comandos para guardar en el historial
HISTSIZE=10
HISTFILESIZE=10

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[1;35m\]USUARIO\[\033[00m\]\[\033[1;31m\]\w\[\033[00m\]➤ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    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'
fi

#		Aliases
#		BORRADO SEGURO DE DIRECTORIOS
		alias borra='srm -r -vz'

#		ACTUALIZAR, INSTALAR, ELIMINAR APLICACIONES
		alias miau='sudo apt-get update'
		alias apti='sudo apt-get install'
		alias aptr='sudo apt-get autoremove'
		alias aptu='sudo apt-get upgrade'

#		BORRADO SEGURO DE ARCHIVOS
		alias tritura='shred -u -n9 -vz'

#		DESCIFRAR UN ARCHIVO CIFRADO CON CONTRASEÑA
		alias gpgd='gpg -d -o'

#		CIFRAR UN ARCHIVO CON CONTRASEÑA
		alias cifrar='gpg --cipher-algo AES256 --symmetric'

#		DESCARGAR ARCHIVOS CON WGET
		alias bajar='wget -c --no-cookies --secure-protocol=auto'

#		APAGAR EL SISTEMA
		alias apagar='shutdown now'

#		MOSTRAR CONTENIDO DESTALLADO DE UN DIRECTORIO
		alias l='ls -l -h'

#		GENERA UNA CONTRASEÑA SEGURA DE 40 CARACTÉRES ALFANUMÉRICOS
		alias generar='openssl rand -base64 40'

#		ATAJO PARA EDITAR ESTE ARCHIVO
		alias editar='mousepad ~/.bashrc'

#		ATAJO PARA INICIAR EL REPRODUCTOR MUSICAL MOC
		alias m='mocp'

#		ATAJO PARA SALIR RÁPIDAMENTE DE LA TERMINAL
		alias e='exit'

#		ATAJO PARA LA HERRAMIENTA DEL SISTEMA TOP
		alias t='top'

#		ATAJO PARA VISITAR UNA PÁGINA WEB CON W3M
		alias asd='w3m -no-cookie'

#		ATAJO PARA DESCARGAR TORRENTS
		alias torrent='transmission-cli'

#		ATAJO PARA DESCAGAR UN VIDEO, PARA UNA LISTA DE VIDEOS USAR $y -a list
		alias y='youtube-dl'

#		ATAJO PARA ACCEDER AL EDITOR DE TEXTO
		alias edt='mousepad'

# Función para extraer archivos comprimidos
		extraer () {
   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        ;;
           *)           echo "No sé como extraer esta cosa '$1'..." ;;
       esac
   else
       echo "'$1' ¡PELIGRO, ES VIRUS!"
   fi
 }

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

#
# 	COLORES PARA PAGINAS DE MANUAL
#
# 	DETALLES: mb - modo parpadeo rojo, md - negrita rojo
# 	me - finaliza todos los modos, se - quitar modo resaltado
# 	so - inicia modo resaltado, us - inicia subrayado
# 	ue - finaliza subrayado
#
#	COLORES:
#
#	NEGRO 0;30	 	     GRIS OSCURO 1;30
#	ROJO 0;31		     ROJO CLARO 1;31
#	VERDE 0;32		     VERDE CLARP 1;32
#	CAFÉ 0;33		     AMARILLO 1;33
#	AZUL 0;34		     CELESTE 1;34
#	MORADO 0;35		     ROSA 1;35
#	CYAN 0;36		     CYAN CLARO 1;36
#	GRIS CLARO 0;37	             BLANCO 1;37
#
 
man() {
    env \
        LESS_TERMCAP_mb=$(printf "\e[1;35m") \
        LESS_TERMCAP_md=$(printf "\e[1;35m") \
        LESS_TERMCAP_me=$(printf "\e[0m") \
        LESS_TERMCAP_se=$(printf "\e[0m") \
        LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
        LESS_TERMCAP_ue=$(printf "\e[0m") \
        LESS_TERMCAP_us=$(printf "\e[1;31m") \
            man "$@"
}

# FECHA Y HORA AL INICIAR TERMINAL
tput setaf 5 5 6 ; echo "Hola, hoy es:" ; date '+%A, %B %-d %Y Son las: %H:%M' ; tput sgr0


Powered by Navi