ch 10 System Monitoring

What information is displayed by dmesg

all kernel hardware information

When trying to troubleshoot intermittent errors that are occurring while continuing to work on other project, which command displays system messages, but only the ones that are panic messages?

dmesg -n 1

After installing a new cd-rom drive you can't find the drive anywhere. what commands could you enter to start troubleshooting?

dmesg
journalctl

what commands would allow you to determine if a service or driver failed to load during boot up

dmesg
journalctl -b

If you suspect your system has been compromised by a user through remote login, which file is most likely to have information related to an intrusion

/var/log/secure

what log is also known as the kernel ring buffer

/var/log/dmesg

To review all failed login attempts on a system in the /var/log/btmp binary file, what command should you use

lastb

what daemon is typically used by systemd Linux system for system logging

journald

what is the full path to the directory where the system log file called the journal is maintained by the journal daemon?

/var/log/journal/

what do you enter at the command prompt to read the contents of the journal

journalctl

what key do you press to close the journal

q

what do you enter at the command prompt to read the contents of the journal starting with the most recent entries

journalctl -r

what do you enter at the command prompt to not only see the most recent entries to the journal, but to also see new entries as they are being added in real time to the journal?

journalctl -f

what do you enter to see messages from the most recent system boot

journalctl -b

what do you enter to see messages from the third system boot event from the beginning (r oldest messages) of the journal

journalctl -b 3

what do you enter to see messages from the third system boot from the end (or most recent) of the journal

journalctl -b -3

which type of looping script executes while a condition is true

while

When creating a script to run in a BASH shell session, what line of code should you write as the first line in the script?

#!/bin/bash

what character should precede comments in a script

#

what statements begin and finish a while loop?

do
done

what type of script control structure is useful when a specific action needs to be done a set number of times?

for

what script control structure tests whether a directory exists?

test

what is the purpose of the read command in a script

creates a script variable and prompts the user to type text

what command do you use in a script to create a sequence of numbers in a control structure?

seq

what are you essentially doing when you create a shell function at the command prompt

defining a command you can use as if it were a standard command

when you define a function at the shell prompt, where is the function saved and what happens to it when the shell session is closed

the function is saved in memory and it is deleted from memory when the shell session closes

how do you declare a function called datestamp

function datestamp ()

what character must come before the lines of code that are used for the timestamp () function

{

what character must come after the lines of code that are used for the timestamp () function

}

When declaring a function, what do the parentheses allow you to include when you invoke or call the function

arguments