Some typical advantages:
Typical cloud services:
CPU/RAM (size), Operating System, Machine name
If the default storage is not enough (storage typically incurs a fee as well)
The machine is only created after we confirm
After a few moments, the machine is now ready to use
Information needed to connect, and stop/delete the machine
When you stop/delete machine, make sure all resources are deleted
However, use the right tool for the right job! Command lines are very useful, but they are no silver bullet.
Note: use the right mouse button to paste. You don't get feedback while typing the password.
Under Secure Shell (ssh) use the server's IP or hostname. Fill in your username.
Type the word yes
and press enter
Note: use the right mouse button to paste. You don't get feedback while typing the password.
The $
indicates you can start typing commands.
You will have to type in a lot of commands. Be clever!
$
indicates the shell is waiting for a command. Type a command and press ↵ to execute it.
Command | Action |
---|---|
whoami |
Print your username |
pwd |
Print current working directory |
cd name |
Move to directory called name |
cd .. |
Move up one directory |
mkdir name |
Creates a directory called name |
ls |
List files in current working directory |
ls -l |
List files in current working directory (long format) |
ls --help |
Help for the ls command |
man ls |
Read the manual of the ls command. Quit by pressing Q |
tree -L 2 |
Shows a file and directory tree of depth 2. |
Command | Action |
---|---|
nano file |
Opens a file called file in the nano editor. Save your edits with Ctrl+O and quit nano with Ctrl+X |
cat file |
Print the contents of the file called file to the terminal |
mv from to |
Move or rename a file called from to new location or name to |
rm file |
Delete a file called file |
rm -rf dir |
Delete director called dir and all files and subdirectories it contains. Be very careful with this! |
wget url |
Download the file specified by URL url and save it as a file |
head -n 5 file |
Shows the first 5 lines of file |
tail -n 5 file |
Shows the first 5 lines of file |
less file |
Read file interactively. Exit by pressing Q |
print()
(Python/R), cat()
(R) or System.out.println()
(Java)
will make it appear on terminal.prompt()
(Python), scan(file=stdin,...)
(R) or reading from System.in
(Java)
will make the program read in what the user is typing into the terminal while the program is running.sys.argv
(Python), commandArgs(trailingOnly=TRUE)
(R) or the String [] args
argument of a Java main-method.Command | Action |
---|---|
python3 file |
Run the python code in file with the Python interpreter |
Rscript file |
Run the R code in file with the R interpreter |
javac files |
Compile one or multiple .java source code files to .class bytecode files. |
java ClassName |
Run the program starting from the main method in class ClassName |
command < file |
Runs command and sends the contents of file to the standard in of that process as if someone was typing it into the terminal while that process is running. |
nano file |
Opens a file called file in the nano editor. Save your edits with Ctrl+O and quit nano with Ctrl+X |
less file |
Read file interactively. Exit by pressing Q |
cron
can be used to periodically execute commands, defined by lines in a
crontab
*/5 * * * * myCommand
runs myCommand
every five minutes0 12 1 * * myCommand
runs myCommand
on the first day of each monthtmux
utility.htop
program.Command / Keys | Action |
---|---|
crontab -e |
Edit your user's cron table that specifies scheduled tasks |
date |
Prints the current date and time |
tmux new -s name |
Create a new virtual terminal session with name name |
tmux |
Create a new virtual terminal session |
tmux ls |
List existing tmux virtual terminal sessions |
tmux detach or press Ctrl + B, then D |
Detach from the current virtual terminal |
tmux attach -t name |
Enter the virtual terminal sessions called name |
tmux kill-session -t name |
Ends the virtual terminal session called name . This ends all programs running in it. |
exit |
Leaves the virtual terminal (if inside one). Closes the connection if you perform it in the shell directly. |
htop |
Check resource consumption. Press F10 or click F10Quit to exit.
|
sudo command
to perform a command with administrative rights. (Not possible during the workshop)apt
from Debian/Ubuntu based system and yum
for Redhat
based systems can be used to install software, similar to app stores for your phone.apt search
to search for packages that you could install if you had super-user rights