V.T. Eric Layton Posted November 28, 2009 Posted November 28, 2009 I got bored earlier today and tweaked the prompt on all my distros to look like these... In Slackware: vtel57_Slackware~:$ root_Slackware~:# In Debian: vtel57_Debian~:$ root_Debian~:# In CentOS: vtel57_CentOS:~$ root_CentOS:~# Et cetera... you get the idea. The ~ signifies the /home directory for the user. If I move to say /etc/X11, it would look like this: vtel57_Slackware/etc/X11:$ root_Slackware/etc/X11:# Cool, huh? I used a combination of Bruno's Tweaking the Prompt tip and another script found elsewhere to colorize the root prompt. I had to tweak the .bashrc in /home/vtel57 and the .bashrc in /(root) to achieve this. Here are the mods I used: /home/vtel57/.bashrc # /home/vtel57/.bashrc# custom promptPS1="\u_\w:$ " /(root).bashrc # ~/.bashrc: executed by bash(1) for non-login shells.export PS1='\u_\w\:$ '# root prompt = redTERM_USER_HOST_COLOR='0;31m'TERM_PATH_COLOR='0;31m'TERM_PROMPT_COLOR='0;31m'TERM_USER_HOST='\u_'TERM_PATH='\w'TERM_PROMPT='\$'export PS1=\'\[\e['${TERM_USER_HOST_COLOR}'\]'${TERM_USER_HOST}'\[\e[m\]'\'\[\e['${TERM_PATH_COLOR}'\]'${TERM_PATH}'\[\e[m\]'\'\[\e['${TERM_PROMPT_COLOR}'\]:#\[\e[m\] ' Where you see "", I inserted my distribution name. Yup... bored. Quote
securitybreach Posted November 28, 2009 Posted November 28, 2009 Very cool!!! I imagine that helps with all the distros you run on your machine. So you added that to the ~/.bashrc in all your partitions for user and root?Thanks Quote
V.T. Eric Layton Posted November 28, 2009 Author Posted November 28, 2009 Yup... and yes, it does help. Sometimes, I boot into a distro to tweak/update or whatever and forget where I'm at after a while. The red root prompt also alerts me that I'm root. It's a hard-to-miss visual reminder. Quote
jimg Posted November 28, 2009 Posted November 28, 2009 (edited) You can also title your terminal windows.For instance, try echo -ne "\033]0;Free Space\007";watch df and you should get a terminal window titled Free Space.You can also put this into a function for use in a script: title() { echo -ne "\033]0;${1}\007"} and then when your script can set the title as needed like this:title "Pass 1"(commands for pass 1)title "Pass 2"(commands for pass 2)I use this when I encode video so that I know generally where it is in the process.Tested on Ubuntu 64 bit - I assume that this should work on most of the others as well. Edited November 28, 2009 by jimg Quote
V.T. Eric Layton Posted November 28, 2009 Author Posted November 28, 2009 Pretty cool, Jim. Yeah, there's all kinds of neat stuff you can do with Linux. Ain't it wonderful?! Quote
securitybreach Posted November 29, 2009 Posted November 29, 2009 Thats pretty cool Jim. If I used window titles on my terminal, I would definitely use these scripts. Saved in Documents for future use. Thanks Quote
V.T. Eric Layton Posted July 28, 2012 Author Posted July 28, 2012 Very cool!!! I imagine that helps with all the distros you run on your machine. So you added that to the ~/.bashrc in all your partitions for user and root?Thanks By the way, custom user prompts and custom-colored root prompts that state the operating system are VERY handy when sshing. For example, if I'm on my shop system in Slackware and I ssh into my main system that is booted to Arch, my user prompt will change from vtel57_slackware~:$ to vtel57_arch~:$. It's even better with the red root prompt because you don't want to be making changes as root in an ssh environment only to realize later that you edited the file in your primary booted OS by accident. 1 Quote
securitybreach Posted July 28, 2012 Posted July 28, 2012 I do the same except I have my prompt showing different hostnames since I use the same username on most of my machines. Quote
V.T. Eric Layton Posted July 28, 2012 Author Posted July 28, 2012 That would work even gooder, actually. All my systems have unique host names also. Hmmmm... something to think about. Quote
securitybreach Posted July 28, 2012 Posted July 28, 2012 Ex: ╔═ comhack@Cerberus 01:13 PM ╚═══ ~/ [comhack@DarkStar ~]$ Quote
V.T. Eric Layton Posted July 28, 2012 Author Posted July 28, 2012 Is DarkStar a Slackware machine? Quote
securitybreach Posted July 28, 2012 Posted July 28, 2012 Is DarkStar a Slackware machine? No but that is where I originally got the name. The hostname used to be a Slackware machine years ago but now it is my Arch machine on Linode VPS. I mostly use planet names for my other machines: Cerbrus (main rig) Neptune (Laptop) Pluto (eeepc) MiniMe (HP Mini) Nitro (phone) Mars (N810) Baphomet (router/server) The only ones I have not named yet are my HP Touchpad and my Nexus 7. Oh, I forgot about my other laptop: Saturn Quote
securitybreach Posted July 28, 2012 Posted July 28, 2012 It is pretty useful when you ssh in and ssh out from them all. Quote
securitybreach Posted July 28, 2012 Posted July 28, 2012 Just gave my Nexus 7 a hostname: Athena: The goddess of wisdom, warfare, battle strategy, heroic endeavour, handicrafts and reason. According to most traditions, she was born from Zeus's head fully formed and armored. She was depicted crowned with a crested helm, armed with shield and a spear. Her symbol is the olive tree. She is commonly shown accompanied by her sacred animal, the owl. http://en.wikipedia.org/wiki/Athena Sorry to (sorta) get off topic... 1 Quote
V.T. Eric Layton Posted July 28, 2012 Author Posted July 28, 2012 Cool! I have such unimaginative host names: ericsbane05 - my main system ericsshop02 - my shop system ericslaptop01 - my Dell Inspiron 1521 home office laptop (the one you gave me ) jennieslaptop - the Dell Latitude D410 that my niece gave me Quote
V.T. Eric Layton Posted July 30, 2012 Author Posted July 30, 2012 Inspired by Josh's suggestion about using hostnames... My new prompts: vtel57@ericsbane05|Slackware~:$ root@ericsbane05|Slackware~:# vtel57@ericsbane05|Arch~:$ root@ericsbane05|Arch~:# vtel57@ericsslaptop01|Slackware~:$ root@ericslaptop01|Slackware~:# vtel57@ericsshop02|Slackware~:$ root@ericsshop02|Slackware~:# Quote
securitybreach Posted July 30, 2012 Posted July 30, 2012 Inspired by Josh's suggestion about using hostnames... My new prompts: vtel57@ericsbane05|Slackware~:$ root@ericsbane05|Slackware~:# vtel57@ericsbane05|Arch~:$ root@ericsbane05|Arch~:# vtel57@ericsslaptop01|Slackware~:$ root@ericslaptop01|Slackware~:# vtel57@ericsshop02|Slackware~:$ root@ericsshop02|Slackware~:# Looks good but a bit long. If I were you, I would use something like: vtel57@laptop|Slack~:$ vtel57@laptop|Arch~:$ vtel57@shop1(2)|Slack~:$ vtel57@shop1(2)|Arch~:$ No point in the Eric part as you already know who's machines they are Quote
V.T. Eric Layton Posted July 30, 2012 Author Posted July 30, 2012 It so the hackers know who's machines they are. You'll love my wifi network name: nocturnal.net Quote
V.T. Eric Layton Posted July 30, 2012 Author Posted July 30, 2012 Ol' Bapho was an interesting fellow... https://en.wikipedia.org/wiki/Baphomet Quote
securitybreach Posted July 30, 2012 Posted July 30, 2012 Ol' Bapho was an interesting fellow... https://en.wikipedia.org/wiki/Baphomet Indeed!! Quote
amenditman Posted August 1, 2012 Posted August 1, 2012 On all my systems I "fix" my bash prompt to be blue for normal user and red for root. Nothing fancy, but an effective visual clue to remind me not to do something stupid. When I see red, I stop and think before issuing a command. 1 Quote
V.T. Eric Layton Posted August 2, 2012 Author Posted August 2, 2012 Yup. Don't wanna' do stupid stuff. Quote
securitybreach Posted August 2, 2012 Posted August 2, 2012 Eh, I dunno. I have learned quite a lot from making mistakes. Quote
amenditman Posted August 2, 2012 Posted August 2, 2012 Eh, I dunno. I have learned quite a lot from making mistakes. Me too. (See my sig) 1 Quote
V.T. Eric Layton Posted August 2, 2012 Author Posted August 2, 2012 Yeah, that's true. It's best to learn from others' mistakes, though. 1 Quote
securitybreach Posted August 2, 2012 Posted August 2, 2012 Yeah, that's true. It's best to learn from others' mistakes, though. Right Quote
V.T. Eric Layton Posted August 2, 2012 Author Posted August 2, 2012 You do get wiser as you get older... or maybe just lazier and more cautious. 1 Quote
securitybreach Posted August 2, 2012 Posted August 2, 2012 You do get wiser as you get older... or maybe just lazier and more cautious. Right Quote
crp Posted August 2, 2012 Posted August 2, 2012 Yeah, that's true. It's best to learn from others' mistakes, though. Especailly since I don't make any Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.