LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-03-2005, 02:20 PM   #1
allelopath
Member
 
Registered: Jan 2003
Location: New Mexico
Distribution: Ubuntu 18.04.3 LTS
Posts: 539

Rep: Reputation: 30
setting alias in bash, permanently


I want to set some permanent aliases for the bash shell.
This would be for all users on my box, which would be my regular user acct and root.
I created the file /etc/profile.local and added some lines like:

alias cdcpp='cd /development/C++'
alias cddoc='cd /document'

but the aliases don't get defined.
I've even restarted the box to be certain.

What do I need to do?

SuSE 9.2 Pro
 
Old 01-03-2005, 02:37 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
They will only last for a bash session, you will need to reset them each time the shell is started. The easiest way would be to put them in your startup script ~/.bashrc or for all users /etc/bashrc
 
Old 01-03-2005, 02:43 PM   #3
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
hmm never messed around with profile.local (set up a test one just for fun though)

Somethings to check:
does the following lines show up in your /etc/profile:
# And now let's see if there is a local profile
test -s /etc/profile.local && . /etc/profile.local

in my /etc/profile.local I put the following:
alias list=ls

After I logged out and logged back in 'list' appears to work.
 
Old 01-03-2005, 02:57 PM   #4
allelopath
Member
 
Registered: Jan 2003
Location: New Mexico
Distribution: Ubuntu 18.04.3 LTS
Posts: 539

Original Poster
Rep: Reputation: 30
>>The easiest way would be to put them in ... for all users /etc/bashrc
My bash.bashrc file says:
# PLEASE DO NOT CHANGE /etc/bash.bashrc There are chances that your changes
# will be lost during system upgrades. Instead use /etc/bash.bashrc.local

>>does the following lines show up in your /etc/profile:
>># And now let's see if there is a local profile
>>test -s /etc/profile.local && . /etc/profile.local
yes
 
Old 01-03-2005, 03:18 PM   #5
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
Both my /etc/profile.local and /etc/bash.bashrc.local work

What kind of file permissions do you have on them? (does everyone have at least read access?)
 
Old 01-03-2005, 04:02 PM   #6
allelopath
Member
 
Registered: Jan 2003
Location: New Mexico
Distribution: Ubuntu 18.04.3 LTS
Posts: 539

Original Poster
Rep: Reputation: 30
permissions are at least read.
/etc/bash.bashrc.local works (for both root and regular user)
but for some reason /etc/profile.local doesn't, maybe its a SuSE thing
anyway, good enough.
thanks for your help
 
Old 10-24-2008, 04:10 AM   #7
please
Member
 
Registered: Apr 2007
Posts: 195

Rep: Reputation: 30
the bash is will be affect when login ?

if I want to system start up without login, how can I do?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the xrandr setting permanently dazdaz Linux - Hardware 2 11-24-2005 01:57 AM
define alias permanently RajRed Linux - General 4 11-19-2005 08:40 AM
setting the default GW permanently hcclnoodles Linux - Networking 6 09-15-2005 09:38 AM
setting up scp alias under bash - parameter passing problem gjr Linux - Newbie 4 06-08-2005 06:38 AM
Permanently Setting the Java_Home Dynapen Linux - Newbie 2 08-04-2004 01:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration