We help IT Professionals succeed at work.

how i can export private & public variables and alias in ssh login

639 Views
Last Modified: 2012-06-27
hi guys..

i want to do ssh and i want use same private & public( variable and alias) in remote machine.
how can i declare those variable in alias?
Comment
Watch Question

Best option would be to copy the contents of your .profile/.bash_profile to the same file on remote mahine.

Creating alias is simple just open your *profile* file and add

alias myAlias="some shell command"

e.g. alias LS = "ls -latr"

Hope this information is of some help.

Cheers!
Forgot to mention.
profile file may be named differently depending upon the shell you use.

If you are using bash then don't forget to do execute source .bash_profile after adding any new entry to the profile file.
> how i can export private & public variables and alias in ssh login
depends on your shell,
# sh and friends
  (set; alias) >myvarsandaliases

# csh and friends
  (set; printenv; alias) >myvarsandaliases

Author

Commented:
i have korn shell will it be work ??
where i have to give this command???
> i have korn shell ..
  (set; alias) >myvarsandaliases

> where i have to give this command???
  on the command line, obviously ...

Author

Commented:
do i have to make changes in .cshrc file...or what..
> do i have to make changes in .cshrc file...or what..
no

BTW, why would you change .cshrc when you use ksh?
Did you ever read any manual about your shell?

Author

Commented:

do i have to use this command to set alias...like this

set alias my='cd /home/mytest/myresult'



no (at least not in ash, bash, csh, esh, ksh, lsh, pdksh, rsh, sh, tcsh, tsh, zsh, ...)

Author

Commented:
then what command i have to use...
command for what?

http:#20005501
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.