CompTIA Linux+ (XK0-004)
Red Hat Enterprise Linux
More Resources
Git and Github
Learn Docker and Kubernates
Tips and Tricks

Administrative Commands

Understanding Linux Directories

If you make any changes to these directories, all users in the system get affected:

  • /bin and /usr/bin: The executables inside this directory are critical for a system to boot up.

  • /sbinand /usr/bin: These are system utilities that are important for general administration of a system but not necessarily to boot your system up.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • /etc: All configuration files.

    • .conf: most files end up with .conf signify configuration files.

    • rc: these are old convention, for example bashrc, vimrc, virc

    • .d : These files signifies services or demons.

  • /boot: all the executables that make the system boot such as kernel

  • /tmp: temporary files

  • /opt: optional files/software/executables

  • /dev: files for devices

Logging in Linux

  • /var/log/messages: Important logs for Red Hat based systems

  • /var/log/syslog: Important logs for Debian-based system (such as Ubuntu)

    • cat /var/log/syslog | grep ssh

Newer method: journal

With systemd, a new logging was introduced that is journal. It solves a lot of problems that came with the old logging methods such as finding specific logs.

Caution: Remember not all applications are logging into journal but in the future they will. As a system admin, you should look into the both places.

Configuring Hardware

In olden days, it used to be a nightmare to make just the x-windows work. Now it's much more better and intuitive.

dmesg is what's tracking the d-bus or device-bus that is connected to the motherboard. dmesg is all the text scrolls by your screen (these days it doesn't show up because there is generally a logo hiding this information):

dmesg

dmesg | grep -i error

How do you know if your hardware is even detected?

Well, when a device is detected, Linux gives it a name and that shows up in /dev/name. Remember, just because a file is there doesn't mean it's ready to use. It may be just a placeholder.

sudo lspci -v: This will display information about all the PCI bus in your server as well as displays information about all the hardware devices that are connected to your PCI and PCIe bus

lspci

Similar utilities lsusb, lscpu, lsmod, etc...

For example, you can pull up information about a module attached to a device using modinfo -d module_name.

modprobe -v module_name: it's used to add a loadable kernel module to the Linux kernel or to remove a loadable kernel module from the kernel.