ssh
Forget ips with .ssh/config
General options:
Compression yes
ServerAliveInterval 3600
ControlMaster auto
ControlPersist yes
ControlPath ~/.ssh/socket-%r@%h:%p
Server specific options:
Host ens
HostName ssh.ens-lyon.fr
User lmodolo
Host work
HostName 140.77.196.178
User laurent
Tunnels:
Host work-ens
ProxyCommand ssh -e none ens exec nc %h %p 2>/dev/null
HostName 140.77.196.178
User laurent
To activate your access to ssh.ens-lyon.fr, go to: https://instella.ens-lyon.fr/stella/intra/ent-ssh.html
Key login
Generate key:
ssh-keygen -t rsa -C "laurent.modolo@ens-lyon.fr" -b 4096 -f ~/.ssh/id_ens
Send key to the server:
ssh-copy-id -i ~/.ssh/id_ens.pub ens
Use key when login on the server with .ssh/config
:
Host ens
HostName ssh.ens-lyon.fr
User lmodolo
IdentitiesOnly yes
IdentityFile ~/.ssh/id_ens
rsync a better scp
Copy that only update files
rsync -auv -e ssh server:path local_path
Copy that check if files are really different
rsync -rcv -e ssh server:path local_path
tmux
tmux is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.
configure tmux
Edit ~/.tmux.conf
unbind C-b
set -g prefix C-a
bind C-a send-prefix
Those changes will make tmux the same shortcut as screen, his older brother.
use tmux
Start tmux:
tmux
Shortcut press ctrl+a and:
- c create window
- w list windows
- n next window
- p previous window
- x kill window
- 0-9 switch to windows 0-9
attach:
tmux a
detach:
tmux detach