In this exercise, you will find specific files on mounted file systems by using the find and locate commands.
Outcomes
You should be able search files using the find and locate commands.
Log in as the student user on workstation using student as the password.
From workstation, run the lab fs-locate start command.
The command runs a start script that determines whether the host, servera, is reachable on the network.
[student@workstation ~]$lab fs-locate start
Use the ssh command to log in to servera as the student user.
[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$
Use the locate command to search files on servera.
Even though the locate database is updated automatically every day, make sure that the database is up-to-date by manually starting an update on servera.
Use the sudo updatedb command to update the database used by the locate command.
[student@servera ~]$sudo updatedb[sudo] password for student:student[student@servera ~]$
Locate the logrotate.conf configuration file.
[student@servera ~]$locate logrotate.conf/etc/logrotate.conf /usr/share/man/man5/logrotate.conf.5.gz
Locate the networkmanager.conf configuration file, ignoring case.
[student@servera ~]$locate -i networkmanager.conf/etc/NetworkManager/NetworkManager.conf /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf /usr/share/man/man5/NetworkManager.conf.5.gz
Use the find command to perform real-time searches on servera according to the following requirements:
Search all files in the /var/lib directory that are owned by the chrony user.
List all files in the /var directory that are owned by root and the group owner is mail.
List all files in the /usr/bin directory that has a file size greater than 50 KB.
Search all files in the /home/student directory that have not been changed in the last 120 minutes.
List all the block device files in the /dev directory.
Use the find command to search all files in the /var/lib directory those are owned by the chrony user.
Use the sudo command as the files inside the /var/lib directory are owned by root.
[student@servera ~]$sudo find /var/lib -user chrony[sudo] password for student:student/var/lib/chrony /var/lib/chrony/drift
List all files in the /var directory that are owned by root and are affiliated with the mail group.
[student@servera ~]$sudo find /var -user root -group mail/var/spool/mail
List all files in the /usr/bin directory with a file size greater than 50 KB.
[student@servera ~]$find /usr/bin -size +50k/usr/bin/iconv /usr/bin/locale /usr/bin/localedef /usr/bin/cmp ...output omitted...
Find all files in the /home/student directory that have not been changed in the last 120 minutes.
[student@servera ~]$find /home/student -mmin +120/home/student/.bash_logout /home/student/.bash_profile /home/student/.bashrc ...output omitted...
List all block device files in the /dev directory.
[student@servera ~]$find /dev -type b/dev/vdd /dev/vdc /dev/vdb /dev/vda3 /dev/vda2 /dev/vda1 /dev/vda
Exit from servera.
[student@servera ~]$exitlogout Connection to servera closed.[student@workstation]$
This concludes the guided exercise.