LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to view an incomplete prompt in terminal (https://www.linuxquestions.org/questions/linux-general-1/how-to-view-an-incomplete-prompt-in-terminal-929132/)

infinite_scale 02-13-2012 11:42 AM

How to view an incomplete prompt in terminal
 
Hi,

This is probably the easiest to answer thread on LQ.. :-) and the most short lived.. ;-)

In terminal we see the whole prompt as follows:

[root@domain.com]#

Now how can I just see the hash symbol (or follar symbol) and not the whole line?

Moreover how can I set the bash to open in this same way by default in the first place, without having to do it with command?

Thanks

catkin 02-13-2012 12:04 PM

The prompt is normally set globally in /etc/profile and may be set per-user in ~/.bash_profile or ~/.bashrc (which is often sourced from ~/.bash_profile). There will be a line (or perhaps several, one for each of several $TERM values) starting with export PS1=.Other bash startup files are possible but those are the comonly used ones. Have look around to find out where your PS1 is being set. The per-user files are processed after the global file so their PS1 setting supersedes and global one.

Once you have found the effective PS1 setting, change the string after the = to '# ' or '$ '

infinite_scale 02-13-2012 01:19 PM

Sorry catkin, there's no PS1 in either .bashrc, .bash_profile or even /etc/profile

What to do now?

catkin 02-13-2012 09:20 PM

That's unusual. Which distro are you using? Which shell are you using?

PS1 must be set somewhere or you wouldn't have any prompt. Try unset PS1 to test.

Assuming you are using bash and that test results in no prompt, PS1 is set in one of your bash startup files or a file that one of them sources.

infinite_scale 02-14-2012 12:16 AM

I am using Scientific Linux 6.0 and bash shell. I checked all three i.e. etc/profile, bashrc and bash_profile but there's no parameter such as PS1.

When I run unset PS1 the prompt goes invisible but otherwise the commands are running as usual, just the prompt is gone.

catkin 02-14-2012 12:24 AM

If you want to change it globally then you need to find where it is being set (I am assuming bash does not have a default). Please ask for more information if this is what you want to do.

If you want to change it for a single user then export PS1='$ ' in their ~/.bash_profile should do what you want.

infinite_scale 02-14-2012 12:25 AM

Also...how do I get the prompt back?

catkin 02-14-2012 12:42 AM

What did you try?

Close the terminal and log in again?

export PS1='$ ' ?


All times are GMT -5. The time now is 10:28 PM.