Você está na página 1de 22

HPC 0: Introduction to the

Unix/ Linux command line


Martin Callaghan

https://goo.gl/BXvXK9
HPC support team
4 staff

General guidance and advice

Access to specialist support and consultancy

User group meetings

Discussion list

Contact: arc-help@lists.leeds.ac.uk
ARC/HPC Training Portfolio
HPC 4:Introduction
ARC training to MPI and MPI/IO

http://arc.leeds.ac.uk/training HPC3: HPC


Architectures and
Parallel Programming
Software
HPC 2: Introduction
Development
to Application practices for research
Development

SWD 5: Scientific SWD 4:Cloud for


HPC1: Introduction Python Research
to HPC

HPC 0: Introduction HPC 5: GPU SWD 6: High HPC 7: HPC for


to Linux Programming Performance Python Data Analytics

Software Carpentry VIS 1: Visualisation SWD 2: Version


with Paraview control with Git and
Github
Data Carpentry * in development
Contact details
ARC Website:

www.arc.leeds.ac.uk

General HPC queries:

arc-help@lists.leeds.ac.uk

Me:

m.callaghan@leeds.ac.uk
Introductions and
Motivations

Who are you and why are you here?


Asking for help
During the exercises, use the coloured stickies:

I need some help I’m OK/ I’ve finished


Purpose of today
● Introduce the command line for new HPC users
● Hands on experience and confidence building
● Basic interactions with files and directories: command line execution, directory
and file basics, files properties.
● File manipulation: inspecting and editing files, searching and filtering,
● Scripting and workflows: scripting techniques for building workflows.
Password
osboxes.org

To make full screen:

[RIGHT-CTRL] + F
What is BASH?
What is a shell?
MobaXTerm
Launch...
Filesystem basics
Forward slash / and backslash \
Filesystem basics: absolute path
Filesystem basics: relative path
Exercise 1
First, get hold of the sample data we will be using today. Type this in your
command shell:

First, run GIT BASH

wget --no-check-certificate
https://github.com/callaghanmt/shell-training/archive/master.zip
Exercise 2:
Two new commands:
• The sort command will sort lines alphabetically
• You can use the cut command to split lines of text based on a given character
e.g. cut -d ',' -f 2 will split lines around the comma and give you the second part

Combine cat, cut, and sort to print out the Latin names from birds.txt in
alphabetical order Save the output to a new file
Exercise 3
List all the animals on the Isle of Mann alphabetically and find the 50th item in that
list.

https://goo.gl/66zbCO
Exercise 4
shell-training/data/ contains 300 data files, each of which should contain 100
values. One of these files is missing some data though. . .

Use a series of commands connected by pipes to identify the file with missing data
hint wc -w will tell you the number of values in a file, sort -n will sort numerically
Exercise 5
• Use a for loop to create five directories called calculation_?, where ? is a
number.

• Use a loop to create five directories, each one the parent of the next.
Exercise 6
• In the wildcards directory, create a variable called files listing all of the text files.

• Loop through this list and print out the first line from each file.
Exercise 7
What will this command print to the screen?

[user@host wildcards]$ for filename in *.txt


> do
> echo $filename
> cat $filename > new-file.txt
> done
What will the contents of new-file.txt be and why?

Você também pode gostar