How to set alias permanently using command?

Solution 1:

If you don't have any permanent local storage, then you just can't make any permanent settings change. If you do have some permanent local storage that isn't your home directory (which would be pretty strange), you can run this every time you log in:

export HOME=/path/to/permanent/storage
. ~/.profile

You could put your settings in a file available somewhere on the web, at an URL you can remember easily. Then, assuming your home directory is writable (but, I suppose, erased when you log out or something like that), you can download that file and run it:

wget http://www.example.com/~suresh/.profile
. ./.profile

In addition to shell settings, this .profile might contain an archive that it unpacks when you run it, so that you get a .bashrc, a .emacs, a .vimrc, a .Xresources, and whatever else you like. The shar commands from sharutils creates an archive which is embedded in a shell script which unpacks the archive when you run it, relying only on ubiquitous utilities.