Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
please kindly help me to find the file where are alias stored.
I DO NOT wish to update the alias file using command:
alias something="command"
because when i do it and exit that VPS back to node server, it no longer works next day.
but i want to know which file need to be updated.
I will be adding this line:
alias whoowns '/scripts/whoowns '
Currently whoowns command do not works and i already added that line into files:
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Aliases typically go into a file in your home directory that is executed once when you log in to your account.
They look like this:
Code:
alias lc='/usr/bin/clear; /bin/ls ${LS_OPTIONS} -aCF'
alias ll='/bin/ls ${LS_OPTIONS} -al'
alias cls='clear'
alias hi='history -${LINES}'
alias rs='eval `resize`'
(those are mine, yours will vary).
They can go into ./.profile if you want to cover all the bases (it is the first thing executed when you log in). You mention .cshrc in your post -- note that shell-compatible aliases (sh, BASH, KornShell) will not be compatible with C-Shell syntax (and vice-versa).
Hello,
please kindly help me to find the file where are alias stored.
I DO NOT wish to update the alias file using command:
alias something="command"
because when i do it and exit that VPS back to node server, it no longer works next day.
but i want to know which file need to be updated.
I will be adding this line:
alias whoowns '/scripts/whoowns '
Currently whoowns command do not works and i already added that line into files:
.bashrc
.cshrc
.tcshrc
At the end of "man alias" i see: "GNU Bash-4.0" The OS is: CentOS release 6.7 (Final)
Put your aliases on the VPS in /home/user/.myaliases
Put in /home/user/.bashrc
Code:
source /home/user/.myaliases
type
Code:
source /home/user/.bashrc
and your aliases from /home/user/.myaliases will show up and be present on re-connect to the VPS.
Do I have to explain that the "user" in /home/user is the ssh user?
3 Years... sad.
Agreed.
However, your use of sourcing the .myaliases file isn't something I'd have thought of doing, and it makes sense. I'd just shovel things directly into my .bashrc file.
However, your use of sourcing the .myaliases file isn't something I'd have thought of doing, and it makes sense. I'd just shovel things directly into my .bashrc file.
My use of ".myaliases" is merely for the seemingly under-experienced.
The correct answer to "In which file are aliases stored?" is any where you choose.
I use to have a need to reconcile moving targets, and in my case, my alias file actually contain the
"ssh -i key user@dom.com" parameters for a few clients. Plus I'm very type A, and after years of a single .bashrc,
it just got to be too monolithic. So now I stick everything work-related in ".all.c9aliases" instead of listing them
all in .bashrc
When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of
~/.bashrc.
My preferences are to use '~/.bashrc' but you could use the '--rcfile file' option to insure the file you wish to use for the alias to be stored.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.