A shell is the means by which we communicate on the command line. The shell is simply a program that processes your keystrokes and performs some operations.
There are many shells in common use. By default - in this class - you will have a shell called
bash - https://en.wikipedia.org/wiki/Bash_(Unix_shell) - bash is a replacement for one of the early unix shells called the Bourne shell.
To setup your bash env, when you login to the machine, bash will read the file ".bashrc". This is a file where you can put some customizations into your environment. Some very typical things to do here:
set your PATH. Your PATH variable is an environment variable that tells the shell what directories to search when looking for commands (executable programs).
you can modify your path by putting this line into your .bashrc. For example if you wanted to add the path /share/common/tools/bin to your path:
export PATH=$PATH:/share/common/tools/bin
Whenever you modify .bashrc, the changes will not take effect until you either logout and log back in or your source your .bashrc
% source ~/.bashrc
Bash has lots of features (e.g. command line editting). You can scroll through your command history with
^P (control-P) - go backwards
^N - forwards
"man bash " for more information
To Login to a remote host : ssh username@remote-hostname
ex: ssh -X username@ccom-bang-login.ucsd.edu
The X-forwarding is for graphical display
To Logout: exit/logout/ctrl+D
Create an alias to eliminate typing the whole sentence:
Adding alias bang='ssh -X username@ccom-bang-login.ucsd.edu' to the local-host's bash_profile will allow you to login to bang cluster by typing "bang".
Password-less login:
- Generate a pair of authentication keys on your local host machine
ssh-keygen -t rsa
- Login to the remote host machine (ex: bang) ssh -X username@ccom-bang-login.ucsd.edu
- Create a directory called .ssh and copy the public key to authorized_keys
mkdir -p ~/.ssh
cat .ssh/id_rsa.pub | ssh username@localhost 'cat >> .ssh/authorized_keys'
- Change the permissions of .ssh to 700
- Change the permissions of .ssh/authorized_keys to 640
After this step you can login to the remote host without a password by just typing ssh username@hostname or using the alias.
For more details on password less login refer: http://www.linuxproblem.org/art_9.html