Jump to content

Recommended Posts

V.T. Eric Layton
Posted

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? :rolleyes:

 

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.

 

:rolleyes: Yup... bored.

securitybreach
Posted

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

V.T. Eric Layton
Posted

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.

Posted (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 by jimg
V.T. Eric Layton
Posted

Pretty cool, Jim. Yeah, there's all kinds of neat stuff you can do with Linux. Ain't it wonderful?! ;)

securitybreach
Posted

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

  • 2 years later...
V.T. Eric Layton
Posted

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.

  • Like 1
securitybreach
Posted

I do the same except I have my prompt showing different hostnames since I use the same username on most of my machines.

V.T. Eric Layton
Posted

That would work even gooder, actually. All my systems have unique host names also. Hmmmm... something to think about. :yes:

securitybreach
Posted

Ex:

╔═ comhack@Cerberus 01:13 PM
╚═══ ~/ 

 

[comhack@DarkStar ~]$

V.T. Eric Layton
Posted

Is DarkStar a Slackware machine? ;)

securitybreach
Posted

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

securitybreach
Posted

It is pretty useful when you ssh in and ssh out from them all.

securitybreach
Posted

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...

  • Like 1
V.T. Eric Layton
Posted

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

V.T. Eric Layton
Posted

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~:#

 

:)

securitybreach
Posted

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 :hysterical:

V.T. Eric Layton
Posted

It so the hackers know who's machines they are. ;)

 

You'll love my wifi network name: nocturnal.net :yes:

securitybreach
Posted

Very cool, mine is 'Baphomet'.

Posted

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.

  • Agree 1
V.T. Eric Layton
Posted

Yup. Don't wanna' do stupid stuff.

securitybreach
Posted

Eh, I dunno. I have learned quite a lot from making mistakes. ;) B)

Posted

Eh, I dunno. I have learned quite a lot from making mistakes. ;) B)

Me too. (See my sig) o:)
  • Like 1
V.T. Eric Layton
Posted

Yeah, that's true. It's best to learn from others' mistakes, though. :yes:

  • Like 1
securitybreach
Posted

Yeah, that's true. It's best to learn from others' mistakes, though. :yes:

 

Right :hysterical:

V.T. Eric Layton
Posted

You do get wiser as you get older... or maybe just lazier and more cautious. ;)

  • Like 1
securitybreach
Posted

You do get wiser as you get older... or maybe just lazier and more cautious. ;)

Right :hysterical:

Posted

Yeah, that's true. It's best to learn from others' mistakes, though. :yes:

Especailly since I don't make any

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...