You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.4 KiB

# This turns your long terminal prompt into a shorter prompt.
# (inspired by CentOS's current-folder-only prompt and mixed with Ubuntu's full path prompt).
me=`whoami`
PROMPT_COMMAND='_dir=`pwd`;if [ ${#_dir} -ge 35 ]; then _mydir=`pwd | cut -c1-16`; _mydir=${_mydir}.../`pwd | rev | cut -d/ -f1 | rev`; else _mydir=`pwd`; fi; _mydir=`echo $_mydir | sed "s/^\/home\/$me/~/g"`; PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u\[\033[1;31m\]@\[\033[1;33m\]\h\[\033[00m\]:\[\033[0;36m\]$_mydir\[\033[00m\]\$ "'
# Sometimes sudo doesn't show colors. The space after the command fixes this for some reason
alias sudo="sudo "
# When launching Ubutnu WSL this makes sure we start in our home directory instead of the
# system32 directory (caused by run -> ubuntu2004) or the Windows user's home directory.
# (replace root in /mnt/c/Users/root with your Windows user's username for proper detection)
bashrc_start_dir=`pwd`
if [[ $bashrc_start_dir == "/mnt/c/Users/root" || $bashrc_start_dir == "/mnt/c/Windows/system32" ]]
then
cd
fi
# Ever wanted to open Windows explorer in whatever directory you're in to work on the files
# in Windows? Well this allows you to do exactly that, just like in the Command Prompt.
alias explorer=explorer.exe
# Tired of seeing all the tmpfs partitions in df? This alias has you covered!
alias dfh="df -h | grep -v tmpfs"