How to Enable Alias Command on Remote Machine Using SSH
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I basically want to run my alias commands on a remote machine via SSH. So, if I do this, ssh test_machine "find_me" (where find_me is an alias command), it will give me this error.
ksh: find_me: not found
How do I solve this?
uhm, maybe a stupid question but just to make sure, have you aliased the commands on the remote machine? Just because you have them set as alies on the machine you're logging in from doesn't mean you have the alias set on the remote machine, since you log in to the remote, i.e. start a new session there. Or have I misunderstood you?
Yes, the command has been alias on the remote machine. So, if I log to the remote machine and I ran "find_me", then it will perform the command.
What I want is to run the command: ssh test_machine find_me, and it will run the command without me needing to log to the machine anymore. This is like if I type ssh test_machine ls, it will list the files but this isn't a problem because ls is not an alias command.
So, if the remote machine uses bash. And I put the alias command in .bashrc, then theoretically it should work (ssh to the remote machine and run an alias command), right? Is this what you mean?
Yes, bashrc will be read. But as I said, I am not sure that aliases will work because of their nature. Functions should, though. So, at it worst, you might need to rewrite the alias as a function, which is trivial enough.