LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Terminal logging (https://www.linuxquestions.org/questions/linux-newbie-8/terminal-logging-4175464036/)

xmldba 05-29-2013 11:26 PM

Terminal logging
 
In order to make the .bash_probfile read on login, is it better to longin to xterminal with -login option? I am using gnome desktop.

Nikosis 05-30-2013 06:12 PM

Welcome to LQ
Quote:

Originally Posted by xmldba (Post 4961792)
In order to make the .bash_probfile read on login, is it better to longin to xterminal with -login option? I am using gnome desktop.

I don't think it matters

chrism01 05-30-2013 06:21 PM

If you've got bash set as your login shell in /etc/passwd, it'll read it automatically (& .bashrc if its there)

shivaa 05-31-2013 12:22 AM

Quote:

Originally Posted by xmldba (Post 4961792)
In order to make the .bash_probfile read on login, is it better to longin to xterminal with -login option? I am using gnome desktop.

As Chris said, simply change your login shell in /etc/passwd file, then logout and login again so the shell will automatically read your ~/.bashrc or ~/.profile file.

However, explain the issue little more for specific answers.

theNbomr 05-31-2013 09:17 AM

Quote:

Originally Posted by shivaa (Post 4962582)
As Chris said, simply change your login shell in /etc/passwd file, then logout and login again so the shell will automatically read your ~/.bashrc or ~/.profile file.

If you want to have an existing shell session reflect any changes you've made in your shell config file(s), you can always simply source the config file(s), as they are simply shell scripts:
Code:

. ~/.bashrc
This removes the need to log out & log in. You would need to do this for each currently open shell session.

--- rod.

shivaa 05-31-2013 09:22 AM

Quote:

Originally Posted by theNbomr (Post 4962802)
This removes the need to log out & log in. You would need to do this for each currently open shell session.

Little correction. In order to avoid sourcing the ~/.bashrc everytime you login, better change your login shell in /etc/passwd, so you won't need to source the file.

Edit the /etc/passwd file, and make change like this:
Code:

username:x:1234:1234::/home/username:/bin/bash

theNbomr 05-31-2013 10:01 AM

Quote:

Originally Posted by shivaa (Post 4962810)
Little correction. In order to avoid sourcing the ~/.bashrc everytime you login, better change your login shell in /etc/passwd, so you won't need to source the file.

You completely missed my point. For existing shell sessions, you don't need to log out and then login again; simply source the startup script to pull in the changes. I've even seen people recommend to reboot the host in order for their changes to take effect. This is completely un-necessary.
--- rod.


All times are GMT -5. The time now is 11:10 AM.