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
Use ssh (secure shell) to login to a remote computers.
Code Block |
---|
language | bash |
---|
title | SSH to a remote computer |
---|
|
# General form:
ssh <user_name>@<full_host_name>
# For example
ssh abattenh@ls6.tacc.utexas.edu |
...
Code Block |
---|
|
tail /etc/passwd | while IFS=':' read account x uid gid name shell
do
echo $account $name
done | more
|
Writing multiple text lines
There are several ways to output multi-line text. You can:
- Start the text with a single quote or a double quote
- press Enter when you want to start a new line
- keep entering text and Enter until you're satisfied
- supply the matching single quote or a double quote then Enter
example:
Code Block |
---|
echo 'My
name is
Anna' |
- Use echo -e
- The -e option tells echo to replace some special backslash escapes characters that represent non-printable characters with their associated ASCII codes
- So \n will be replaced by a newline (linefeed) character and \t will be replaced by a Tab.
example:
Code Block |
---|
echo -e "My\nname is\nAnna" |
heredoc
Another method for writing multi-line text that can be useful for composing a large block of text in a script, is the heredoc syntax, where a block of text is specified between two user-supplied block delimiters, and that text block is sent to a command. The general form of a heredoc is:
Code Block |
---|
|
COMMAND << DELIMITER
..text...
..text...
DELIMITER |
Tip |
---|
The 2nd (ending) block delimiter you specify for a heredoc must appear at the start of a new line. |
For example, using the (arbitrary) delimiter EOF and the cat command:
Code Block |
---|
|
cat << EOF
This text will be output
And this USER environment variable will be evaluated: $USER
EOF |
Here the block of text provided to cat is just displayed on the Terminal. To write it to a file just use the 1> or > redirection syntax after the block delimiter you name:
Code Block |
---|
|
cat << EOF 1> out.txt
This text will be output
And this USER environment variable will be evaluated: $USER
EOF |
The out.txt file will then contain this text:
Code Block |
---|
|
This text will be output
And this USER environment variable will be evaluated: student01
|
Copying files between TACC and your laptop
Anchor |
---|
| Copying_files_to_from_TACC |
---|
| Copying_files_to_from_TACC |
---|
|
...