<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.slackwiki.com/index.php?action=history&amp;feed=atom&amp;title=Login_Shell</id>
	<title>Login Shell - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.slackwiki.com/index.php?action=history&amp;feed=atom&amp;title=Login_Shell"/>
	<link rel="alternate" type="text/html" href="https://www.slackwiki.com/index.php?title=Login_Shell&amp;action=history"/>
	<updated>2026-04-09T13:28:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://www.slackwiki.com/index.php?title=Login_Shell&amp;diff=130&amp;oldid=prev</id>
		<title>Erik: Copy from old</title>
		<link rel="alternate" type="text/html" href="https://www.slackwiki.com/index.php?title=Login_Shell&amp;diff=130&amp;oldid=prev"/>
		<updated>2009-06-03T02:32:43Z</updated>

		<summary type="html">&lt;p&gt;Copy from old&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Tips]]&lt;br /&gt;
__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Seeing people give bad advice regarding colored ls output, I figured I better address this problem at the source. If you open a terminal and ls does not give colored output, or the prompt is similar to &amp;lt;code&amp;gt;bash-2.04$&amp;lt;/code&amp;gt; then you are in a non-login shell. This means none of the default profile scripts were sourced.&lt;br /&gt;
&lt;br /&gt;
From the BASH man page:&lt;br /&gt;
&lt;br /&gt;
 When  bash  is  invoked  as  an  interactive login shell, or as a non-interactive shell with the&lt;br /&gt;
 --login option, it first reads and executes commands from the file /etc/profile,  if  that  file&lt;br /&gt;
 exists.   After  reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,&lt;br /&gt;
 in that order, and reads and executes commands from the first one that exists and  is  readable.&lt;br /&gt;
 The --noprofile option may be used when the shell is started to inhibit this behavior.&lt;br /&gt;
&lt;br /&gt;
 When  a  login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it&lt;br /&gt;
 exists.&lt;br /&gt;
&lt;br /&gt;
 When an interactive shell that is not a login shell is started, bash reads and executes commands&lt;br /&gt;
 from  ~/.bashrc,  if  that  file exists.  This may be inhibited by using the --norc option.  The&lt;br /&gt;
 --rcfile file option will force  bash  to  read  and  execute  commands  from  file  instead  of&lt;br /&gt;
 ~/.bashrc.&lt;br /&gt;
&lt;br /&gt;
 When  bash  is  started  non-interactively, to run a shell script, for example, it looks for the&lt;br /&gt;
 variable BASH_ENV in the environment, expands its value  if  it  appears  there,  and  uses  the&lt;br /&gt;
 expanded value as the name of a file to read and execute.&lt;br /&gt;
&lt;br /&gt;
You need to configure your terminal to give you an interactive &amp;quot;login shell&amp;quot;. A login shell is the same as a login at the console. The default profile and user profile scripts will be sourced. Below are some ways to change how your terminal emulator behaves.&lt;br /&gt;
&lt;br /&gt;
==Eterm==&lt;br /&gt;
Chances are if you are using Eterm you know what you're doing and not looking at this page. But just for reference, you can envoke a login shell by passing -l or --login-shell at the command prompt. The preferred method is to edit your .cfg file (the default is $PREFIX/share/Eterm/themes/Eterm/theme.cfg) and add &amp;lt;code&amp;gt;login_shell true&amp;lt;/code&amp;gt; in the toggles section.&lt;br /&gt;
 Eterm -l&lt;br /&gt;
&lt;br /&gt;
==Gnome-Terminal==&lt;br /&gt;
Edit -&amp;gt; Profiles&amp;lt;br&amp;gt;&lt;br /&gt;
Select the profile (Default) and click Edit&amp;lt;br&amp;gt;&lt;br /&gt;
Select the Title and Command Tab&amp;lt;br&amp;gt;&lt;br /&gt;
Check the box next to Run command as a login shell&lt;br /&gt;
&lt;br /&gt;
==Konsole==&lt;br /&gt;
There should be a way to do this from some configuration dialog, but I don't use KDE or Konsole, so all I can recommand at this time is the following:&lt;br /&gt;
 konsole --ls&lt;br /&gt;
&lt;br /&gt;
==xterm / rxvt / aterm==&lt;br /&gt;
 xterm -ls&lt;br /&gt;
 rxvt -ls&lt;br /&gt;
 aterm -ls&lt;br /&gt;
&lt;br /&gt;
==XFCE 4.4 Terminal==&lt;br /&gt;
Open the XFCE terminal.&amp;lt;br&amp;gt;&lt;br /&gt;
Open Edit -&amp;gt; Preferences&amp;lt;br&amp;gt;&lt;br /&gt;
Select the &amp;quot;General&amp;quot; icon at the left.&amp;lt;br&amp;gt;&lt;br /&gt;
Under &amp;quot;Command&amp;quot;, check the box next to &amp;quot;Run command as a login shell&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==screen==&lt;br /&gt;
If you launch ''screen'' directly in a X11 terminal emulator, you will notice that using the ''-ls'' or equivalent terminal emulator option is not enough to get colored ''ls'' output. This is because the terminal emulator is not calling the shell directly, and it's ''screen'' who does. ''screen'' has a configuration file option to use a login shell and another one to modify the system logs as if you had logged in (read the ''screen'' manpage for more details). However, this doesn't seem to be enough to get colored ''ls'' output.&lt;br /&gt;
&lt;br /&gt;
Some people avoid these login shell confusions and problems by trying to get the same ''bash'' environment no matter how ''bash'' ends up being called as an interactive shell. This implies setting the bash prompt (controlled by the environment variable PS1) from the ''.bashrc'' user file and either sourcing ''.bashrc'' from ''.bash_profile'' or making ''.bash_profile'' a link to ''.bashrc''. Additionally, you can include the following lines in your ''.bashrc'' script to '''always''' get colored ''ls'' output:&lt;br /&gt;
&lt;br /&gt;
 if [ -z &amp;quot;$LS_COLORS&amp;quot; ]; then&lt;br /&gt;
     source /etc/profile.d/coreutils-dircolors.sh&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
These recommendations are the &amp;quot;bad advice&amp;quot; the original author mentioned in the first paragraph.&lt;/div&gt;</summary>
		<author><name>Erik</name></author>
	</entry>
</feed>