This page should serve as a reference for the many "things Linux" we use in this course. It is by no means complete – Linux is **huge** – but offers introductions to many important topics.
...
- Macs and Linux have a Terminal program built-in
- Windows options:
- Windows 10+
- Command Prompt and PowerShell programs have ssh and scp (may require latest Windows updates)
- Start menu → Search for Command
- Putty – http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- simple Terminal and file copy programs
- download either the Putty installer or just putty.exe (Terminal) and pscp.exe (secure copy client)
- Windows Subsystem for Linux – Windows 10 Professional includes a Ubuntu-like bash shells
- See https://docs.microsoft.com/en-us/windows/wsl/install-win10
- We recommend the Ubuntu Linux distribution, but any Linux distribution will have an SSH client
- Command Prompt and PowerShell programs have ssh and scp (may require latest Windows updates)
- Windows 10+
Use ssh (secure shell) to login to a remote computers.
Code Block | ||||
---|---|---|---|---|
| ||||
# General form: ssh <user_name>@<full_host_name> # For example ssh abattenh@ls6.tacc.utexas.edu |
...
Code Block | ||
---|---|---|
| ||
nums=$( seq 5 ) echo $nums echo "$nums" echo $nums| wc -l # newlines converted to spaces, so only one line echo "$nums" | wc -l # newlines preserved, so reports 5 # This loop prints a line for each of the files for n in $nums; do echo "the number is: '$n'" done # But this loop prints only one line for n in "$nums"; do echo "the number is: '$n'" done |
...
the if statement
The general form of an if/then/else statement in bash is:
...
A good reference on the many built-in bash conditionals: https://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html
...
reading file lines with while
The read function can be used to read input one line at a time, in a bash while loop.
...