Motivations
-
Our computers are powerful, but not always enough for the task at hand.
-
They do not always work 24/7.
-
Some servers (cloud or others) are better equipped for storage and computation ⇒ it would be interesting to be able to use these servers to process our data.
-
These servers are not always physically accessible.
Remote Access
-
Use of SSH (secure shell) protocol and associated tools.
-
Connect from a local workstation to a remote machine and work on it or on a cluster of machines
⇒ Shared resources and/or shared time. -
Often, only the command line is available
⇒ our terminal is a window on the remote machine
⇒ use of the command line
⇒ use a text editor in console mode (Nano, Emacs, Vim, …).
Remote Access
Remote Access
Working Remotely
-
Be able to run commands on a remote machine
→ connect to it and run commands. -
Be able to disconnect from the remote machine without interrupting work in progress
→ launch a program in the background or use a virtual terminal. -
Schedule jobs for certain times of the day
→ use scheduling utilities.
Connection
-
Use of SSH protocol (
sshouPuTTY)$> ssh prince.charming@remote-computer.far.far.away Enter password for prince.charming@remote-computer.far.far.away: remote-computer:~$ ... ... ^Ctrl+D $> -
Encrypted connection
-
login via password or certificate.
⇒ Demonstration
Virtual Terminal
-
Use
tmuxorscreencommands on the remote machine. -
Create multiple virtual terminals within a single terminal (multiplexing).
-
Useful for commands providing output that you want to be able to browse later without having to save it.
-
Allows you to disconnect while the process continues.
Scheduling
-
Use of the
cronservice on the remote machine
→ through thecrontabcommand. -
Allows you to schedule recurring events.
$> crontab -l # m h dom mon dow command 0 3 * * * /usr/local/bin/crunch.sh >> /var/log/crunch.log 2>&1 $> -
crontab -eto edit planning -
crontab -lto visualize planning
References
-
"Unix Text Processing", Dale Dougherty and Tim O’Reilly, Hayden Books, 1987
https://www.oreilly.com/openbook/utp/ -
Christophe Blaess cheat sheets[FR]
https://www.blaess.fr/christophe/developpements/aides-memoires/-
Unix commands[FR]
https://www.blaess.fr/christophe/memo_commandes_unix.html -
Shell programming[FR]
https://www.blaess.fr/christophe/memo_programmation_shell.html
-
-
Rich’s sh (POSIX shell) tricks
https://www.etalabs.net/sh_tricks.html -
Bash Reference Manual
https://www.gnu.org/software/bash/manual/bashref.html
-
Advanced Bash-Scripting Guide
http://tldp.org/LDP/abs/html/ -
"Mastering Regular Expressions, 3rd Edition — Understand Your Data and Be More Productive", Jeffrey Friedl
https://www.oreilly.com/library/view/mastering-regular-expressions/0596528124/ -
"GAWK: Effective AWK Programming", Edition 4.1
http://www.gnu.org/software/gawk/manual -
Manual pages‡ :
bash(1),grep(1),regex(7),gawk(1)
‡ : read thoses pages on your own operating system, not on the Internet!