Class PPT

Shell Script

Demos


KDAC_OSC-Day04_page-0001.jpg

KDAC_OSC-Day04_page-0002.jpg

KDAC_OSC-Day04_page-0003.jpg

KDAC_OSC-Day04_page-0004.jpg

Initial Setup

Assume the directory contains three text files: file1.txt, file2.txt, file3.txt.

  1. Command: ls

    file1.txt  file2.txt  file3.txt
    
  2. Command: rename "s/.txt/.cpp/" *.txt

    file1.cpp  file2.cpp  file3.cpp
    
  3. Command: ls

    file1.cpp  file2.cpp  file3.cpp
    
  4. Command: mkdir demo

  5. Command: cd demo/

  6. Command: ls

    (empty)
    
  7. Command: cat > target.txt

  8. Command: cat target.txt

    Hello, this is target.txt
    
  9. Command: ls -l -i

    1001 -rw-r--r-- 1 user user 24 Apr 14 14:00 target.txt
    
  10. Command: ln target.txt link.txt