-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab_script.sh
46 lines (31 loc) · 840 Bytes
/
lab_script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# navigate to the home directory
cd ~
# create a new directory called lab
mkdir lab
# navigate to the lab directory
cd lab
# create a new file called textfile.txt
touch textfile.txt
# add some text to the file
echo "Hello, world!" >> textfile.txt
# display the contents of the file
cat textfile.txt
# create a new directory called newdir
mkdir newdir
# navigate to the newdir directory
cd newdir
# create a new file called newfile.txt
touch newfile.txt
# add some text to the file
echo "This is a new file." >> newfile.txt
# display the contents of the file
cat newfile.txt
# navigate back to the lab directory
cd ..
# create a compressed archive of the lab directory
tar -cvzf lab.tar.gz lab
# display the contents of the current directory
ls -l
# display the contents of the lab.tar.gz file
tar -tvf lab.tar.gz