A solid understanding of the Linux directory hierarchy and log files is crucial for system administration and cybersecurity. Linux organizes all files in a tree-like structure starting from the root directory (/), making it easy to manage system files, user data, and logs.
All Linux files exist under the root directory (/), and other directories branch out from it.
/) – Top-level directory of the file system./home/student/Documents).Documents).View top-level directories:
ls /
/etc – Configuration Files/etc/passwd → User account information/etc/ssh/sshd_config → SSH service configurationls /etc
/var – Variable Data/var/log → System and application logs/var/spool → Mail and print queuesCheck logs:
ls /var/log
/home – User Home Directories/home/student) to store files, scripts, and configurations.Navigate to your home:
cd /home/student
/root – Root User Homesudo./bin – Essential Binariesls, cp, mv, cat, bash/usr – User Applications and Utilities/usr/bin → Application binaries/usr/lib → Libraries/usr/share → Shared filesLinux maintains log files to record system activity, errors, and security events. Monitoring these logs is essential for troubleshooting and cybersecurity.
| Log File | Purpose |
|---|---|
/var/log/syslog |
General system messages |
/var/log/auth.log |
Authentication events |
/var/log/kern.log |
Kernel messages |
/var/log/dmesg |
Boot-time messages |
/var/log/secure |
Security events (Red Hat-based) |
/var/log/messages |
System messages |
/var/log/faillog |
Failed login attempts |
Display entire file:
cat /var/log/syslog
Paginate output:
less /var/log/syslog
Monitor in real-time:
tail -f /var/log/syslog
/./etc, /var, /home, /root, /bin, /usr./var/log and are critical for monitoring and cybersecurity.