- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- OS prompt
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 03:23 AM
04-14-2005 03:23 AM
[username@hostname directory] and an indicator # if root user and $ if another user.
Example:
[oracle@myhostname mydir]$
Using command PS1="..." I can adjust to show more data in the prompt. What variables or parameters or syntax should I use to show the OSUser and the indicator # (for root) or the $ for another users?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 03:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 03:50 AM
04-14-2005 03:50 AM
Re: OS prompt
PS1="\u\$"
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 03:52 AM
04-14-2005 03:52 AM
Re: OS prompt
I'm assuming you use bash, which is the default shell. If so, the prompt commands are all in the man page for that shell under PROMPTING.
For your example, to set the prompt to show the hostname,dash,userid followed by the $ or # do:
PS1="\h-\u\$"
ciao!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 06:23 AM
04-14-2005 06:23 AM
Re: OS prompt
The $ symbol, just show the same symbol always, but does not change with root or another user, as the default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 06:59 AM
04-14-2005 06:59 AM
Re: OS prompt
In root's .bashrc, you might just want to put in:
PS1="\h-\u#"
-p
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 12:45 PM
04-14-2005 12:45 PM
Re: OS prompt
'\$' is the inbuilt which gets translated to $ or # for a non-priv/priv user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2005 01:02 PM
04-14-2005 01:02 PM
Re: OS prompt
If you:
PS1="\u@\h blah\$"
It won't do what's expected (as the \'s will protect the 'u', the 'h' and a '$' symbol).
So always echo $PS1 back after setting it to make sure it's what you expected.
You may need to escape the \'s (\\$ for instance).
Check your /etc/bashrc for examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2005 04:25 AM
04-15-2005 04:25 AM
Re: OS prompt
Stuart is right, you need to escape the \ like this:
PS1="\h-\u\\$"
-p