Solved

My bash alias isn't executing

Posted on 2016-11-09
5
51 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Mint 18 31 90
how can I get powershell to show the history of commands used ? 10 56
Like to learn Linux, need advice for a good book and setup. 3 45
number in printf 13 27
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 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