Red Hat System Administration I
Search for specific files on mounted file systems by using the find and locate commands.
Outcomes
Search for files with the
findandlocatecommands.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start fs-locate
Instructions
On the
workstationmachine, use thesshcommand to log in to theserveramachine as thestudentuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$Use the
locatecommand to search for files on theserveramachine.Update the
locatedbdatabase manually on theservermachine. Use thesudo updatedbcommand to update the database.[student@servera ~]$
sudo updatedb[sudo] password for student:student[student@servera ~]$Locate the
logrotate.confconfiguration file.[student@servera ~]$
locate logrotate.conf/etc/logrotate.conf /usr/share/man/man5/logrotate.conf.5.gzLocate the
networkmanager.confconfiguration file, ignoring case sensitivity.[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
findcommand to search in real time on theserveramachine according to the following requirements:List all files in the
/var/libdirectory that thechronyuser owns.List all files in the
/vardirectory that therootuser and themailgroup own.List all files in the
/usr/bindirectory with a file size that is greater than 50 KB.List all files in the
/home/studentdirectory that changed in the last 120 minutes.List all the block device files in the
/devdirectory.
Search for all files in the
/var/libdirectory that thechronyuser owns, with root privilege.[student@servera ~]$
sudo find /var/lib -user chrony[sudo] password for student:student/var/lib/chrony /var/lib/chrony/driftList all files in the
/vardirectory that therootuser owns and that belong to themailgroup.[student@servera ~]$
sudo find /var -user root -group mail/var/spool/mailList all files in the
/usr/bindirectory with a greater file size than 50 KB.[student@servera ~]$
find /usr/bin -size +50k/usr/bin/iconv /usr/bin/locale /usr/bin/localedef /usr/bin/cmp ...output omitted...List all files in the
/home/studentdirectory that 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
/devdirectory.[student@servera ~]$
find /dev -type b/dev/vdd /dev/vdc /dev/vdb /dev/vda3 /dev/vda2 /dev/vda1 /dev/vda
Return to the
workstationmachine as thestudentuser.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation]$