forked from EmanMac/Week8
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMidterm.sh
More file actions
executable file
·136 lines (106 loc) · 1.95 KB
/
Midterm.sh
File metadata and controls
executable file
·136 lines (106 loc) · 1.95 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
echo "This is a placeholder for the start of the script. The idea is to
create a learning experience for newer linux users in a fairly interactive manner with the menu
and will eventually have fairly indepth echo commands with explainations of what the commands do"
press_enter()
{
echo -en "\nPress Enter to continue"
read
clear
}
selection=
until [ "$selection" = "0" ]; do
echo "
PROGRAM MENU
1 - Basic commands and Directory Hierarchy
2 - Devices
3 - Disks and Filesystems
4 - User Spaces
0 - Exit the program
"
echo -n "Enter selection: "
read selection
echo ""
case $selection in
1 )
#Rough draft, will be fleshing this out more
ls -l
pwd
cd /tmp
ls
sudo mkdir Derp
ls
touch derp1
ls
echo "derpderp" > derp1
cat derp*
cp derp1 derp2
echo "blerpblerpblerp" > derp2
echo "perfunctory text goes here" >> derp2
cat derp2 | grep 'blerp'
gzip derp1
cat derp1.gz
gunzip derp1.gz
sudo rm derp1
sudo rm derp2
sudo rmdir Derp
press_enter
;;
2 )
#Rough draft, will be fleshing this out more
echo "derp" > /dev/null
cd /dev
ls -l
sudo blkid
lsblk
find /sys | grep sd | less
ls -l /dev /dev/mapper | grep '^b'
ls /proc/partitions
free
#cd ~; pwd
cd /tmp
dd if=/dev/zero of= ./empty.file bs=1M count=1
hexdump empty.file
ls -l
rm empty.file
ls -l
sudo dmesg | grep sd
sudo dmesg | grep -i CPU
press_enter
;;
3 )ls
#Rough draft, will be fleshing this out more
cd /tmp
dd if=/dev/zero of=./32MB.img bs=1M count=32
hexdump ./32MB.img
sudo mkfs -t ext4 ./32MB.img
ls -l /sbin/mkfs.*
sudo mkdir /mnt/tmp
sudo mount ./32.MB.img /mnt/tmp
mount
df -h
lsblk
cd /mnt/tmp
ls
echo "Derp" > ./derp.txt
sudo umount /mnt/tmp
rm derp.txt
free
press_enter
;;
4 )ls
#Rough draft, will be fleshing this out more
who -r
ls /usr.lib/systemd
sudo systemctl list-units
sudo systemctl -p UnitPath show
sudo systemctl list-dependencies
sudo system-analyze critical-chain
cd /usr/lib/systemd/
ls
press_enter
;;
0 ) exit;;
* ) "Please enter 1-4, or 0"
esac
done