Linux Practice Test – Flashcards

Unlock all answers in this set

Unlock answers
question
The MTS log file contains thousands of entries, but you are only interested in the most recent entries. Each time entries are added, they are appended to the end of the file. Which utility will be best suited for examining the entries you are interested in?
answer
tail
question
You are working on a Linux distribution that uses systemd. Which file in the /lib/systemd/system/ directory is used to start the services necessary for runlevel 5?
answer
graphical.target
question
Which command will print the line count, word count and byte count respectively in the /home/gshant/servepath file? (Enter the command as if at the command prompt.)
answer
wc -lwc /home/gshant/servepath
question
A directory intended to be used only by administrators keeps filling with files. Which of the following commands would you used to see only the names of the users saving files in the directory?
answer
ls -l | cut -d " " -f5
question
You need to create the directory /var/oracle/database/9i. Only the directory /var currently exists. From the root of the filesystem, which command will create the directory path?
answer
mkdir -p /var/oracle/database/9i
question
You are working at the command line and need to start a new Bourne-again shell (bash) session. What should you type? (Enter the command as if at the command prompt.)
answer
bash
question
You have a system with a single hard disk. You add a new hard drive to your system. Which of the following commands would you use to partition the new drive?
answer
fdisk /dev/sdb
question
You want to view all currently-running processes that include getty in the process name. Which command would you use?
answer
ps -A | grep getty
question
You need to chang the formatting of the /home/varstown file as it prints. Specifically, you need to add double-spacing to each line in the file. What command should you use? (Enter the command as if at the command prompt.)
answer
pr -d /home/varstown
question
Which of the following methods should you use to configure dynamic libraries on a Linux system?
answer
Use the LD_LIBRARY_PATH environment variable to specify additional directories to search for library files. Modify /etc/ld.so.conf to add the path of libraries.
question
You are looking for a more orderly way of stopping processes besides running the kill utility. Another administrator tells you that scripts exist to stop most processes in an orderly fashion. Where should you look for such scripts on your system?
answer
/etc/init.d
question
What is the path for the menu.lst file? (include the complete path)
answer
/boot/grub
question
What command should you enter to see a list of all the commands you recently used at the command prompt?
answer
history
question
Which of the following utilities will substitute an existing string with a new string within a file?
answer
sed
question
You are attempting to install an RPM package on your Linux System, but the system tells you that package has dependencies that are not installed. What rpm option will override the need to install the dependencies? (Enter the command as if at the command prompt.)
answer
rpm --nodeps
question
You have added several new hard disks to your system. After partitioning and formatting you have modified a configuration file to mount these new filesystems automatically. You want to document the change you made. What file would you document?
answer
/etc/fstab
question
Under the Filesystem Hierarchy Standard (FHS), which directory contains the device files for a Linux system? (Enter the full path of the directory.)
answer
/dev
question
What is the result of the uname -a command?
answer
All system information is displayed on the screen.
question
You have just installed a new program that will be used by all users on the computer. After installation, you log in as a regular user and you try to run the program. The program stops and displays the following error: Error: not running as root. What should you do so that all users can run this program?
answer
set the SUID on the program
question
Which command reloads the library cache every time libraries are added to removed, and updates the symbolic links?
answer
ldconfig
question
Which file system is a FAT32 filesystem for Linux?
answer
vfat
question
You need to create an ext4 file system on the first partition on the second hard disk drive. What command should you use?
answer
mkfs.ext4 /dev/sdb1
question
After opening a file in vi, you want to switch from command mode to command line mode. What key should you enter?
answer
:
question
Which of these configuration files define the default runlevel of your system?
answer
/etc/inittab
question
You are using awk to print a sorted list of the user names in /etc/passwd. Which command will accomplish the sorted output?
answer
awk -F: '{print $1} ' /etc/passwd | sort
question
You are logged in as root. You have the file, letter.doc, on a CD in the first compact disk drive. Which command will copy the file from the CD to your home directory.
answer
cp /mnt/scd0/letter.doc /root
question
Which of the following commands would you use to find all of the files on the system that have either blue or gold in their names?
answer
find / -name '*blue*' -o -name '*gold*'
question
Which command prints the attributes of a /boot/grub/grub.conf file?
answer
lsattr /boot/grub/grub.conf
question
You need to implement disk quotas on you Linux system. You need the quotas on the / directory. Which file must be edited to implement quotas for users and groups?
answer
/etc/fstab
question
Which statement is correct on how to differentiate core processes from other services?
answer
They have the lowest pid numbers, always below 100. If you run ps -aux, the core processes are at the top of the listing.
question
What is the purpose of the rpm -V command?
answer
verify that an RPM packages is free from errors.
question
You are called into the office of a newly hired manager. He has copied a file from his old place of work onto his new workstation, but is now receiving an error message that access is denied each time he tries to access the file. He is not the owner of the file, and not a member of the group the file is associated with. Which of the following represents the least set of file permissions needed for him to be able to read and write to the file?
answer
666
question
You use a program on your Linux system named photorec. Which command will display the path to the the photorec binary file?
answer
which photorec
question
Which command will display all the environment variables on the system?
answer
set
question
Which of the following options is the standard shell for most Linux computers?
answer
Bourne-again shell (bash)
question
You have installed a package called mathpac with yum. After a system upgrade, the package is not working correctly. Which command should you try first to get the package to work?
answer
yum update mathpac
question
The /home/gshant/smp directory contains several files. The directory and files need to be removed. You change directories to /home/gshant. Which command should you use?
answer
rm -r smp
question
You have made changes to the /etc/inittab file, but they do not seem to be taking effect. This is the busy time of day, and you do not want to bring the system down and back up. Which command forces the system to reread the entries in the /etc/inittab file?
answer
init q
question
Which of the following is not a characteristic of hard links?
answer
distinct inode
question
Which of the following commands displays all lines in ~/smarts, omitting the last 10 lines?
answer
head -n -10 ~smarts
question
A file named acctg needs to have the SGID permission set on it while keeping all other permissions at their present value. Which of the following commands will accomplish this?
answer
chmod g+s acctg
question
What is the purpose of the messages log file in /var/log/messages and what type of information does it hold?
answer
It is the system message log file, and it holds kernel messages and messages from applications.
question
What is the full path for Yellowdog Updater Modified (YUM) configuration file?
answer
/etc/yum.conf
question
You previously created symbolic links in your home directory to a set of files in the /data directory using the ln -s command. The system administrator has just deleted those files. What happens to the links that you created?
answer
The symbolic links would still exist in your home directory but they would now be broken.
question
You want to perform an audit and make sure that group membership for user dblair is correct. Which command would you use to view the groups that dblair is a member of?
answer
grp -e dblair /etc/group
question
Setting the SUID flag is a powerful and useful feature. It can have weakness associated with its use. Which of the following statements identifies a weakness?
answer
setting the SUID flag for an application or process owned by the root user is a potential security hole.
question
Which of the following lines in the /etc/inittab file defines the default runlevel?
answer
id:3:initdefault:
question
While in command mode, you need to find the term Sam. Which command should you use?
answer
/Sam
question
Which apt-cache option shows the missing dependencies in the package cache?
answer
unmet
question
Which command would you use to rename the /home/pmallory/reports file to reports.bak?
answer
mv /home/pmallory/reports /home/pmallory /reports.bak
question
Which of the following commands will cut an entire line from a file while in vi command line mode?
answer
dd
question
Which file would you check to see system startup error messages?
answer
/var/log/boot.msg /var/log/boot.log
question
You are working with the following RPM package: acroread- 8.1.3-51.6.i56.rpm. Drag the naming convention term on the left to match the items on the right.
answer
i586- Architecture type 8.1.3- Version number acroread- Package name 51.6- Release number
question
A user calls with a concern about the display he is seeing after running the command: ps -ef. There are a number of processes that display getty and he is afraid that an unauthorized user is attached to the system.
answer
assure the user that this is normal
question
You need to restore a file, yearend.xls, from the archive 013004.tar.gz in the backup directory. The file needs to be restored to /home/accounting. Which command will perform the restore?
answer
tar -xzvf /backup/013004.tar.gz /home/accounting/yearend.xls
question
A number of new filesystems have been added to the server and you want them to be active now. You also do not want to bring the server down. Which command makes the changes active?
answer
mount -a
question
Which command displays information about the RAID devices on the computer?
answer
hwinfo --listmd
question
You are using YUM, and you need to determine which package contains the /usr/lib/libstlport_gcc.so file. Which command should you type at the command prompt?
answer
yum whatprovides /user/lib/libstlport_gcc.so
question
You have installed a package called mathpac with apt-get. After a system upgrade, the package is not working correctly. Which command is the most correct option to get the package to work?
answer
apt-get upgrade mathpac
question
You want to issue a simple command to replace all the occurrences of the string foo with the string bar in the file myfile.txt. You have decided to use sed. Whch line will work?
answer
sed -e 's/foo/bar/g' myfile.txt
question
You need to view the files within /home/gshant/expfile.bz2, but you want to leave the compressed file unchanged. What bzip2 options should you use?
answer
-k
question
You are requested to help a user who reports that he has no more local storage space. You go to his system and log in as root user. Which command will display the available disk space on all partitions?
answer
df df-h
question
You want to view partition information for your sda device. Which commands could you used to view the partitions defined on sda?
answer
fdisk -l fdisk /dev/sda, then press p
question
You need Yellowdog Updater Modified (YUM) utility to check specific URLs for RPM repositories. Where should you add the URLs?
answer
within the etc/yum.conf file
question
Which daemon allows processes to communicate with each other and rely information about hotplug decices?
answer
D-Bus
question
Which of the following is not a characteristic of symbolic links?
answer
valid inode for the file data even if the original file is deleted
question
Which of the following devices represent a hotplug device?
answer
USB flash drives
question
Which of the following commands starts gedit with a priority 1 about the defult nice priority?
answer
nice -n -1 gedit
question
Which kill option stops and restarts the process with the same Process ID (PID)?
answer
-SIGHUP
question
You need to obtain specific information found in the columns of ~/smarts. Which of the following commands should you used?
answer
cut -f ~/smarts
question
You need to configure a few changes to how the locatedb index file is created. Which file should you edit?
answer
/etc/updatedb.conf
question
Which command reads from standard input and writes to standard output and files?
answer
tee
question
You want to restore files with the extension .cfg from an archive called configs.cpio. Which command will perform the restore?
answer
cpio -ivd "*.cfg" < /mnt/hdd2/configs.cpio
question
A developer calls with a problem. They were trying to debug a new daemon and mistakenly placed it on the production machine instead of on a lab machine. It has now entered runaway mode. The PID number is 2345 and attempts have been made to remove it with the standard kill command but it will not stop. Which command would you use to be assured that the process will terminate?
answer
kill -9 2345
question
You are preparing to use a logical volume with LVM. Which of the following commands creates a volume group named backup on the third disk in the system?
answer
vgcreate backup /dev /sdc
question
Which utility runs at startup to load modules into kernal?
answer
modprobe
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New