Skip to content

tmux and ssh for remote access

Hye Min edited this page Sep 25, 2018 · 6 revisions

ssh

What is it for?

ssh is used to access Alienware and Zotac remotely. Currently there is an external IP address assigned by eduroam for each of the machines. To find out the IP address of the machine, on Alienware/Zotac use command:

ifconfig

It should be listed as 'inet addr' under the wifi connection.

Connecting remotely

ssh -X conditionalstudio@<inet_addr>

Password will be required.
-X option enables commands such as imgcat which can be used to display images on the remote terminal. imgcat needs to be installed on the remote machine however. To use imgcat, download and install iTerm2 on MacOS. Then, iTerm2 -> Install Shell Integration. To terminate the connection, type:

exit

scp

What is it for?

scp is a file copying protocol that is based on ssh.

Transferring files

To copy a file from remote machine to conditionalstudio:

scp <path_to_file_to_be_copied> conditionalstudio@<inet_addr>:<path_to_be_copied_to>

To copy a file from conditionalstudio to a remote machine:

scp conditionalstudio@<inet_addr>:<path_to_file_to_be_copied> <path_on_remote_to_be_copied_to>

tmux

What is it for?

tmux is a screen multiplexer. One critical function of tmux for MI_REAS has been to keep the terminal open and the jobs running even after exiting out of remote access ssh. tmux is session based. A session is one instance of bash.

To create a new session:

tmux new -s <name_of_new_session>

To terminate a session:

From outside of tmux, type:

tmux kill-session -t <name_of_session>

You can also type exit from within a session to terminate.

Attach session:

tmux a

After detaching (Ctrl-B D) the session, attach to go back to running sessions.

Hotkeys:

These hotkeys work when you are within tmux.
Ctrl-B D Detach session (Return to non-tmux terminal without terminating session.)
Ctrl-B S List all running sessions. (Then arrow keys -> ENTER or type the alphanumeric name for session.)
Ctrl-B $ Change name of session.
Ctrl-B [ Scroll mode. (Press q to quit.)

For Ctrl-B D for e.g., press Ctrl and b key together, let go, then type d.