User:Mukund-pondkule-6a11@uni-paderborn.de

From HPC Wiki
Jump to navigation Jump to search

An Introduction to the Linux Operating System and Command Line. The course provides students with a hands-on approach for learning Linux through assignments and projects.


Test

1 Type text here or a no-break space code

Where was Aristotle born?

2 Type text here or a no-break space code

Name Aristotle's famous mentor.

3 Type text here or a no-break space code

was Aristotle's most famous pupil.

4 Type text here or a no-break space code

Name Aristotle's famous mentor.

5 Type text here or a no-break space code

Name a famous Greek philospher.


{{#evt: service=youtube |id=https://www.youtube.com/watch?v=StPSujfX0YI |alignment=right }}

{{#ev:youtube|https://www.youtube.com/watch?v=StPSujfX0YI%7C1000%7Cright%7CLet eet GO|frame}}

{{#evl:21X5lGlDOfg|NASA Live|1|player=example-player}}


[[File:|start=2|end=6]]

Historical Background

Video: Slide 17 - 23 (7 pages), 5 min 45 sec (Text) + 15 sec (Quiz)

Linux Introduction

Text


Quiz:

1. Are all Top 500 supercomputers using Linux in HPC?
  A: Yes
  B: No
2. What does GNU stands for?
  A. GNU's Not Unix
  B. Geek Needed Unix
  C. General Unix
  D. General Unix
  E. None of the Above

Tip.png Tips: no tips in this section

Important.png Warning: no warning in this section

Info.png Exercises in Terminal: no exercises in this section

The Command Line

Video: Slide 17 - 23 (7 pages), 5 min 45 sec (Text) + 15 sec (Quiz)

Linux Introduction

Text


Quiz:

1. Which keys can be used for command history?
  A: up- and down-arrow keys
  B: Page-up and Page-down keys

Tip.png Tips: Working directory in console reminds user, where they are. (page 3)

Important.png Warning: 1) In command line user may forget where they are (page 2). 2) Child processes may stop, if parent shell exits (page 2).


Exercises in Terminal:

1. What's your username on a Linux computer?
  There are two ways to find your username on a Linux computer 
2. What's the hostname of a Linux computer?
  There are two ways to find the hostname on a Linux computer.
3. What's your current working directory on a Linux computer?
   There are two ways to find your current working directory on a Linux computer.
4.  Use up- and down-arrow keys to see the command history.
5.  Run sleep 1h command and wait, then use Ctrl-C to kill it.

Directory structure

Video: Slide 33 - 48 (16 pages), 5 min 45 sec (Text + Demo + Quiz) + 15 sec (Tips and Warning)


Linux Introduction

Text

Quiz:

1. Which one is the top directory in Linux?
  A: /
  B: /home
  C: C:\
2. The command 'cd ' without arguments : if you start in var/log/ and run cd with no arguments, what do you expect will happen?
  A: Nothing it stays in /var/log/.
  B: It goes to your home directory.
  C: It goes to the filesystem root
  D: The shell prompt turns into a shark and eats you.
  E: It’s an error.
  F: The shell stops having a working directory.

Tip.png Tips: no tips in this section

Important.png Warning: no undo and make sure what you want to do (page 16)


Exercises in Terminal (slide 49):

1. Go to a specific subfolder of a folder (example: cd Documents/courses/ ) and get back to the home directory using cd command. List 3 different ways to do it using one command. check after every action your path with pwd command.
2. Go to the directory /tmp and jump between /tmp and your home directory back and forth. check after every action your path with pwd command.

Files

Video: Slide 51 - 56 (6 pages), 5 min 30 sec (Text + Demo + Quiz) + 15 sec (Tips and Warning)

Linux Introduction

Text

Quiz:

1. Can you copy directory with cp <old_dir> <new_dir> ? 
  A: Yes
  B: No, -r option is needed for copying directory


Tip.png Tips: no tips in this section

Important.png Warning: 1. rm -f: no confirmation! Use with care (page 3). 2. Wildcards expand before given to program (page 6).


Exercises in Terminal:

1. Use the find command to search for files, whose name ends with dat, in your home directory.
2. Use the find command to search for directories, whose name begins with test and ends with _dir, in your home directory.

Text display, search

Video: Slide 58 - 64 (7 pages), 5 min 40 sec (Text + Demo) + 15 sec (Quiz)

Linux Introduction

Text

Quiz:

1. Which command can be used to append text to filename?
  A: command > filename
  B: command >> filename
2. How do I find all files containing specific text on Linux?
   HINT: use grep command

Tip.png Tips: no tips in this section

Important.png Warning: no warning in this section


Exercises in Terminal (slide 65):

1. Create a file using cat (some filename) and write some text in it as below. than use grep to find and display the line number and the line with the word Alan in the file.
        the best way to predict
        the future is to invent it
        –  Alan Kay

Processes and permissions

Video: Slide 67 - 88 (22 pages), 7 min 40 sec (Text + Demo)

Linux Introduction

Text

Quiz:

1. Which command can prevent other users not in your group from writing to input.dat? 
  A: chmod u-w input.dat
  B: chmod o-w input.dat
  C: chmod g-w input.dat

Tip.png Tips: no tips in this section

Important.png Warning: no warning in this section


Exercises in Terminal (slide 89):

1. Create an empty file, make it read-only, make it executable.
2. Start a process (e.g. sleep 10m)
3. Start a process, bring it into background/foreground.

The vim text editor

Video: Slide 91 - 99 (9 pages), 5 min 0 sec (Text + Demo) + 15 sec (Quiz)

Linux Introduction

Text

Quiz:

1. How to enter the insert mode of vim ? 
  A: press enter key
  B: press i key
  C: press Esc key
2. How would you open a file in read-only mode using the vim editor ? 
  Hint: In terminal man vim

Tip.png Tips: If you forget which mode you are in while using vim, just keep pressing Esc.

Important.png Warning: no warning in this section


Exercises in Terminal (slide 100):

1.  Create a vim file and write some text in it with insert (pressing i) and than undo and redo the changes. 

Shell scripting, environment variables

Video: Slide 102 - 114 (13 pages), 7 min 0 sec (Text + Demo)

Linux Introduction

Text

Quiz:

1. Which bash command below assigns "value" to variable var? 
  A: var="value"
  B: var = "value"
  C: var=="value"


Tip.png Tips: no tips in this section

Important.png Warning: no warning in this section


Exercises in Terminal (slides 115 - 116) and solution (slide 117):

1. a. Write a script that
   b. Prints an environment variable
   c. Saves the output of the date command to a variable
   d. Sleeps briefly
   e. Prints the new and old date and time
2. Find a way to execute a script without setting execute permissions.
3. Find out how to do other programming things in bash (e.g. functions, classes). How convenient do they look?
4. Look at different ways you can define if conditions.
5. Find out what different types of quotes (single ' vs. double ") do?
6. create an shell variable MYIDENTITY and export it as below: 
   $ export MYIDENTITY=whoami
   How will you list the shell variable MYIDENTITY?
   Execute the shell variable MYIDENTITY, what is the output? 

System configuration files

Video: Slide 119 - 128 (10 pages), 6 min 50 sec (Text + Demo)

Linux Introduction

Text

Quiz:

1. In which system file could you find the CPU information of a Linux computer?  
  A: /dev/cpuinfo
  B: /sys/cpuinfo
  C: /proc/cpuinfo

Tip.png Tips: no tips in this section

Important.png Warning: Be very careful, when editing configuration files. A faulty configuration file may prevent a user from login to computer.

Info.png Exercises in Terminal: no exercises in this section

Various tips

Video: Slide 130 - 136 (7 pages), 5 min 10 sec (Text + Demo)


Linux Introduction

Text


Quiz:

1. How will you find a specific command in history ? HINT: use grep with history, how to use it?  
2. How can you compare two files and display a list of the difference? HINT: man diff  

Tip.png Tips: Please make backups regularly!

Important.png Warning: Please make backups regularly!


Exercises in Terminal (slides 137):

1. Find out the number of CPUs and amount of memory you have.
2. Permanently change your vim color scheme. 

Beyond the cluster

Video: Slide 139 - 141 (3 pages), 2 min 30 sec (Text)

Linux Introduction

Text

Tip.png Tips: no tips in this section

Important.png Warning: no warning in this section

Info.png Exercises in Terminal: no exercises in this section

Linux in HPC

Video: Slide 3 - 40 (38 pages), 14 min 35 sec (Text)

Linux intro.png


Linux in HPC

Text

Quiz:

1. Which command you can use to do a secure copy from the Cluster to you local Linux machine?
   Hint:man scp 
2. Label the interface elements in the terminal:
   1. shell command
   2. current prompt
   3. previous prompt
   4. cursor
   5. login message
   6. command output


Linux hpc quiz.png

Tip.png Tip: Integrated in slides.

Important.png Warning: Integrated in slides.


Exercises for Linux in HPC: GO CP2K GO!

CP2K is a quantum chemistry and solid state physics software package that can perform atomistic simulations of solid state, liquid, molecular, periodic, material, crystal, and biological systems. In this exercise we are going to
   1. create CP2K input files with different cutoff values from a template input for simulation of 32 water molecules in a box using density functional theory (DFT) calculation.
   2 .analyse the simulation output files and summarize some important results.

Create CP2K input files
The CP2K template input file for simulation of 32 water molecules in a box using DFT calculation can be found in the Ex_LinuxHPC/01_CreateInput directory and the file name is template.inp.
A placeholder __CUTOFF__ is set on line 7 of this file.
     CUTOFF __CUTOFF__
With smaller cutoff value the DFT calculation runs faster, but the results may be less accurate. With larger cutoff value, on the other hand, the results become more accurate, but the DFT calculation can be slower.
In this exercise we create the CP2K input files based on the template (template.inp) for a range of different cutoff values, e.g. from 250 to 350 with a step size of 10. Please write a bash script that:
   1. creates individual subdirectories for the simulations with different cutoff values
   2. in each subdirectory creates the CP2K input file from the template file with the placeholder __CUTOFF__ being replaced by an appropriate cutoff value. The cutoff values are from 250 to 350 and the increment 
      is 10. e.g. the cutoff in the first input file may have
         CUTOFF 250
   and the cutoff in the second input file may look like
         CUTOFF 260
   and so on until CUTOFF 350 in the last CP2K input file.
Note: Due to the time limitation we cannot perform all these CP2K simulations during this exercise. However, the example CP2K input (run.inp) and output (run.out) files with different cutoff values can be 
found in Ex_LinuxHPC/02_AnalyseOutput. 
Analyse CP2K output files

In the CP2K output file, e.g.run.out, the most important information is printed after every simulation step. For example:
 *******************************************************************************
 ENSEMBLE TYPE                =                                              NVE
 STEP NUMBER                  =                                                1
 TIME [fs]                    =                                         0.500000
 CONSERVED QUANTITY [hartree] =                              -0.545718508103E+03

                                              INSTANTANEOUS             AVERAGES
 CPU TIME [s]                 =                        8.34                 8.34
 ENERGY DRIFT PER ATOM [K]    =         -0.172713513639E+02   0.000000000000E+00
 POTENTIAL ENERGY[hartree]    =         -0.545966997800E+03  -0.545966997800E+03
 KINETIC ENERGY [hartree]     =          0.248489696633E+00   0.248489696633E+00
 TEMPERATURE [K]              =                     550.644              550.644
 *******************************************************************************
for step number 1 (see the line of STEP NUMBER above). Among these data the most useful results are:
   1. the time step for the simulation on the line beginning with TIME [fs].
   2. the potential energy for the step on the line beginning with POTENTIAL ENERGY[hartree]. Please note the energy value given in the column of INSTANTANEOUS is relevant.
In this exercise please:
   1. write a script that summarizes and prints the time step and potential energy for the CP2K output file.
   2. create a bash script to loop through all CP2K output files and print the time step and potential energy for each one automatically.