2.0 Systems Operation and Maintenance Flashcards
Describe the ways to start server programs in Linux
Server Programs in Linux can either run continually in the background as a daemon process or be started from a super-server daemon when requested by a client
How do clients know how to contact a server program?
Server applications listen for client connections on well-known ports. Clients must send a connection requests to the server on the well-known port for the application they want to interact with
What are the commonly used components in the LAMP stack?
The LAMP stack uses the Linux operating system, the Apache web server, the MYSQL database server, and the PHP programming language to provide a platform for web applications
What are some ways a Linux server can share files in a local network?
Linux servers can use the nfs-utils package to communicate with other Linux servers to share folders using NFS.
The local Linux server can mount folders from the remote Linux server as if they were local disks.
Linux servers can also use the Samba package to share files on Windows local networks with Window client and servers as well as map folders on Windows servers
Which server packages are commonly used to support network features on a local network?
The DHCPd package provides DHCP server services to assign IP addresses to clients. The BIND package provides DNS server services to both clients and servers on a local network for hostname resolution. The net-snmp package allows you to implement remote device management using SNMP, and you can use the ntpd package to create an NTP time server for the local network
How do you create a network directory server using Linux?
The OpenLDAP package allows you to create an LDAP directory of users and devices on the local network. Clients and other servers can use the LDAP directory to authenticate users and devices on the network
How can you improve the performance of a network application?
For network applications in a high-volume environment, you can improve performance by implementing either a cluster or load balancing environment.
In a cluster, you can split application functions between multiple servers by using cluster package such as Apache Hadoop.
With load balancing, you can distribute client connections between multiple servers using packages such as HAProxy and Linux Virtual Server (LVS)
What web server is used in the popular LAMP stack?
Apache
A _____ runs in background and listens for client connection requests for a single application
daemon
Which open-source database provided fast performance and became a popular choice for web applications?
MYSQL Database
How does a server know what client request is sent to which application in a daemon?
Linux services listen own well-known ports for requests from clients
What popular open source web server can also perform as a load balancer
The nginX web server can also perform as a load balancer and send client requests to multiple backend web servers
What format does MongoDB use to store data elements in the database?
The MongoDB database server uses the JSON format for storing data records
Which part of the Linux mail process allows you to create filters to automatically redirect incoming mail messages?
The MDA allows you to create filters to match email messages to redirect to other folders
What protocol should you use to mount folders from remote Linux servers on your local Linux server?
The NFS protocol is used to share folder areas on the network with clients
The ______ software package allows your windows workstations to mount a folder stored on a Linux server
The Samba software package allows a Linux server to communicate with Windows servers and clients using the SMB protocol
What two software packages are used in Linux to maintain log files?
The rsyslogd program is used by SysV init systems to log events, and the journald program is used by Systemd systems to log events
Which software program should you load on your Linux server to synchronize its time with a standard time server?
The ntpd service uses NTP to synchronize the server time with a remote system
What software package allows a Linux server to print to a network printer?
The CUPS application provides printer drivers and services that allow Linux systems to connect with local and remote printers
If you see the named program running in background on your Linux server, what service does it provide?
The named program is part of the BIND application, which provides hostname resolution services
Which authentication packages used to be called by the name “Yellow Pages”?
The NIS package was formerly called Yellow Pages (YP), but the name had to be changed due to trademark issues
What package do you need to install to allow your Linux server to provide IP addresses to clients on your local network?
The DHCPd program provides DHCP server services on a local network
The _____ package allows you to create a secure tunnel across a private network to access your local network remotely
The OpenSSH package allows you to use certificates to establish a secure connection between two devices on the network
What server role should you implement to increase performance on your company’s website?
A web proxy server allows you to intercept client web requests and block any requests based on rules you define
A _____ allows your developers to easily deploy applications between development, test, and production
A container allows developers to develop applications in a controlled environment that can easily be deployed to other servers
Which part of the Linux mail process is responsible for sending emails to remote hosts?
The MTA package is responsible for connecting with remote mail hosts to deliver email messages
What are some typical base file and directory management activities?
The typical basic file and directory management activities include viewing and creating file, copying and moving files, and deleting files.
What commands are used for viewing and creating files in directories?
The ls, touch, and mkdir commands
What commands should you use when you need to duplicate, rename, or move files?
Use one of the mv, cp. or rsync commands
For local large file copies, the rsync utility is typically the fastest. You can quickly delete an empty directory using the rmdir utility, but for directories full of files, you will need to use the rm -r command. Also, if you need to ensure that you are removing the correct files, be sure to use the -i option on the rm utility
Describe both structures and commands involved in linking files
Linking files is rather easy to do with the ln command. However, it is important for you to describe the underlying link structure. Hard linked files share the same inode number, while soft linked files do not. Soft or symbolic links can be broken if the file they link to is removed. It is also useful to understand the readlink utility to help you explore files that have multiple links
What are various utilities that can be employed to read text files?
To read entire text files, you can use the cat, bat, and pr utilities. Each utility has its own special features. If you only need to read the first or last lines of a text file, employ either the head or tail command. For a single text line out of a file, the grep utility is useful. For reviewing a file a page at a time, you can use either the less or the more pager utility.
Describe how to find information on your Linux system
To determine two text files’ differences, the diff utility is helpful. With this utility, you can also employ redirection and modify the files to make them identical. When you need to quickly find files on your system and want to use simple tools, the which, whereis, and locate commands will serve you well. Keep in mind that the locate utility uses a database that is typically updated only one time per day, so you may need to manually update it via the updatedb command. When simple file location tools are not enough, there are more complex searching utilities, such as find and grep. The grep command can employ regular expressions to assist in your search
You are looking at a directory that you have not viewed in a long time and need to determine which files are actually directories. Which command is the best one to use?
ls -F
will append an indicator code of / to every directory name
You are using the ls command to look at a directory file’s metadata but keep seeing metadata for the files within it instead. What command option will rectify this situation?
The -d switch on the ls command will allow you to view a directory file’s metadata instead of seeing metadata for the files managed by that directory
You have just created an empty directory called MyDir. Which command most likely did you use?
The mkdir -v command creates a directory and lets you know whether or not it was successful
You have a file that is over 10GB in size, and it needs to be backed up to a locally attached drive. What is the best utility to use in this situation?
The rsync utility allows you to perform fast local copies, so for a big file it is the best utility to use in this case
A long-time server administrator has left the company, and now you are in charge of her system. Her old user account directory tree, /home/Zoe/, has been backed up. Which command is the best one to use to quickly remove her files?
The rm -rI command will recursively delete the files in the /home/Zoe directory tree, and it will ask before it starts, so you know you are deleting the correct tree
rm -rI /home/Zoe
There is a large directory structure that needs to be renamed. What mv command options should you consider employing?
When renaming a directory, you only need to employ the mv command. However, it is wise to use the -i option, so if the new directory name already exists, the utility will stop and ask permission prior to proceeding. Even better is to use the -n option; that way, if the new name you select is already being used, the mv command does not allow you to overwrite it. Also, the -v option is worthwhile, so the mv command operates in verbose mode, telling you want is going on
You are trying to decide whether to use a hard link or a symbolic link for a data file. The file is 5GB, has mission-critical data, and is accessed via the command line by three other people. What should you do?
Create three hard links and provide the links to the three other people for data protection.
because the hard links will prevent the three other command-line interface users from accidently deleting the data. If they delete their link’s name, they will not delete the data
A short text-based control file is no longer working properly with the program that reads it. You suspect the file was accidentally corrupted by a control code update you performed recently, even though the file’s control codes are all correct. Which command should you use next on the file in your problem investigation?
The cat -v command will show any nonprinting characters that may have gotten embedded in the control file causing it to be corrupt
You have two short text files that have maximum record lengths of 15 characters. You want to review these files side by side. Which of the following commands would be the best to use?
the best command to use is the pr -mtl 20 command. This will display the files side by side, remove any file headers or trailers, and set the page length to 20 lines so the files do not scroll off your screen. Of course, you may need to adjust the line length depending upon your screen’s resolution
You have a lengthy file named, FileA.txt. What will the head -15 FileA.txt command do?
The head command can use either the -n 15 switch or the -15 switch to display a file’s first 15 lines
You have issued the command grep Hal on a text file you generated using information from a failed login attempts file. It returns nothing, but you just performed a test case, by purposely failing to log into the Hal account, prior to generating the text file. Which of the following is the best choice as your next step?
Issue the grep -i Hal command on the text file
It is possible that the account name Hal is listed in the generated text file as hal. Therefore, your best next step is to employ the -i option on the grep command. This will quickly search the text file for the word Hal, while ignoring case
You are trying to peruse a rather large text file. A coworker suggests you use a pager. Which of the following best describes what your coworker is recommending?
Use a utility that allows you to view one text page at time
A pager utility allows you to view one text page at a time and move through the text at your own pace
What describe the less utility?
It does not read the entire file prior to displaying the file’s first page.
You can use the up and down arrow keys to move through the file.
You press the spacebar to move forward a page.
You can use the Esc+V key combination to move backward a page.
Which diff option is the best option to allow you to quickly determine if two text files are different from one another?
The -q (or –brief) option used with the diff command will allow you to quickly determine if two text files are different from one another.
You are working on a Linux server at the command line, and you try to issue a diff command and receive a response stating that the command was not found. What is the next best step to take in order to start the troubleshooting process?
Enter the which diff command
the which command will allow you to quickly see the location of the program you provide as an argument. If you see no response, you can go on to the next troubleshooting step of determining if the program is not installed
You are trying to find a file on your Linux server whose name is conf. Employing the locate conf command for your search shows many directories that contain the letters conf. What is the best description for why this is happening?
It is due to file globbing on the pattern name
By default, the locate command uses file globbing, which adds wildcards to the pattern you enter. Thus, conf is turned into conf
You downloaded a large important file, fortytwo.db, from your company’s local website to your Linux server but got interrupted by an emergency. Now you cannot remember where you stored the file. What is the best first step to fixing this problem?
The locate utility searches the mlocate.db database, which is typically only updated one time per day via a cron job. Therefore, for this newly created file, the first thing you should do is update the mlocate.db via the updatedb command, using super user privileges
You want to search for a particular file, main.conf, using the find utility. This file most likely is located somewhere in the /etc/ directory tree. Which of the following commands is the best one to use in this situation?
find /etc -name main.conf
When using the locate command, the path argument is listed first, which is a starting point directory. The find utility will search through that directory and all its subdirectories (recursively) for the file or files you seek. Also, the -name switch allows you to search for a file by name
Yesterday a coworker, Michael, was fired for nefarious behavior. His account and home directory were immediately deleted. You need to audit the server to see if he left any files out in the virtual directory system. Which of the following commands is the best one to use in this situation?
find / -nouser
The find / -nouser command will search through the entire virtual directory structure looking for any files that do not have a username associated with them. Since Michael’s account and home directory were deleted, any files he owned out in the virtual directory structure will not have a username associated with them, only a user ID (UID)
You need to figure out what configuration file(s) hold a host name directive. Which of the following commands is the best one to use?
The grep utility will allow you to search file contents quickly and effectively
What utilities can be used to filter text file data?
Filtering text file data can be made much easier with utilities such as grep, egrep, and cut
How can you format data for viewing purposes?
To format it for viewing use sort, pr, printf, or even the cat utility
What command can you use for statistical information on a file?
If you need some statistical information on your text file, such as the number of lines it contains, the wc command is handy
Explain both the structures and commands for redirection
Employing STDOUT, STDERR, and STDIN redirection allows rather complex filtering and processing of text. The echo command can assist in this process as well as here documents. You can also use pipelines of commands to perform redirection and produce excellent data for review
Describe the various methods used for editing text files
Editing text files is part of a system administrator’s life. You can use full-screen editors such as the rather complicated vim text editor or the simple and easy-to-use nano editor. For fast and powerful text stream editing, employ the use of sed and its scripts or the gawk programming language.
The cat -E MyFile.txt command is entered, and at the end of every line displayed is a $. What does this indicate?
A text file record is considered to be a single file line that ends in a newline linefeed that is the ASCII character LF. You can see if your text file uses this end-of-line character via the cat -E command
The cut utility often needs delimiters to process text records. Which of the following best describes a delimiter?
To properly use some of the cut command options, fields must exist within each text file record. These fields are data that is separated by a delimiter, which is one or more characters that create a boundary between different data items within a record
Which of the following utilities change text within a file?
Recall that many utilities that process text do not change the text within a file unless redirection is employed to do so. The only utilities in this list that will allow you to modify text include the text editors vim and nano
You have a text file, monitor.txt, which contains information concerning the monitors used within the data center. Each record ends with the ASCII LF character and fields are delimitated by a comma (,). A text record has the monitor ID, manufacture, serial number, and location. To display each data center monitor’s monitor ID, serial number, and location, use which cut command?
The cut command gathers data from the text file, listed as its last argument, and displays it according to the options used. To define field delimiters as a comma and display each data center monitor’s monitor ID, serial number, and location, the options to use are -d “,” -f 1,3,4
cut -d “,” -f 1,3,4 monitor.txt
The grep utility can employ regular expressions in its PATTERN. Which of the following best describes a regular expression?
A pattern template you define for a utility, which uses the pattern to filter text
a regular expression is a pattern template you define for a utility, such as grep, which uses the pattern to filter text. While you may use a series of characters in a grep PATTERN, they are not called regular expressions
You are a system administrator on a CentOS Linux server. You need to view records in the /var/log/messages file that start with the date May 30 and end with the IPv4 address 192.168.10.42. Which of the following is the best grep command to use?
grep “May 30.*192.168.10.42” /var/log/messages
this grep command employs the correct syntax. It uses the quotation marks around the pattern to avoid unexpected results and uses the .* regular expression characters to indicate that anything can be between May 30 and the IPv4 address. No additional switches are necessary
Which of the following is a BRE pattern that could be used with the grep command? (Choose all that apply.)
Sp?ce
“Space, the .*frontier”
^Space
frontier$
A BRE is a basic regular expression that describes certain patterns you can use with the grep command
You need to search through a large text file and find any record that contains either Luke or Laura at the record’s beginning. Also, the phrase Father is must be located somewhere in the record’s middle. Which of the following is an ERE pattern that could be used with the egrep command to find this record?
”(^Luke|^Laura).Father is.”
A file data.txt needs to be sorted numerically and its output saved to a new file newdata.txt. Which of the following commands can accomplish this task?
sort -n -o newdata.txt data.txt
sort -n data.txt > newdata.txt
To sort the data.txt file numerically and save its output the new file, newdata.txt, you can either use the -o switch to save the file or employ standard output redirection via the > symbol. In both cases, however, you need to use the -n switch to properly enact a numerical sort
Which of the following commands can display the data.txt and datatoo.txt files’ content one after the other to STDOUT?
cat -n data.txt datatoo.txt
sort data.txt datatoo.txt
The commands in both options C and E will display the data.txt and datatoo.txt files’ content one after the other to STDOUT. The cat -n command will also append line numbers to it, but it will still concatenate the files’ content to standard output
A text file, StarGateAttacks.txt, needs to be specially formatted for review. Which of the following commands is the best command to accomplish this task quickly?
The pr command’s primary purpose in life is to specially format a text file for printing, and it can accomplish the required task fairly quickly
You need to format the string 42.777 into the correct two-digit floating number. Which of the following printf command FORMAT settings is the correct one to use?
The printf FORMAT “%.2f\n” will produce the desired result of 42.78
A Unicode-encoded text file, MyUCode.txt, needs to be perused. Before you decide what utility to use in order view the file’s contents, you employ the wc command on it. This utility displays 2020 6786 11328 to STDOUT. What of the following is true?
The file has 2,020 lines in it
The file has 6,786 words in it
The first item output by the wc utility is the number of lines within a designated text file. Therefore, option A is correct. Option C is also correct, because the second item output by the wc utility is the number of words within a designated text file
What is a file descriptor?
A file descriptor is a number that represents a process’s open files
By default, STDOUT goes to what item?
By default, STDOUT goes to your current terminal, which is represented by the /dev/tty file
Which of the following commands will display the file SpaceOpera.txt to output as well as save a copy of it to the file SciFi.txt?
cat SpaceOpera.txt | tee SciFi.txt
The command in option A will display the SpaceOpera.txt file to output as well as save a copy of it to the SciFi.txt file
Which of the following commands will put any generated error messages into the black hole?
sort SpaceOpera.txt 2> /dev/null
The /dev/null file is also called the black hole, because anything you put into it cannot be retrieved. If you do not wish to see any error messages while issuing a command, you can redirect STDERR into it.
Which of the following commands will determine how many records in the file Problems.txt contain the word error?
grep error Problems.txt | wc -l
To find records within the Problems.txt file that contain the word error at least one time, the grep command is employed. The correct syntax is grep error Problems.txt. To count the records, the grep command’s STDOUT is piped as STDIN into the wc utility. The correct syntax to count the records is wc -l
You want to find any file named 42.tmp, which exists somewhere in your current directory’s tree structure and display its contents to STDOUT. Which of the following will allow you to build a command to do this?
cat find . -name 42.tmp
cat $(find . -name 42.tmp)
find . -name 42.tmp | xargs cat
The xargs command, $() method, backticks (`), and brace expansion all allow you to build a command-line command on the fly. In this case, only options B, C, and E are using the correct command syntax to find any file named 42.tmp, which exists somewhere in your current directory’s tree structure and display its contents to STDOUT
You want to edit the file SpaceOpera.txt and decide to use the vim editor to complete this task. Which of the following are vim modes you might employ?
The three modes of the vim editor are command (also called normal mode), insert (also called edit or entry mode), and ex (sometimes called colon commands)