From Fedora Project Wiki
Line 1: Line 1:
 +
<div style="float: right;" class="toclimit-2">__TOC__</div>
 +
 
== Oh my Bash!!! ==
 
== Oh my Bash!!! ==
 
On this sub-page, I will share my favorite bash setup
 
On this sub-page, I will share my favorite bash setup

Revision as of 20:27, 28 December 2020

Oh my Bash!!!

On this sub-page, I will share my favorite bash setup

Git graph

I use various source code control and I like git!. Want to see the how code evolve and checking the log? This is my favorite alias:

alias gitgraph="git log --graph --date-order --date=format:'%d/%m/%y' --pretty=format:'%C(auto)%h%d %C(reset)%s %C(bold blue)%ce %C(reset)%C(green) (%cd)'"

GyVv3R.png

Be careful

# ═══════════════════════════════════════
# Let be careful, ok?
# ═══════════════════════════════════════
#  interactive
#	-i  prompt before overwrite
#	-v  verbose
alias rm='rm -i -v'
alias mv='mv -i -v'
alias cp='cp -i -v'
alias ln='ln -i'

Proxy

This is how I set proxy on my terminal via bash. I have 2 function setproxy and unsetproxy. For example, Here I how I do to set proxy to my university network. Both function also will setup/reset my git config

## set proxy (BASH only not systemwide)
function setproxy() {
	export NO_PROXY='localhost,127.0.0.0/8,::1,*.uthm.edu.my'
	export no_proxy='localhost,127.0.0.0/8,::1,*.uthm.edu.my'
	export {HTTP,HTTPS,FTP}_PROXY='http://proxy.uthm.edu.my:8080/'
	export {http,https,ftp}_proxy='http://proxy.uthm.edu.my:8080/'

	gsettings set org.gnome.system.proxy mode 'manual'
	gsettings set org.gnome.system.proxy.ftp host 'proxy.uthm.edu.my'
	gsettings set org.gnome.system.proxy.ftp port 8080
	gsettings set org.gnome.system.proxy.https host 'proxy.uthm.edu.my'
	gsettings set org.gnome.system.proxy.https port 8080
	gsettings set org.gnome.system.proxy.http host 'proxy.uthm.edu.my'
	gsettings set org.gnome.system.proxy.http port 8080

	gnome-terminal -x bash -c "git config --global http.proxy \"proxy.uthm.edu.my:8080\""

	echo -e "Proxy environment variable has been setup!"
}

function unsetproxy() {
	unset {HTTP,HTTPS,FTP}_PROXY
	unset {http,https,ftp}_proxy
	unset no_proxy
	unset NO_PROXY

	gsettings set org.gnome.system.proxy mode 'none' 

	gnome-terminal -x bash -c "git config --global http.proxy \"\""

	echo -e "Proxy environment variable removed."
}