# Konsole doesn't load .profile



## btomza (Feb 9, 2017)

Hi all,

I'm seeing a problem when I run some "terminal" application on my GUI (OpenBox), I've tried xterm and Konsole, both don't load the .profile file so I don't have available some alias or environment things..

Anyway, It's loaded properly if I run a terminal like Ctrl+Alt+F[x]

Do yo have any idea about that?

Thanks,


----------



## Deleted member 9563 (Feb 9, 2017)

I'm using KDE and it seems that .cshrc overrides .profile for me.


----------



## ShelLuser (Feb 9, 2017)

Heavily depends on what shell you're using. However, a good approach is setting the ENV environment variable and pointing this to a custom profile. For example, my ~/.profile contains this:


```
# Set ENV to sustain ksh profile
ENV=$HOME/.kshrc;

export PATH BLOCKSIZE EDITOR PAGER ENV
```
This ensures that it gets processed every time a new ksh instance starts.


----------



## linux->bsd (Feb 10, 2017)

I think I read somewhere (on the Internet ) that those terminal applications don't treat the sessions as login sessions, which is why ~/.profile doesn't get executed (only .bashrc, etc., since those get executed even in non-login sessions). I'd warn against sourcing ~/.profile from within ~/.bashrc though since that might have unintended consequences.

My execution order goes like this: ~/.bash_profile calls ~/.profile which calls ~/.bashrc, which calls ~/.bash_aliases.

From the `bash` manpage:

```
~/.bash_profile
              The personal initialization file, executed for login shells
       ~/.bashrc
              The individual per-interactive-shell startup file
```

Note: this is for the `bash` shell of course. Other shells might|probably vary.

More manpage:

```
When bash is invoked as an interactive login shell, or as a non-interactive
shell with the --login option, it first reads and executes commands 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 invoked  as  an  interactive  login  shell, or a non-interactive shell
with the --login option, it first attempts to read and execute commands from
/etc/profile and ~/.profile, in that order.
```


----------



## SirDice (Feb 10, 2017)

linux->bsd said:


> I think I read somewhere (on the Internet ) that those terminal applications don't treat the sessions as login sessions, which is why ~/.profile doesn't get executed (only .bashrc, etc., since those get executed even in non-login sessions).


Gnome-Terminal has a checkbox in the profile settings to treat it as a login shell. I'm quite sure Konsole has it too.


----------



## linux->bsd (Feb 10, 2017)

SirDice said:


> Gnome-Terminal has a checkbox in the profile settings to treat it as a login shell. I'm quite sure Konsole has it too.



Sounds like an easy fix then. Or are you saying both of those applications come with that box check-marked by default? Because what the OP described sounds like they're not treating each session as logins, just interactive.


----------



## SirDice (Feb 13, 2017)

linux->bsd said:


> Or are you saying both of those applications come with that box check-marked by default?


No, it's not on by default.


----------



## btomza (Feb 14, 2017)

ShelLuser said:


> Heavily depends on what shell you're using. However, a good approach is setting the ENV environment variable and pointing this to a custom profile. For example, my ~/.profile contains this:
> 
> 
> ```
> ...



I tried it, but ".profile" file it doesn't read when I run "Konsole", the same with ".shrc". Anyway both are read without problem when you start a terminal (tty).


----------

