Created
May 20, 2025 14:15
-
-
Save mcnemesis/148aa65103392b50129ac6ea44b0e4aa to your computer and use it in GitHub Desktop.
A custom bash.bashrc.local --- for simplifying life in the modern Bash Terminal
This file contains hidden or 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
#moved into /etc/profile | |
#cat /etc/motd.local | |
#u see, i want a terminal that tells me something, note: 'tells me something', therefore i'll replace the default below | |
#fortune | |
#my crazy nemesis prompts! | |
#this geek_info function runs some bash commands and prints results | |
function geek_info { | |
echo $(echo $PWD | awk -F/ '{print $NF}') | |
} | |
#in my prompt, i'll integrate the output from executing the function geek_info | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]--|On-SERVER|`geek_info`|\[\033[01;34m\]< \t \[\033[01;31m\]\$>*\[\033[00m\] ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]--|On-SERVER|`geek_info`|\[\033[01;34m\]< \t \$>*\[\033[00m\] ' | |
fi | |
#my aliases | |
alias c=clear | |
alias l=ls | |
alias irb="irb --readline -r irb/completion" | |
alias ..="cd .." | |
alias md=mkdir | |
export EDITOR=vim | |
alias irc=irssi | |
#oh, and when u need to make timestamp file names or use those somewhere... | |
alias timestamp="date +'%Y_%b_%d_%H_%M'" | |
alias ss="sudo su" | |
# so that u can just type "go labs" to run/cd "cd /home/username/labs" | |
function go { | |
case $1 in | |
"labs") | |
cd /home/username/labs | |
;; | |
"lab") | |
cd /home/username/labs | |
;; | |
"home") | |
cd /home/username | |
;; | |
esac | |
} | |
function replace_all { | |
#well, let's just echo it and user will invoke this potentially dangerous tool... | |
echo "find . -type f | xargs perl -pi -e 's/$1/$2/g'" | |
#find $PWD -type f | xargs perl -pi -e 's/$1/$2/g' | |
} | |
# for reloading previous/existing screen sessions from last login with just "resume_screen" | |
function resume_screen { | |
screen -d $(screen -ls|grep pts|awk '{print $1}') | |
screen -r $(screen -ls|grep pts|awk '{print $1}') | |
} | |
export VISUAL=vim | |
export EDITOR="$VISUAL" | |
# useful for activating virtualenvs for python virtual environments | |
alias activate="source env/bin/activate" | |
alias start="xdg-open" | |
# could add/remove from above as needed... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment