You are not logged in.

#1 2008-01-11 21:36:41

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Editing ~/.bashrc

I've added certain aliases to my "~/.bashrc" file, such as:

alias p="pacman"

They are working for my normal user, but how can I get them to work for the root account?

Many thanks.


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#2 2008-01-11 21:45:01

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

Re: Editing ~/.bashrc

root has it's own dir (/root) if you add the alias to the root bashrc in /root/.bashrc it should work as expected.

Offline

#3 2008-01-11 21:46:22

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Editing ~/.bashrc

Add them to your root user's .bashrc: /root/.bashrc

Offline

#4 2008-01-11 21:52:47

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Editing ~/.bashrc

Additionally, if you want to make it global across all users on your system, you can do something like putting it in "/etc/profile.d/custom.sh" (and chmod +x that file).

Offline

#5 2008-01-11 23:24:41

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Editing ~/.bashrc

phrakture wrote:

Additionally, if you want to make it global across all users on your system, you can do something like putting it in "/etc/profile.d/custom.sh" (and chmod +x that file).

I did this, made the file, made it run as executable and inserted the command

alias pad='mousepad'

and it doesn't work. Am I stupid?

Last edited by jacko (2008-01-11 23:25:00)

Offline

#6 2008-01-11 23:32:39

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: Editing ~/.bashrc

i think you need to log out and log back in before that would take effect. have you done that?


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#7 2008-01-12 00:52:13

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Editing ~/.bashrc

rson451 wrote:

i think you need to log out and log back in before that would take effect. have you done that?

I even reboot. Nothing

Offline

#8 2008-01-12 05:51:51

zyghom
Member
From: Poland/currently Africa
Registered: 2006-05-11
Posts: 432
Website

Re: Editing ~/.bashrc

jacko wrote:
rson451 wrote:

i think you need to log out and log back in before that would take effect. have you done that?

I even reboot. Nothing

.bashrc is loaded when you enter command bash - no need for reboot


Zygfryd Homonto

Offline

#9 2008-01-12 09:56:57

B-Con
Member
From: USA
Registered: 2007-12-17
Posts: 554
Website

Re: Editing ~/.bashrc

If you just type "$ alias", do you see that alias listed?

Offline

#10 2008-01-12 12:33:28

kakTuZ
Member
From: Hannover, Germany
Registered: 2007-10-20
Posts: 86

Re: Editing ~/.bashrc

same problem here. "$ alias" works, "root # alias" gives proper output, too. But

kaktuz ~  $  sudo alias
sudo: alias: command not found

Last edited by kakTuZ (2008-01-12 12:39:00)

Offline

#11 2008-01-12 13:07:18

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Editing ~/.bashrc

Your problem right there. You can't use it that way, with sudo. Or rather, you can't use sudo that way. All my sudo aliases are in ~/. I copied over to /root and just sed all sudos big_smile There may be a way to create a function so the shell checks whether you're root or not and removes sudo before issuing the command, but i'm lazy to figure it out and also having 2 bashrcs is not gonna take up even 1MB of space.


I need real, proper pen and paper for this.

Offline

#12 2008-01-12 15:33:25

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Editing ~/.bashrc

zyghom wrote:
jacko wrote:
rson451 wrote:

i think you need to log out and log back in before that would take effect. have you done that?

I even reboot. Nothing

.bashrc is loaded when you enter command bash - no need for reboot

we are not talking about .bashrc we are talking about /etc/profile.d/custom.sh, I am trying to follow AG's advice and well it doesn't work!

Offline

#13 2008-01-12 15:34:45

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Editing ~/.bashrc

B-Con wrote:

If you just type "$ alias", do you see that alias listed?

no, the only alias I see listed is the one that is in .bashrc of my users ~/ directory. Again, I followed AG's advice precisely and nothing works as suggested.

Offline

#14 2008-01-12 17:22:55

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Editing ~/.bashrc

It doesn't matter what we are talking about, as long as we source it smile So you may want to just have 2 bashrcs and get straight to work. Anyway run a checklist like (1) permissions 755? (2) sourced? to troubleshoot why this doesn't work.

Last edited by schivmeister (2008-01-12 17:27:19)


I need real, proper pen and paper for this.

Offline

Board footer

Powered by FluxBB