Linux Academy -- practice test -- LPIC-1
What process level, when applied to a process, grants it the most CPU time?
-20
When using rpm, adding which flags will provide more information about the package?
-qpi (query package information)
When using rpm, adding which flags will provide a list of the package contents?
-qpl (query package list)
What configuration file points to directories and other configuration files that hold references to library directory locations?
/etc/ld.so.conf
Which number corresponds to SIGHUP?
1
You modified a file in vi, but you want to exit the file without saving changes. Which key combination will complete this task?
:q!
What does 'apt' stand for (Debian)?
Advanced Package Tool
Name 2 apt "front-ends" on Debian
Aptitude and Synaptic
Why use the following commands in Red Hat? rpm -qpR {.rpm-file} rpm -qR {package-name}
By running these commands, you can determine what dependencies a rpm file has. The system will list these out.
You have two text files that you want to combine with the contents of each file, side by side. Which command would accomplish this task? a.) cut file1 file2 b.) paste file1 file2 c.) combine file1 file2 d.) cat file1 file2
Correct: b.) paste file1 file2 (this way is side-by-side) incorrect: d.) would be file1 above and file2 below
What's the difference between GRUB and GRUB2?
GRUB - stands for Grand Unified Boot loader, used by Debian based systems GRUB2 - This is the Red Hat boot loader...(expand)
What legacy environment variable points to a path where library files can be read?
LD_LIBRARY_PATH
You are logged in as a regular user with a process that has a nice level of zero. You run the following command: renice -n -2 process What happens?
Nothing. You do not have permission to lower the nice level.
Explain the high-level overview of a Linux filesystem:
Things aren't installed to locations in the Linux/UNIX world like they are in the Windows (and even somewhat in the Mac) world. They are more distributed. Binaries are in /bin or /sbin, libraries are in /lib, icons/graphics/docs are in /share, configuration is in /etc and program data is in /var. The /bin,lib,sbin contain the core applications needed for booting and the /usr contains all the other user and system applications
In Red Hat, what would you use the flags -Uvh for?
Used with the rpm command, -Uvh tells the system to "Update verbose hashtag," meaning check for any updates to the package, list out the steps and process in print on the screen, and display a hashtag status bar to show the progress of the update
Which of the following runlevel numbers is the reboot runlevel? a.) 6 b.) 1 c.) 5 d.) 0
a.) 6
Which of the following represents the correct boot order of a sysvinit system? a.) BIOS, MBR, boot loader, kernel, device initialization, root file system mount b.) Boot loader, BIOS, init, device initialization, mount file systems, login c.) BIOS, kernel, boot loader, init, login d.) None of the above
a.) BIOS, MBR, boot loader, kernel, device initialization, root file system mount
Which options configure a computer to boot into a shell environment where more than one person can log into the system and have network access? (Choose all that apply) a.) Edit the /etc/inittab file, and set the first directive to id:3:initdefault b.) systemctl get-default multi-user.target c.) systemctl set-default multi-user.target d.) telinit 3
a.) Edit the /etc/inittab file, and set the first directive to id:3:initdefault c.) systemctl set-default multi-user.target (The telinit 3 option is only a temporary change while system is running, it will not set the configuration for boot-up.)
You have a tarball named log-files.tar.bz2. Without extracting the archive's contents, how could you read the log files within? a.) bzcat log-files.tar.bz2 b.) od log-files.tar.bz2 c.) gzcat log-files.tar.bz2 d.) tar xvfj log-files.tar.bz2
a.) bzcat log-files.tar.bz2
You need to fabricate a command that will print today's date to the screen, send any errors to /dev/null, and write the output of the command to a file called out.log. Which of these commands would accomplish this task? a.) date 2> /dev/null | tee out.log b.) date > /dev/null | tee out.log c.) date 2>&1 /dev/null | tee out.log d.) date 2> /dev/null > tee out.log
a.) date 2> /dev/null | tee out.log
Which command would you use to view the contents of a Debian package? a.) dpkg -c b.) dpkg -l c.) dpkg -s d.) rpm -ql Note: This is a direct quiz question from L.A.
a.) dpkg -c The reason b.) is not correct is because it shows ALL packages installed on a system, not the contents of an individual package. rpm is not correct, since it's a RED HAT command
Which command(s) would print out only your current working directory? (Choose all that apply) a.) echo $PWD b. pwd c.) ls d.) which
a.) echo $PWD b. pwd
You are modifying your .bashrc file in your home directory. Which is the proper command to allow a new environment variable to be seen by all shells that complete this line? ______ "JAVA_HOME=/usr/local/java" a.) export b.) env c.) alias d.) var
a.) export
Which command will show you the first 10 lines of a file? a.) head file.txt b.) top file.txt c.) less file.txt d.) cat file.txt
a.) head file.txt
Which command would enable debugging of a shell script? a.) set -x script.sh b.) debug script.sh c.) echo script.sh d.) set +x script.sh
a.) set -x script.sh
Which commands shut down your computer? (Choose all that apply) a.) shutdown -h -t now b.) telinit 6 c.) shutdown -r -t now d.) systemctl isolate shutdown.target
a.) shutdown -h -t now d.) systemctl isolate shutdown.target
On a system using Upstart, you need to perform an emergency operation in an isolated manner (meaning that you need to prevent others from logging in) without rebooting. Which command would you use to achieve this? a.) telinit 1 b.) systemctl isolate emergency.target c.) telinit 2 d) runlevel 0
a.) telinit 1
Which commands would show you the full path to the ls command? (Choose all that apply (2)) a.) type -p ls b.) which ls c.) echo ls d.) type ls
a.) type -p ls (type along with -p shows full path to an application) b.) which ls (shows full path)
What is the proper character to use when you need to redirect stdout from a command to a file? a.) < b.) > c.) & d.) !
b.) >
Which is the most common shell environment used in Linux? a.) tcsh b.) bash c.) ksh d.) csh
b.) bash
***** (read more about this) Given a file with contents such as this: setroubleshoot:x:987:980::/var/lib/setroubleshoot:/sbin/nologin rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin You want to print only the sixth column of information (which is the home directory for these users, found in /etc/passwd)/ Which command would accomplish this? a.) cat -f 6 /etc/passwd b.) cut -f 6 -d ':' /etc/passwd c.) cut -f 5 -d':' /etc/passwd d.) print -f 6 -d: etc/passwd
b.) cut -f 6 -d ':' /etc/passwd
Which two commands will show you output from the kernel ring buffer? (choose all that apply) a.) bootlog b.) dmesg c.) journalctl -k d.) journalctl -d
b.) dmesg c.) journalctl -k
Which two options provide a desktop environment on a Linux workstation? (Choose all that apply) a.) multi-user.target b.) graphical.target c.) runlevel 5 d.) runlevel 3
b.) graphical.target c.) runlevel 5
Which two options provide a desktop environment on a Linux workstation (choose all that apply): a.) multi-user.target b.) graphical.target c.) runlevel 5 d.) runlevel 3
b.) graphical.target d.) runlevel 5
You need to review the last 15 lines of a file. Which commands would accomplish this task? (Choose all that apply) a.) head -r 15 file b.) tail -15 file c.) sort -r file d.) tail -n 15 file
b.) tail -15 file d.) tail -n 15 file
Which command would provide complete information about the build of your kernel on your system? a.) unam -rm b.) uname -a c.) uname -o d.) uname -p
b.) uname -a (-a = all info avail, -p = processor?, -o = operating system)
Where would you typically install software from a third-party vendor? a.) /root b.) /bin c.) /opt d.) /var
c.) /opt
Which of the following binaries does the kernel use to bring up the rest of the system and start services? a.) /bin/init b.) /sbin/systemd c.) /sbin/init d.) /bin/bash
c.) /sbin/init
Looking through your local /boot directory, you find a file named initramfs-4.16-300.x86_64.img. What is the purpose of this file? a.) This file contains the boot loader to help start the system. b.) This is the initialization daemon, used by the kernel to boot the system. c.) This is the initial RAM disk file, which the kernel uses to temporarily mount the root file system and contains basic drivers. d.) This is the initial RAM disk file, which is used to help boot the kernel from the disk.
c.) This is the initial RAM disk file, which the kernel uses to temporarily mount the root file system and contains basic drivers.
You have a directory containing 4 files named: x01, x02, x03 and x04. How would you combine these files into one single file named combined.txt? a.) split -d -n4 combined.txt b.) paste x0* > combined.txt c.) cat x0* > combined.txt d.) cat combined.txt
c.) cat x0* > combined.txt
You need to set up a script that will output the information to a file as it progresses through the commands. Which sequence would accomplish this task? a.) command1 | file1.out| command2 | file2.out b.) command 1 < file 1.out < command2 < file2.out c.) command1 | tee file1.out | command2 | tee file2.out d.) command1 2> file1.out
c.) command1 | tee file1.out | command2 | tee file2.out
On an Ubuntu system, which command would you use to set a new time zone by modifying an installed tzdata package? a.) rpm -qi tzdata b.) apt-get update tzdata c.) dpkg-reconfigure tzddata d.) dpkg --configure tzdata Note: This is a direct quiz question from L.A.
c.) dpkg-reconfigure tzddata
Which command would provide you with only the value for the environment variable $SHELL? a.) bash b.) env c.) echo d.) set
c.) echo echo means tell me current settings
You need to determine the number of lines within a file. Which two commands would accomplish this task? (Choose all that apply) a.) split -l b.) cat -l c.) nl d.) wc -l
c.) nl d.) wc -l
Which command upgrades a package that is already installed on a Red Hat computer? a.) rpm -e b.) rpm -i c.) rpm -U d.) apt-get upgrade Note: This is a direct quiz question from L.A.
c.) rpm -U apt-get is a DEBIAN command
You want to see some information on an RPM package before you install it. Which command would you use to accomplish this task? a.) rpm -qa b.) apt-cahche show c.) rpm -qip d.) rpm -qi Note: This is a direct quiz question from L.A.
c.) rpm -qip rpm -qa is not correct because this command queries the RPM database for ALL packages on a system, not for a specified single rpm file. so- rpm -qa (query all) rpm -qip (query individual package) rpm -qi (incomplete??) apt-chache show (apt is DEBIAN command)
Which commands reboot a computer using systemd? (Choose all that apply) hint, systemd is the RHEL/Fedora a.) systemd reboot b.) systemctl reboot.target isolate c.) systemtrl isolate reboot.target d.) systemctl reboot
c.) systemtrl isolate reboot.target d.) systemctl reboot (this is the short-hand way of isolating the reboot.target)
Which of the following are valid initialization systems for Linux (Choose all that apply): a.) systemb b.) launchd c.) upstart d.) sysvinit
c.) upstart d.) sysvinit
Which of the following are valid initialization systems for Linux? (choose all that apply) a.) systemb b.) launchd c.) upstart d.) sysvinit
c.) upstart d.) sysvinit
Which device is the first SATA disk on the system? a.) /dev/hda b.) /dev/scd0 c.) /dev/sdc d.) /dev/sda
d.) /dev/sda
Which device is the third partition on the fourth SATA disk? a.) /dev/sdc4 b.) /dev/sdc3 c.) /dev/sd43 d.) /dev/sdd3
d.) /dev/sdd3
Where are the remote repositories configured for a Debian-based system? a.) /etc/apt/sources.conf b.) /etc/dpkg/sources.list c.) /etc/yum.repos.d d.) /etc/apt/sources.list Note: This is a direct quiz question from L.A.
d.) /etc/apt/sources.list The answer /etc/apt/sources.conf is wrong, due to the file extension being incorrect
Which of the following directories should generally be set up on a separate partition? a.) /bin b.) /root c.) /etc d.) /var
d.) /var usually this, due to variable size of added application data
What character sequence would you use to send the stdout of a command, and stderr, into a file called output.log? a.) command | output.log b.) command <2&1 output.log c.) command 2> output.log d.) command 2>&1 output.log
d.) command 2>&1 output.log
What is the most efficient method for deleting all files with a .c extension within the current directory and all subdirectories? a.) find / -name "*.c" | xargs rm -f b.) find .-name "*.c" -exec {} rm -f\; c.) rm -rf *.c d.) find .-name "*.c" | xargs rm -f
d.) find .-name "*.c" | xargs rm -f
Which command shows you what library files a binary depends on? a.) ldconfig b.) LD_LIBRARY_PATH c.) showlib d.) ldd Note: This is a direct quiz question from L.A.
d.) ldd list dependency data?
On a sysvinit system, which command shows you the current runlevel? a.) init b.) telinit c.) systemctl get-default d.) runlevel
d.) runlevel
Which command posts a message to the terminal window notifying other users on the system that you are about to reboot the computer? a.) msg "This computer will be rebooted in 5 minutes." b.) mail "This computer will be rebooted in 5 minutes." c.) tell "This computer will be rebooted in 5 minutes." d.) wall "This computer will be rebooted in 5 minutes."
d.) wall "This computer will be rebooted in 5 minutes."
What Debian command is similar to apt-cache show, providing information about a package?
dpkg --info
What Debian command is related to dpkg --info, but provides less detail?
dpkg --status
What Debian command lists out all files that were installed with a specified package?
dpkg -L
What Debian command installs specified package(s)?
dpkg -i
On a Debian system, which command will list ALL installed packages?
dpkg -l
What Debian command lists packages that match the string provided?
dpkg -l Lists all packages that match provided string, including name of package, version and architecture built for (ie. 32- or 64- bit.)
You have a process running in the background. Which command or device will bring the process back to the foreground?
fg
While in the vim text editor, you want to move the cursor to the top of the file. Which key combination will get you there the fastest?
gg
You have a file named expressions.txt that contains regular expressions that you want to use to parse a file with. Which two commands would you use to accomplish this task?
grep -E -f expressions.txt egrep -f expressions.txt
You have a file named 'search_strings.txt' that you want to use to search another file with to see if it contains the same lines of text. Which two commands would accomplish this task?
grep -F -f search_strings.txt fgrep -f search_strings.txt
You need to search a file that has the text www.linux.com, but you are not sure if the original file has this in upper or lower case characters. Which is the simplest method for searching this file for this text?
grep -i "www.linux.com" file
What command configures dynamic linker run-time bindings, creates a cache based on library directories and can show you what is currently cached?
ldconfig
What command prints out object shared object (library) dependencies?
ldd
What command do you run to list all packages installed on a Red Hat system?
rpm -Va (verbose listing of all packages)
Which command will show all of the installed packages on a Red Hat system?
rpm -qa (Red Hat Package Manager -query all)
In Red Hat, what command and string is used to uninstall a package?
sudo rpm -e <package name> must be run as the root user, "e" = erase
In Red Hat, how do you install a package (what is a recommended command set)?
sudo rpm -ivh (-install verbose hashtag, hashtag is similar to a progress bar)
Which commands will show you the currently running processes on your system? (Choose all that apply)
top ps
What command would you use to list all files associated with a package, that would include documentation (in Red Hat/CentOS)?
whereis -l <filename>
What command will verify that a package has been successfully installed?
which <package name>
Which command can be run as a quick method of checking if your installed package has succeeded?
which ___<enter package name here>____ This will tell you either: is that package installed, and if so, it will display the version of the package and its location on the system
What add-on to a query to show output a line at a time?
|less (pipe less)