SSH keys
Generate your SSH key pair
The SSH key pair contains two files:
Private key: id_rsa
Public key: id_rsa.pub
To generate the key pair, follow the steps:
-
Open Terminal on your PC and locate at your home folder by using
cd ~
1
ssh-keygen -t rsa
-
Set the configurations
Press key
Enter
orreturn
(on Mac) to confirm generating the key pair in your current location.The
ssh-keygen
requires a password. You may use an empty password by directly entering keyEnter
orreturn
but this is not recommended for security issues.Enter your password again to confirm your setting.
Then, the configurations has been saved in
~/.ssh/id_rsa
and the public key has been saved in~/.ssh/id_rsa.pub
. -
Upload the public key
Copy the content in
~/.ssh/id_rsa.pub
on your PC, and paste it into~/.ssh/authorized_keys
on your HPC user homefolder.This process can be done by using two terminal windows. One is locating on your PC homefolder and you can copy the contents of your public key by using
1
pbcopy < ~/.ssh/id_rsa.pub
Open another window to log in the HPC server and create the
authorized_keys
file by1
touch ~/.ssh/authorized_keys
Then edit it by
vim
1
vim ~/.ssh/authorized_keys
and paste the public key content into this file.
Additional Resources
-
For windows users, Bitvise SSH Client
SSH Host Setting
SSH Config File
The SSH config file config
is located in the .ssh
configuration folder under your home directory: ~/.ssh/config
.
Usually you need to created it by yourself as this is not coming as default.
1
touch ~/.ssh/config
You can edit the SSH config file in your terminal by vim
1
vim ~/.ssh/config
or you may use sublime, atom or any editor to change the configurations.
Configuration File Structure
Here is the general format:
1
2
3
4
5
6
7
8
9
Host host_name_1
HostName host.server.com
User username
Port 1234
IdentityFile ~/.ssh/id_rsa
Host *
# change the default_value
Transfering Files
In Terminal
Use scp
to transfer your file.
1
scp path/on/your/pc/file username@host.server.com:path/on/your/HPC/
Example on Habanero:
1
scp MyDataFile <UNI>@habaxfer.rcs.columbia.edu:<DESTINATION_PATH>
Globus.org
Get unified access to your research data, across all systems, using any existing identity.
- It charges, but entering Globus through Xsede is free for use.
Globus is strongly recommended especially for the HPCs which need Token to verify your login.
Softwares
The recommended softwares are:
-
FileZilla
-
Cyberduck
-
CloudMounter
-
Mountain Duck
How to make terminal beautiful
Switch shell to zsh
Installation
-
Install zsh
-
Via source code
-
Recommended
MacOS: use
homebrew
1
brew install zsh
Ubuntu / Debian Linux: use
apt-get
1
sudo apt-get install zsh
-
-
Verify installation by running
zsh --version
. -
Make ZSH your default shell
chsh -s $(which zsh)
1
chsh -s /bin/zsh
-
The configuration file is:
~/.zshrc
. After editing it, close the current terminal window and reopen it to activate the new configuration. Or runsource ~/.zshrc
to activate it immediately.For example, you can copy your alias setting at
~/.bashrc
into~/.zshrc
.Some recommended alias that improves typing efficiency:
1 2 3 4
alias ll='ls -l' alias la='ls -a' alias haba='ssh <uni>@haba***.columbia.edu' alias sz='source ~/.zshrc'
Some useful ones that work well on Habanero HPC:
1 2
alias mysq='squeue -u <uni>' # View your job lists alias work='cd path/to/my/project' # Quick jump to your folder
Documents
Oh My ZSH!
Oh My ZSH is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes.
Installation
Install Oh My ZSH through curl
:
1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
or via wget
1
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Customization
The configurations are in the ~/.zshrc
file. You can use vim
to edit it inside your terminal.
Supported materials:
-
Highly recommended:
-
autojump
: view its github repo -
git
-
Zprezto
Prezto is the configuration framework for Zsh; it enriches the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes.
Installation
-
In Zsh, clone the Zprezto repository:
1
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
-
Create a new Zsh configuration
.zshrc
by copying the following:1 2 3 4
setopt EXTENDED_GLOB for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" done
If there already exists a Zsh configuration, backup it and replace it with a new one.
Customization
The configuration for Zprezto is in ~/.zpreztorc
file.
Why not use Tmux?
Installation
MacOS: use homebrew
1
brew install tmux
Ubuntu / Debian Linux: use apt-get
1
sudo apt-get install tmux
Start & Exit
To start, you can use the simple instruction tmux new
in your terminal. There will be an information bar occuring in the bottom of the terminal window to confirm the using of tmux.
To get out, you can use exit
to close the current pane.
Operate a Session
-
Create a named session
1
tmux new -s [session name]
-
List all the sessions in the current host
1
tmux ls
- Retrieve the last session
1
tmux a
- Retrieve a named session
1
tmux a -t foo [session name]
- Delete a named session
1
tmux kill-session -t [session name]
-
Delete all the sessions
1
tmux kill-server
Detach
Shortcuts
All the command shortcuts in tmux require the prefix shortcut ctrl+b
, which is ^b
on Mac.
Commands for Panes
-
%
Horizontally split the pane into two -
"
Vertically split the pane into two -
x
Close current pane -
{
Move forward current pane -
}
Move backward current pane -
;
Select the last pane -
o
Select next pane -
↑
,↓
,←
,→
Jump to the pane in that direction -
space
Change the layout of panes -
z
Maximize current pane, use it again to recover -
q
Show the index of all the panes, type the corresponding index to jump to the pane
Commands for Window
-
c
Create new window -
p
Switch to the previous window -
n
Switch to the next window -
w
Select in the window list -
&
Close current window -
,
Rename the window -
0
Switch to window No. 0. You may switch to any window using the number id. -
f
Search for the window name
Commands for Session
-
$
Rename current session -
s
Select in session list -
d
Detach the current session, exit the tmux and return to shell
Custom Themes
You can customize tmux through .tmux.conf
file.
A recommended theme collecion: Jim Myhrberg’s tmux-themepack
Additional Resource
-
CheatSheet by MohamedAlaa
-
The Tao of tmux by Tony Narlock
-
Oh My Tmux! by Gregory Pakosz