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 |
...
- here are some good ones:
- a good general one: https://www.regular-expressions.info/
- Ryan's tutorials on Regular Expressions: http://ryanstutorials.net/regular-expressions-tutorial/
- RegexOne: http://regexone.com
- perl regular expressions are the "gold standard" used in most other languagesExpressions: http://ryanstutorials.net/regular-expressions-tutorial/
- RegexOne: http://regexone.com
- and a perl regex tutorial: http://perldoc.perl.org/perlretut.html
- perl regular expressions are the "gold standard" used in most other languages
perl pattern matching
If grep pattern matching isn't behaving the way I expect, I turn to perl. While Perl, like awk, is a fully functional programming language, Here's how to invoke regex pattern matching from a command line using perl:
perl -n -e 'print $_ if $_=~/<pattern>/'
sed pattern substitution
The sed (string editor) command can be used to edit text using pattern substitution.
sed 's/<search pattern>/<replacement>/'
While sed is very powerful, the regex syntax for its more advanced features is quite different from "standard" grep or perl regular expressions. As a result, I tend to use it only for very simple substitutions, usually as a component of a multi-pipe expression.
perl pattern substitution
If I have a more complicated pattern, or if sed pattern substitution is not working as I expect (which happens frequently!), I again turn to perl. Here's how to invoke perl pattern substitution from a command line:
perl -p -e '~s/<search pattern>/<replacement>/'
Parentheses ( ) around one or more text sections in the <search pattern> will cause matching text to be captured in built-in perl variables $1, $2, etc., following the order of the parenthesized text. The capture variables can then be used in the <replacement>.
Field delimiter summary
Be aware of the default field delimiter for the various bash utilities, and how to change them:
...
Examples:
ls -l ~/.bash_history
haiku.txt | description |
---|---|
|
ls -l /usr/bin/ls
/usr/bin/ls | description |
---|---|
|
ls -l -d ~/local (-d says to list directory information, not directory contents)
docs | description |
---|---|
|
Copying files between TACC and your laptop
Anchor | ||||
---|---|---|---|---|
|
...
- Greg's Bash Guide
- Ryan's Tutorials on Bash Scripting: http://ryanstutorials.net/bash-scripting-tutorial/
- CBRS short course workshop wikis (developed by Anna)
- Introduction to Unix: https://wikisutexas.utexasatlassian.edunet/wiki/display/CbrsIntroUnix/
- Intermediate Unix: https://wikisutexas.utexasatlassian.edunet/wiki/display/CbrsIntermUnix/
- You won't have access to the small compute cluster they use, but you can download the example files and manipulate them in your own Linux or Unix environment.
...