Lab 3-4 Linux Assignment and Solution

Lab 3-4 Linux Assignment Requirement

This lab covers basic file utilities, filename expansion, and vi

lab3-4

Lab 3-4 Linux Assignment Solution

Module 3
(1) script lab3-4
(2) touch test3.2 slide12 cis2
(3) ls *s*
(4) ls ??s*
(5) ls *[13]*
(6) ls *[0-9]*[0-9]*
(7)
cp -i lab1-2 test3.2
y
(8) ls -l test3.2
(9) mv test3.2 temp2
(10) ls test3.2
(11)

ls *2 -> probably incorrect

ls *[1ps]2
(12)

rm *2 -> probably incorrect

rm *[1ps]2
(13) exit
Module 4
(1)
vi lab4-1
 - type text
 - save
(2)
:w lab4-2
:wq
(3)
vi lab4-2
D - delete line after cursor
A - to add at the end of line
(4)
/4

O -> Add a new line of text above current line

type text
(5)

1G -> Go to first line

/app -> search for word "app"

n -> second instance of word

A -> Add text at the end of the line

(6)
go to first word of file "these"

rT -> replace "t" to "T"

:wq -> save and quit

(7)
vi lab4-2
(8)

/s/os/OS/g -> replace all "os" to "OS"

(9)
reverse order of line no from 1,2,3,4,5 to 5,4,3,2,1
2dd, P
3dd, P
2dd, P
2dd, P
(10)

o -> Add a new line below cursor

yy -> Copy line

P -> Paste and repeat for rest of the line

(11)
/2

J -> Append the line below the current line to the current line

(12)
:wq
(13)
vi lab3-4

G -> Go to end of the file

:r lab4-1 -> at the end of file

G

:r lab4-2 -> at the end of file

G
:w
(14)