We will establishing a backup directory for authentication logs, generating manual symbolic links, and subsequently, making an endeavor to eliminate a specific link. Creating a backup directory for log establishes a designated folder to store copies of logs that track information, generating symbolic links specifies connections to improve organization, and we must also learn how to remove something as well as create it.
First things first we will create our directory in our home file. We will create a "backup" directory and a "log" directory inside of the backup directory. Your path should look like this once you're inside the directory.
/backup/log
After you move into your newly made "log" directory we will create a link. We will link /var/log/dnf.log with installation.log. This will create a hard link to the auth directory.
Run:
ln /var/log/dnf.log /backup/log/installation/log
Now we will check the contents of both files installation.log and dnf.log. We are checking to make sure the files have the same content. Run: tail /backup/log/installation.log tail /var/log/dnf.log
We will create some log entries.
Run: dnf install -y vim
This should fail and generate a log entry. Search for the failed attempt in the logs by running
tail /var/log/dnf.log | grep -i failed tail /backup/log/installation.log
save the failed results into a file named "install-fail"
Run:
tail installation.log | grep -i failed >> install-fail
simply remove the installation.log file
Run:
rm /backup/log/installation.log
verify that it has been removed. Read the failed installation once again to verify the file has not been tampered with.
Run:
tail /var/log/dnf.log | grep -i failed
We will change our directory to the root users directory. Once in your root directory we will create a hard link from /proc/meminfo to memory_info.txt in your home directory.
Run: ln /proc/meminfo memory_info.txt
You will get an error because hard links accorss different file systems are not allowed. You must use a symbolic link.
Run:
ln -s /proc/meminfo memory_info.txt
Create a file with something inside in the root directory. I used "linktest"
Then Run: ls -l
Now removing the original file will break the link but keep the file in the /opt directory. In order to delete both files you must delete both. Hardlinks and symbolic links are like shortcuts. Hardlinks all point towards the data block on the file and a symbolic link points to a files path or location.