Du befindest dich hier: Willkommen » Notizen » Linux » my_aliases

my_aliases

für den user

echo ". $HOME/.my_aliases">>$HOME/.bashrc

für root/sudo

echo ". $HOME/.my_aliases" | sudo tee -a /root/.bashrc

die .my_aliases

Direkt via download:

wget -O $HOME/.my_aliases "https://andev.de/wiki/_media/files/my_aliases.txt"

oder via copy & paste:

nano $HOME/.my_aliases
my_aliases.txt
# add some colorsss
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
 
# set "dir" and "ll"
alias dir='ls -l --color=auto'
alias ll='ls -la --color=auto'
 
# replace dir/ll with exa (if installed)
[ -e "/usr/bin/exa" ] && alias dir='exa -l'
[ -e "/usr/bin/exa" ] && alias ll='exa -la'
 
# set "bat"
[ -e "/usr/bin/batcat" ] && alias bat='batcat'
 
# replace df with duf (if installed)
alias df='df -h'
[ -e "/usr/bin/duf" ] && alias df='duf'
 
# replace find with fd-find (if installed)
alias find='find / -iname'
[ -e "/usr/bin/fdfind" ] && alias find='fdfind -i'
 
# replace neofetch with fastfetch (if installed) - https://github.com/LinusDierheimer/fastfetch
[ -e "/usr/bin/fastfetch" ] && alias neofetch=fastfetch
 
# set "apt" shortcuts
[ -e "/usr/bin/apt" ] && alias ssearch='apt search --names-only'
[ -e "/usr/bin/apt" ] && alias inst='sudo apt install'
[ -e "/usr/bin/apt" ] && alias upds='sudo apt update && sudo apt upgrade -y && sudo apt full-upgrade -y && sudo apt autoremove -y'
 
# set "dnf" shortcuts
[ -e "/usr/bin/dnf" ] && alias ssearch='dnf search'
[ -e "/usr/bin/dnf" ] && alias inst='sudo dnf install'
[ -e "/usr/bin/dnf" ] && alias upds='sudo dnf upgrade -y'
 
# set "pacman" shortcuts
[ -e "/usr/bin/pacman" ] && alias ssearch='pacman -Ss'
[ -e "/usr/bin/pacman" ] && alias inst='sudo pacman -S'
[ -e "/usr/bin/pacman" ] && alias upds='sudo pacman -Syu'
 
# some shortcuts
alias x=exit
alias e=nano
alias c=clear
alias cls=clear
alias cd..='cd ..'
alias wi='whereis'
alias rights='stat -c " %a  %U:%G - %n" *'
alias load='cat /proc/loadavg'
alias www='cd /var/www'
 
# set prompt
if [ -n "$ZSH_VERSION" ]; then
  # SHELL is ZSH
  if [ "$USER" = "root" ]; then
    PROMPT=$'%F{15}┌─[%F{3}%D{%H:%M:%S}%F{15}] %F{1}%n%F{15}@%F{7}%m %F{15}in%f %F{6}%d%f\n%F{15}└>%f%F{reset} '
    RPROMPT=$'%(?.. %? %F{red}%B?%b%F{reset})%(1j. %j %F{yellow}%B?%b%F{reset}.)'
  else
    PROMPT=$'%F{15}┌─[%F{3}%D{%H:%M:%S}%F{15}] %F{2}%n%F{15}@%F{7}%m %F{15}in%f %F{6}%d%f\n%F{15}└>%f%F{reset} '
    RPROMPT=$'%(?.. %? %F{red}%B?%b%F{reset})%(1j. %j %F{yellow}%B?%b%F{reset}.)'
  fi
elif [ -n "$BASH_VERSION" ]; then
  # SHELL is BASH
  if [ "$USER" = "root" ]; then
    export PS1='\n\[\e[0;97m\]\342\224\214\342\224\200[\[\e[0;33m\]\t\[\e[0;97m\]] \[\e[0;91m\]\u\[\e[0;97m\]@\[\e[0;37m\]\h\[\e[0;97m\] in \[\e[0;96m\]$PWD \n\[\e[0;97m\]\342\224\224> \[\e[0m\]'
  else
    export PS1='\n\[\e[0;97m\]\342\224\214\342\224\200[\[\e[0;33m\]\t\[\e[0;97m\]] \[\e[0;92m\]\u\[\e[0;97m\]@\[\e[0;37m\]\h\[\e[0;97m\] in \[\e[0;96m\]$PWD \n\[\e[0;97m\]\342\224\224> \[\e[0m\]'
  fi
else
  echo "# unknown shell"
fi
 
# set terminal title
echo -ne "\033]0;$USER@$HOSTNAME\007"
notes/linux/my_aliases.txt · Zuletzt geändert: 06.05.2022 08:24 von Martin