-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLinuxExercise2
104 lines (52 loc) · 1.92 KB
/
LinuxExercise2
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
###Change the directory to your home directory.
ls
###Print out your current directory.
pwd
###Create a folder named Algo1.
mkdir Algo1
###Within Algo1, create subfolders named config, bin, logs, and scripts.
mkdir config bin logs scripts
###Within config, create empty files named config.config and variables.
touch ./Algo1/config config.config
touch ./Algo1/config/variables
###Within scripts, create empty files named start.sh, stop.sh and admin.sh.
touch ,/Algo1/scripts/start.sh
touch ./Algo1/scripts/stop.sh
touch ./Algo1/scripts/admin.sh
###Within logs, create an empty file named today.log.
touch ./Algo1/logs/today.log
###Go back to your home directory.
cd
###Long list everything recursively.
ls -r
###Remove the file named variables in the config directory.
rm ./Algo1/config/variables
###Remove the bin directory that you previously created.
rmdir -a ./Algo1/scripts
###Change back to your home directory.
cd
###Create the bin directory again within Algo1.
mkdir ./Algo1/bin
###Create a directory in the logs folder named oldlogs.
mkdir ./Algo1/logs/oldlogs
###Within oldlogs, create folders named 2019, 2018, and 2017.
mkdir ./Algo1/logs/oldlogs/2019
mkdir ./Algo1/logs/oldlogs/2018
mkdir ./Algo1/logs/oldlogs/2017
###Within 2017, create an empty file named 2017.log.
touch ./Algo1/logs/oldlogs/2017/2017.log
###Within 2018, create an empty file named 2018.log.
touch ./Algo1/logs/oldlogs/2018/2018.log
##Within 2019, create an empty file named 2019.log.
touch ./Algo1/logs/oldlogs/2019/2019.log
###Change back to your home directory.
cd
###Remove oldlogs using one command.
rm -r Algo1/logs/oldlogs
###Ensure you are in your home directory.
cd
###Search for all files from your home directory that end in .sh.
find ~ -name *.sh
###Go into the scripts directory and use a command to remove both the start and stop script without specifying each file separately: rm s*.sh
cd ~/Algo1/scripts
rm s*.sh