Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-14-2006, 10:36 AM   #1
LQ Newbie
Registered: Jan 2005
Posts: 29

Rep: Reputation: 15
How can I mod my .bashrc so that it JUST shows the dir I am in?

How can I mod my .bashrc so that it just shows the dir I am in? Currently, when I change directories, I see the entire path.... e.g.

What I see is


But I would prefer


Or something similar...

Old 11-14-2006, 10:49 AM   #2
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Rep: Reputation: 15
You set it via the $PS1 variable...but I don't know the syntax
Old 11-14-2006, 10:53 AM   #3
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
Change '\w' to '\W' in the $PS1 variable.
Old 11-14-2006, 10:55 AM   #4
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 17
Posts: 150

Rep: Reputation: 18
PS1="\u@\h:\w >"

Would give you the user,host, and full working directory.

PS1="\u@\h:\W >"

Would give you the user, host, and just your top level directory.
Old 11-14-2006, 10:58 AM   #5
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
what you want is the norm on most distro's.... just run "export PS1=\u@\h \W\>"

heh, forgot to press reply...

as a note, you have the ~ symbol in there which is representative of your home directory, so that would not be used if you onyl have a single lower level directory there.

Last edited by acid_kewpie; 11-14-2006 at 10:59 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ndiswrapper shows hardware, but iwconfig shows no device ZST Linux - Hardware 6 04-20-2006 01:15 PM
Share configuratin dir (.dir) for 3 accounts on local computer LiNuXkOlOnIe Linux - Software 5 01-08-2006 04:36 AM
snmp staus shows it running but on trying MRTG, it shows public@ipaddr not giving res swati220781 Linux - Networking 3 07-08-2004 06:32 PM
desktop shows on TV but movie shows black screen litrelord Mandriva 6 07-05-2004 06:10 AM
tech tv shows how to mod x-box. cool Brain Drop General 0 04-02-2003 04:27 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration