SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
does not show me as "user@home.org" it shows "sh" or "bash" when root. how do i fix this and set it back to "user@home.org" and also have it show the directory im working in?
I believe that would be the $PS1 variable. Try the following:
Code:
export PS1=\u@\h:\w\$
That should work temporarily. You can edit your ~/.bash_profile or ~/.bashrc to make that permanent. From `man bash`:
Code:
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
When a login shell exits, bash reads and executes commands from the
file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option
will force bash to read and execute commands from file instead of
~/.bashrc.
From that, I would guess you would want to put the PS1 settings in .bashrc instead of .bash_profile so it is read every time a shell is started. Note that you have to run
Code:
$ . ~/.bashrc
(or `source ~/.bashrc) to load the setting immediately following the change (or log out and back in).
i did log back in and out, but due to the "shell" instance not running bash it did NOTHING. im so happy its fixed now, that was soooo retarded wondering where the heck i was in my directory tree. =)
#.bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Create it like you did for the .bashrc
I have that in my .bash_profile, but is I don't think it's necessary for a non-login shell, is it? Unless I'm reading the man page incorrectly, I think .bashrc is sourced when any non-login shell is started (like Konsole). Right?
Good to hear it's working. Yes, I guess you should be using bash in order for that to work. Strange that it wasn't automatically selected though.
and i did create .bash_rc .bashrc .bash_profile and restarted many many times. i was really at the point of wtfings. then i did a "session" "linux console" and it showed up the way i wanted it. i inspected the linux console configuration, and thats how i figured out it was not executing bash.
I have that in my .bash_profile, but is I don't think it's necessary for a non-login shell, is it? Unless I'm reading the man page incorrectly, I think .bashrc is sourced when any non-login shell is started (like Konsole). Right?
Good to hear it's working. Yes, I guess you should be using bash in order for that to work. Strange that it wasn't automatically selected though.
Dude, I believe you're right now that I think about it. Well, at least it won't break anything.
Dude, I believe you're right now that I think about it. Well, at least it won't break anything.
No, it definitely won't break anything. I just have that in my .bash_profile so in a login shell (ie in runlevel 3) all of my aliases will still work since .bashrc is not sourced in a login shell. It just depends on your usage patterns.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.