Computing.Net > Forums > Linux > Command Prompt

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Command Prompt

Reply to Message Icon

Name: fguinan
Date: February 28, 2007 at 12:20:09 Pacific
OS: openSuse10.2
CPU/Ram: 2GhzDuo / 2Gb RAM
Product: Dell 8400
Comment:

Hi All -
Just wondering if anyone knows how to change my command prompt to only display the current folder in the directory path - at the moment it shows the full path eg. change from:
linux-:/usr/src/linux/i386#
to
linux-:i386#

I understand that i have to change th $ps1 variable but i'm stuck after that...

Thanks in advance
F



Sponsored Link
Ads by Google

Response Number 1
Name: ernie
Date: February 28, 2007 at 16:50:28 Pacific
Reply:

The available bash command prompt sequences are here

The bash prompt is set in /etc/bashrc:

[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

The above is a single line which sets PS1 to:

[\u@\h \W]\$

which displays the base name of the current dierctory.

If the following command:

echo $PS1

returns:

[\u@\h \w]\$

Change the 'w' in /etc/bashrc to 'W' (no quotes). The line should look similar to the example above.

HTH,

Ernie Registered Linux User 247790
ICQ 41060744


0

Response Number 2
Name: fguinan
Date: March 1, 2007 at 11:59:38 Pacific
Reply:

Thanks Ernie

So easy when you know how!!!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Command Prompt

command prompt www.computing.net/answers/linux/command-prompt/18121.html

Command prompt issue www.computing.net/answers/linux/command-prompt-issue/27217.html

VNC Displays Command Prompt only www.computing.net/answers/linux/vnc-displays-command-prompt-only/26206.html