Difference between revisions of "Introduction to Linux in HPC/Text display search"

From HPC Wiki
Introduction to Linux in HPC/Text display search
Jump to navigation Jump to search
Line 4: Line 4:
  
 
<youtube width="600" height="400" right>IfD9IPixgpo</youtube>
 
<youtube width="600" height="400" right>IfD9IPixgpo</youtube>
−
 
−
[https://git-ce.rwth-aachen.de/hpc.nrw/ap2/tutorials/linux/-/blob/master/Slides/Linux_Intro/Linux_Intro.pdf Linux Introduction]  Slides 58 - 64 (7 pages)
 
−
 
−
 
−
=== Slide Layout === <!--T:5-->
 
−
 
−
    page 1:
 
−
        grep command and syntax
 
−
        important options: -r, -i and -I
 
−
    page 2:
 
−
        many commands to display text
 
−
        cat
 
−
        less
 
−
        head and tail
 
−
    page 3: 40 sec
 
−
        console has three streams
 
−
            stdin
 
−
            stdout
 
−
            stderr
 
−
    page 4:
 
−
        stream in computing terms
 
−
        similar to streaming video
 
−
        input/output stream in console
 
−
    page 5:
 
−
        input/output streams can be redirected
 
−
            redirect stdout
 
−
            redirect stdin
 
−
            pipe
 
−
    page 6:
 
−
        stream append redirection
 
−
        numbered streams: 0 for stdin, 1 for stdout, 2 for stderr
 
−
    page 7:
 
−
        use grep to search piped output text
 
  
  
Line 72: Line 39:
  
 
    
 
    
−
{{Warning|mode=info|text= '''no tips in this section'''}}
 
−
 
−
{{Warning|mode=warn|text= '''no warnings in this section'''}}
 
−
 
 
=== Exercises in Terminal (slide 65) === <!--T:5-->   
 
=== Exercises in Terminal (slide 65) === <!--T:5-->   
  

Revision as of 09:18, 5 October 2020

Video


Quiz

1. Which command can be used to append text to filename?

command > filename
command >> filename

2. How do I find all files containing specific text on Linux?
HINT: use grep command

Click and submit to see the answer


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