You are not logged in.

#1 2017-01-19 23:59:50

GeneralFailer
Member
Registered: 2013-11-18
Posts: 21

[Solved] Aliases don't work in ttys

I guess this is the appropriate subforum.
I've noticed a while ago that aliases from ~/.bashrc have only worked in X.Org-based emulators for me, but not in ttys. The ones in /etc/bash.bashrc work fine there.

Last edited by GeneralFailer (2017-01-20 12:42:27)

Offline

#2 2017-01-20 00:11:37

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] Aliases don't work in ttys

How do you log in? Is ~/.bashrc sourced by your login shell?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-01-20 00:29:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: [Solved] Aliases don't work in ttys

Please post your ~/.bashrc


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2017-01-20 02:06:55

GeneralFailer
Member
Registered: 2013-11-18
Posts: 21

Re: [Solved] Aliases don't work in ttys

jasonwryan wrote:

How do you log in? Is ~/.bashrc sourced by your login shell?

It's not in /etc/profile, so I guess it isn't. This seems counter-intuitive, shouldn't this be noted in the wiki?
https://wiki.archlinux.org/index.php/Bash#Aliases

Offline

#5 2017-01-20 02:12:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: [Solved] Aliases don't work in ttys

/etc/profile is not relevant to that question.  If you login via a getty and have bash as your default shell, then your ~/.bashrc is sourced.  JWR's question was likely getting at one whether bash is your default shell, or if you had switched to zsh or fish, or something else, or two whether you've replaced agetty and/or systemd/logind's control of the ttys.

If you don't know what any of the above mean, then you almost certainly are using stock logind, agetty, and bash - in which case your bashrc is sourced.  This then leads to my request to see your bashrc.  I suspect there is a conditional within the file that is preventing the aliases from being processed.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2017-01-20 02:17:43

GeneralFailer
Member
Registered: 2013-11-18
Posts: 21

Re: [Solved] Aliases don't work in ttys

Trilby wrote:

/etc/profile is not relevant to that question.  If you login via a getty and have bash as your default shell, then your ~/.bashrc is sourced.  JWR's question was likely getting at one whether bash is your default shell, or if you had switched to zsh or fish, or something else, or two whether you've replaced agetty and/or systemd/logind's control of the ttys.

If you don't know what any of the above mean, then you almost certainly are using stock logind, agetty, and bash - in which case your bashrc is sourced.  This then leads to my request to see your bashrc.  I suspect there is a conditional within the file that is preventing the aliases from being processed.

No, everything should be default.
A simple one like "alias da='date "+%A, %B %d, %Y [%T]"'" isn't processed after relogin either.

EDIT:Probably unrelated, but tty1 is unavailable for me, which I assumed was because of lightdm.

Last edited by GeneralFailer (2017-01-20 02:23:04)

Offline

#7 2017-01-20 03:13:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,530
Website

Re: [Solved] Aliases don't work in ttys

I've asked you to share your ~/.bashrc twice.  If you will not provided the information requested it is highly unlikely that anyone could help you, and even less likely that anyone will bother to try.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2017-01-20 08:18:48

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Aliases don't work in ttys

GeneralFailer wrote:
jasonwryan wrote:

How do you log in? Is ~/.bashrc sourced by your login shell?

It's not in /etc/profile, so I guess it isn't.

/etc/profile is global and sources the global /etc/bash.bashrc for interactive login shells. Locally, in your home directory, you should have the default (copied from /etc/skel) .bash_profile that sources the local .bashrc.

Offline

#9 2017-01-20 12:41:03

GeneralFailer
Member
Registered: 2013-11-18
Posts: 21

Re: [Solved] Aliases don't work in ttys

Trilby wrote:

I've asked you to share your ~/.bashrc twice.  If you will not provided the information requested it is highly unlikely that anyone could help you, and even less likely that anyone will bother to try.

I was trying to say that even one with just "alias da='date "+%A, %B %d, %Y [%T]"'" didn't work.

Raynman wrote:

/etc/profile is global and sources the global /etc/bash.bashrc for interactive login shells. Locally, in your home directory, you should have the default (copied from /etc/skel) .bash_profile that sources the local .bashrc.

I didn't have one in either of my home dirs, weird. Thanks for the help.

EDIT: Is it normal that it was always sourced by xfce4-terminal then?

Last edited by GeneralFailer (2017-01-20 12:43:53)

Offline

#10 2017-01-20 12:49:02

bleach
Member
Registered: 2013-07-26
Posts: 264

Re: [Solved] Aliases don't work in ttys

Raynman wrote:
GeneralFailer wrote:
jasonwryan wrote:

How do you log in? Is ~/.bashrc sourced by your login shell?

It's not in /etc/profile, so I guess it isn't.

/etc/profile is global and sources the global /etc/bash.bashrc for interactive login shells. Locally, in your home directory, you should have the default (copied from /etc/skel) .bash_profile that sources the local .bashrc.

you can also source $home/.bashrc in /etc/bash.bashrc which is relitive so does not mix for user specifics.

Last edited by bleach (2017-01-20 12:51:17)

Offline

Board footer

Powered by FluxBB