-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLinuxExercise11
89 lines (48 loc) · 3 KB
/
LinuxExercise11
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
Ensure the fixGenerator.sh script is installed in your home directory.
Set up the script to run Monday-Friday at 6am.
0 6 * * * ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run at 6pm every Friday.
0 6 * * 5 ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run every half hour from 9-4 on Monday, Wednesday and Friday.
30 9-16 * * 1,3,5 ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run every other hour every day.
0 * * * * ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run on May 4th at midday.
0 12 4 5 * ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run on the 1st of every month at 6:25am.
25 6 1 * * ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run every 20 minutes every Tuesday between 10am and 2pm.
0-59/20 10-14 * * 2 ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run the 1st of every other month on the hour.
0 * 1 * * ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
Set up the script to run at 6am and 8am on Saturday and Sunday.
* 6,8 * * 6,7 ./Users/jeff/Documents/Github/wiley-sre-training/fixGenerator.sh
##################### PART 2 #####################
Create a file named seq1.txt and write a sentence of your choice in it.
vim seq1.txt
Create a file named seq2.txt and write a sentence of your choice in it.
vim seq2.txt
Create a file named seq3.txt and write a sentence of your choice in it.
vim seq3.txt
Generate a list of these files and add the list to another file named list.txt.
ls -l > list.txt
Use a single command to copy the contents of all files with seq in the name into a file named total.txt.
cat seq*.txt > total.txt
Write a single command that shows how many files you have in your current directory.
ls | wc -l
Do a case-insensitive search of the file for hobbit and output the results to the screen.
grep -i hobbit LOTR.txt
Put the first eight lines and the last three lines into a new file named LOTRtxt.
cat head -8 LOTR.txt | tail -3 LOTR.txt | > LOTRtxt.txt
Run a command on the command line to replace all occurrences of Gollum with Thanos and output the results into a new file named LOTRMarvel.txt.
sed -i '' 's/Gollum/THanos/g' LOTRtxt.txt > LOTRMarvel.txt
On the command line, run a command to compare the LOTR.txt with LOTRMarvel.txt.
diff LOTR.txt LOTRMarvel.txt
Change the permission on LOTR.txt so that it is read and executable for others and group, and fully accessible for the current user.
chmod 755 LOTR.txt
Count the number of words in LOTR.txt.
wc -w LOTR.txt
Rename the LOTR.txt file to LordOfTheRings.txt.
touch LOTR.txt LordOfTheRings.txt
Create a compressed tarball named LOTR.tar.gz that includes all the files you have created in this set of exercises.
tar -cvf LOTR.tar.gz /Users/jeff/Documents/Github/wiley-sre-training/txt-files