LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   using alias (https://www.linuxquestions.org/questions/linux-general-1/using-alias-93520/)

intruptz 09-16-2003 03:48 PM

using alias
 
Hi,

everytime I use 'alias' it only works in the konsole window I've got open.
How do i make an alias;

a)global - or global for a specific user (does that make sense?)
b)permanent.

cheers

fragglehorn 09-16-2003 03:52 PM

It depends on your distro. On my Debian system a quick edit in ~/.bashrc does the trick. Other systems use /etc/profile. Note that you'll have to logout and back in for the change to occur.

gbell72 09-16-2003 04:01 PM

I don't think you need to logout all the time after adding an alias, 'source .bashrc' or source /etc/profile should work.

intruptz 09-16-2003 04:06 PM

cheers. .bashrc did the trick. At the moment I'm trying out different WMs so I start linux in text mode (i know you can set up WM options with a GUI logon but I've haven't mastered that yet!). Could you do the same for Console or does this only work for bash etc.

Also, am i using Console in the right context - I mean the equivalent of starting in DOS

intruptz 09-16-2003 04:11 PM

Ahh *!?#** Just realised that using alias doesn't work with fbrun in fluxbox. Any ideas how I can do this. LIke I can type 'Mozilla' in to either Konsole or fbrun and Mozilla starts uop fine. where are these setiings stored?

thanks again for you help

yapp 09-17-2003 04:32 AM

If your shell is a login shell, /etc/profile is executed. (usually something like konsole --ls, or bash -l, or "su -") .bashrc is executed by bash (your shell) when it starts. There might also be a /etc/bashrc for all users.

The slackware version of /etc/profile contains something interesting: it also runs all /etc/profile.d/*.sh files, if they are executable. (use chmod +x <file name> for that) If your distro has something like that, this might be a nice way to make the settings permanent, and global for all users. (just add another script there)

I've been experimenting with .bashrc, to execute /etc/profile automatically if it hasn't been done, but it's kind of tricky, because you don't want this to happen if you're using sftp (works over ssh)


All times are GMT -5. The time now is 07:16 AM.