Solved

My bash alias isn't executing

Posted on 2016-11-09
5
47 Views
Last Modified: 2016-11-09
I just have one line in my .bashrc - an alias that strives to cd to a specific directory.
What am I missing?

-bash-3.2$ more .bashrc
alias configs='cd /opt/rancid/all-configs'

-bash-3.2$ configs
-bash: configs: command not found

uname -a
Linux cacti-foo 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
0
Comment
Question by:amigan_99
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:savone
ID: 41881067
You have to source the file... type:

source ~/.bashrc

and try again.
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 41881069
~/.bashrc is for non-login shells.
Use ~/.profile or ~/.bash_profile!
0
 
LVL 1

Author Comment

by:amigan_99
ID: 41881074
@saveone - that did the trick. Is there a way I can make that persistent so it works for every login? I tried adding "source ~/.bashrc" as line 1 of .bashrc. But no joy there.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 41881080
~/.profile will be executed automatically!
1
 
LVL 1

Author Closing Comment

by:amigan_99
ID: 41881081
putting the line in .profile did exactly what I needed. Thank you. For some reason it didn't let me add saveone as assisted answer. But thank you also.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which Linux flavors will this run on? 6 76
php ssh2_scp_send 1 48
is my large folder zipped corrupted 4 50
Penetration Testing home based work 3 54
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now