7

When I start a new screen, the aliases that I have set in my ~/.profile do not seem to be sourced.

Does anyone know where I can change this or which file is actually read when starting a new screen?

1
  • Doesn't screen -l work?
    – lhf
    Commented Jul 6, 2012 at 22:11

3 Answers 3

4

For an alias to work in ~/.profile the session needs to be a login shell. Bash, which is probably what you're using, is typically read from ~/.bash_profile.

There's a good explanation of the differences mentioned here:

https://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile

1
  • Bash does use .profile iff .bash_profile does not exist. I think you mean .bashrc for a non login shell
    – mmmmmm
    Commented Sep 30, 2023 at 11:08
4

Apple uses ~/.bash_profile as mentioned above. If you want bash inside screen to behave exactly as the Apple Terminal, create a ~/.bashrc file with the command

source /etc/profile

which will include all Apple settings.

1

Add this line to your ~/.screenrc:

shell -$SHELL

As per here

This ensures screen interprets your bash invocation as a login shell, and will source your ~/.bash_profile.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .