Find the answer to your Linux question:
Results 1 to 4 of 4
The .bashrc is used for non-login shells, so when I make make any changes in it, like type echo hello, it reflects when I open a new VT(Virtual Terminal, by ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    12

    effect of system-wide and local .profile file

    The .bashrc is used for non-login shells, so when I make make any changes in it, like type echo hello, it reflects when I open a new VT(Virtual Terminal, by clicking on the Terminal icon). But, the .profile file is for the login shell only. If I make any changes to that file (before the point it calls the .bashrc file), where do the changes reflect? in the login shell(the page is so nice, it hardly seems to be a shell). I am asking this because the .profile file is in our home directory, and login shells should have nothing to do with a particular user's file (its general, for all users). There is also a system-wide .profile file. Does editing this, change the login prompt because its not particular to a user.

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    I was under the assumption that a login shell is not the
    login prompt, but the shell you get when you
    first log in to the system, as opposed to other instances
    of the shell you invoke later. The global .profile will affect
    all users and the .profile in your home directory will affect
    you alone.

    I guess one way to experiment would to log in remotely.
    If you have another computer, and run ssh, you could
    compare the environment with that of a local shell. Since
    many of us run a graphical desktop, we don't actually
    see the login shell like we used to.

  3. #3
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    .bash_profile in the user's home directory is sourced when doing ssh logins.

    For example, to get .bashrc sourced when I ssh into my home computer from a remote location, I had to create a file ~/.bash_profile with the contents
    Code:
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi

  4. #4
    Just Joined!
    Join Date
    May 2010
    Posts
    12
    Thanks

    I get the following :

    1. We can only see the login shell only when we login from another computer, not from the same computer.

    2. Even after we login from another computer, we remain in the same login shell until we type sh. Thereafter we are in a non-login shell.

    Am I right ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...