Saturday, June 20, 2020
Most Linux people prefer terminal over GUI (count me in ✋). Doesn't know how others feel but for me using terminal makes feel super excited. Its time to apply some useful and colourful tweaks to our terminal.
🔥 up your terminal
1. Showing git branch name:
~ copy paste the following in terminal.
~ make sure git is installed.
2. Showing the time in prompt:
3. Showing command status:
That's it for now ! I will update more tweaks when I encounter them so keep visiting this page.
Note : Your tweaks gets deleted after closing terminal. So to make it permanent copy your code into .bashrc file (nano ~/.bashrc).
1. Showing git branch name:
~ copy paste the following in terminal.
~ make sure git is installed.
gitB(){
gitps1=$(git branch2>/dev/null |grep'*')
gitps1="${gitps1:+ (${gitps1/#\* /})}"
echo"$gitps1"
}
PS1='\u@\h:\w$(gitB)$ '
2. Showing the time in prompt:
timePrompt(){echo"$(date +%r)"} PS1='[$(timePrompt)] \u@\h:\w$ '
3. Showing command status:
function cstat(){ if[$? -eq 0]; then echo -en"$Green ✔ $Color_Off " else echo-en"$Red ✘ $Color_Off " fi }
PS1='$(cstat)'4. Changing shell prompt color
PS1='\e[33;1m\u@\h: \e[31m\W\e[0m\$ '~Apply your own bash colors
That's it for now ! I will update more tweaks when I encounter them so keep visiting this page.
Note : Your tweaks gets deleted after closing terminal. So to make it permanent copy your code into .bashrc file (nano ~/.bashrc).
Saturday, June 20, 2020
Linux
0 Response to Colorize and customize linux terminal
Comments are personally moderated by our team. Promotions are not encouraged.
Post a Comment