Last active
June 6, 2021 21:54
-
-
Save ellemenno/9492550 to your computer and use it in GitHub Desktop.
The little tweaks I've accumulated and grown accustomed to.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prompt (see https://tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html) | |
# this prompt has 3 parts: | |
# 1. exit code indicator. test $? and print green ○ (U+25CB) for success (0), or red ● (U+25CF) for fail (non-zero) | |
# 2. current working directory. print \W in bold | |
# 3. UID indicator. \$ gives # for root, $ otherwise; print in bold | |
export PS1="\$([ \$? = 0 ] && echo '\[\e[32m\]○\[\e[0m\]' || echo '\[\e[31m\]●\[\e[0m\]') \[\e[1m\]\W \$ \[\e[0m\]" | |
# aliases (use `alias` to list) | |
alias ls="ls -hF" | |
alias l="ls -1" | |
alias ll="ls -la" | |
alias todo="grep 'TODO.*' --recursive --line-number --only-matching *" | |
alias fixme="grep 'FIXME.*' --recursive --line-number --only-matching *" | |
alias encrypt="openssl enc -e -aes-256-cbc -a -md sha256 -salt << EOM" | |
alias decrypt="openssl enc -d -aes-256-cbc -a -md sha256 << EOM" | |
# exports | |
export CLICOLOR=1 # let ls and git be colourful | |
export GREP_OPTIONS='--color=auto' # ask grep to highlight matches | |
export LSCOLORS=cxhxgefegxeghdabagacad # define terminal colors, see http://geoff.greer.fm/lscolors/ | |
PATH=$PATH:~/bin # add user home bin to path | |
export PATH | |
# functions | |
# enable cd with history, from [acd_func.sh](http://linuxgazette.net/109/marinov.html) | |
source $HOME/bin/acd_func.sh | |
# cd with terminal title change | |
source $HOME/bin/title_func.sh | |
# piggy back on acd_func.sh to set title after changing directories | |
function cd_title { | |
cd_func "$@" | |
title $(basename `pwd`) | |
} | |
alias cd=cd_title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
on ubuntu, prefs are separated into
.bash_aliases
and.dircolors
:.bash_aliases
for WSL.dircolors