-
Notifications
You must be signed in to change notification settings - Fork 5
/
Challenge_04
38 lines (26 loc) · 1.09 KB
/
Challenge_04
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
1. If you create a file while using the linux terminal will the locate command be able to find it, right after it was created ? If not then what should
one do?
Sol.
No.
touch pwd.txt
sudo updatedb
locate pwd.txt
2. Find all regular files in /var that have a size bigger than 2 MB and apply cat command on each of them.
Sol.
sudo find /var/* -size +2M -exec cat{} \;
3. Create a backup of all the above files in a new directory.
Sol.
mkdir Backup
sudo find /var/* -size +2M -exec cp {} Backup \;
4. From the files backed up above, delete the files which are not owned by the root user.
Sol.
sudo find /var -type f -not -user root -exec shred -vu -n 100 {} \;
5. List out the last 5 authentications which failed, in your system.
Sol.
cat /var/log/auth.log | tail -n 5 | grep "authentication failure"
6. Print the total number of failed authentications that ever occured in your system.
Sol.
cat /var/log//auth.log | grep "authentication failure" | wc -l
7. Give an example of redirection of stdout and stderr both to a single text file.
Sol.
tail -n 3 /etc/passwd /etc/shadow > output.txt 2>&1