LPI Question Set Flashcards
What can be used to link together multiple programs so that the output of one program becomes the input of another?
Pipes enable you to link together multiple programs. At the command line, the pipe character is a vertical bar
What command will show you the path of the directory you’re currently working in?
The pwd command will show you the path of the directory you’re currently in.
You type ps ax | grep xterm. What is the purpose of the grep xterm portion of this command?
It searches the output for the string xterm. The grep command searches for patterns in input files (the output of the ps ax command, given the pipe in the original command).
How can you display all the environment variables that are currently set in your login shell?
Type env
How do man pages and info pages differ?
man pages are “flat” documents—that is, single files. By contrast, info pages use hypertext (similar to Web pages) to help organize documents.
What does the uniq command do?
By default, it outputs a file without any duplicate lines from the input file.
What does the fmt command do?
It reformats the paragraphs within a file
You type the command testprog < somefile.txt. What is the effect of the less-than (<) character in this command?
This is an input redirection operator; it causes the contents of somefile.txt to be sent to testprog as if the contents of somefile.txt were typed at the console.
How would you read a Linux manual page?
Type man topic, where topic is the name of the command, configuration file, or other topic you want to investigate.
What is the function of the tail command?
It displays the last few lines (10 by default) of a file.
What is the difference between grep and egrep?
The grep program uses basic regular expressions by default, but egrep uses extended regular expressions by default.
What command would you use to combine two text files, each of which contains tab-delimited data with at least one field in common between the two files?
The join command performs this task.
How do the exit and logout commands differ?
The logout command works with login shells only, whereas exit is intended for use with non-login shells (such as xterm windows), but in practice works with both login and non-login shells.
A text file contains tabs that are expanding into the wrong number of spaces in your chosen text editor. What command can you use to process the text file to substitute multiple spaces for each tab?
The expand command does this job.
As root, you type tail -f /var/log/messages. What will be the result of this command?
The command displays the last few lines of /var/log/messages and then continues to monitor the file and display new lines as they’re added to it.
As root, you type renice 19 2548. What is the effect of this command?
The priority of the process with a process ID (PID) number 2548, if it’s present, is changed to 19—that is, the process’s priority is set to the lowest possible value.
What is the purpose of the nice command?
It allows you to run a program with a specified priority.
What does the output of the uptime utility show?
The output of the uptime utility shows the time the system has been running, as well as three load averages (for the past minute, the past 5 minutes, and the past 15 minutes).
What are the advantages of shared (aka dynamic) libraries over static libraries?
Shared libraries save disk space and memory, at least when they’re used by multiple programs.
What can you learn from the uname utility?
You can learn the kernel name, the network hostname, the kernel release, the kernel version number, the machine name, the processor type, the hardware platform, and the OS name.
What are some common solutions to the problem of an unsatisfied dependency when installing a program package?
You can force the installation, install/upgrade the required package, install a different version of the target package, or rebuild the target package from source code.
How can you identify processes that consume an inordinate amount of CPU time?
You can use either the top utility or the ps utility with appropriate switches.
Sally types rpm -e badprogram as root. What is the effect of this command, if the system uses RPM?
The badprogram package, if it’s installed and not depended on by other programs, is uninstalled from the system.
What is the function of the top program?
top displays an ordered process list, updating it frequently. By default, top orders processes by CPU use, but you can give it commands to order processes by other criteria.
Which common package management systems include support for dependency tracking?
The Red Hat Package Manager (RPM) and Debian package systems include such support.
What file holds information about the library path the system uses in human-readable form?
The /etc/ld.so.conf file includes this information.
What tool does Debian provide that can be used to keep your system automatically up to date with the latest system updates?
You can use the Advanced Package Tools (APT), and particularly apt-get, dselect, and aptitude.
What happens when you try to run a program that requires a library that’s not installed?
The program responds with a message saying that it couldn’t find a library file. (The message may not be visible if the program is launched in a GUI environment.)
How do you tell kill what process you want to terminate?
Pass kill the target process’s process ID (PID) number.
You want to upgrade the bigserver package on an RPM-based system with a new file called bigserver-4.2.3-3.i386.rpm. What should you type?
Type rpm -Uvh bigserver-4.2.3-3.i386.rpm. The v and h options may be omitted if you don’t want a progress display.
You want to kill a process by name. What command can you use to do this?
Type killall processname. Alternatively, you can use ps to find the process ID (PID) of the process and use kill.
What tools are most commonly used to install or remove Debian packages?
The most commonly used tools are dselect, dpkg, apt-get, and GUI front ends to these.
Why might you not want to edit /boot/grub/grub.cfg directly to change your boot loader configuration?
The /boot/grub/grub.cfg file is a GRUB 2 configuration file. GRUB 2 encourages editing files in the /etc/grub.d directory and the /etc/default/grub file and then using scripts to regenerate /boot/grub/grub.cfg.
In Linux’s fdisk, you want to create a new partition. What major fdisk command do you use?
Typing n creates a new partition in fdisk.
What programs does Linux use to write to optical media?
The mkisofs program creates an ISO-9660 filesystem, which is then burned to the disc by cdrecord. The growisofs program combines these two functions for recordable DVDs.
What command is used to create a filesystem?
The mkfs command is used to create a filesystem. This command actually calls filesystem-specific creation tools like mkfs.ext2 (aka mke2fs), which you can call directly if you prefer.
What software component determines whether Linux supports a given SCSI host adapter?
The Linux kernel determines this.
What is the physical location of the first code an x86 CPU executes when it starts up?
This code is located in the firmware (BIOS or EFI), which is stored on a chip on the motherboard.
What GRUB Legacy and GRUB 2 command is used to pass control to another boot loader?
The chainloader command, which passes control to the partition specified by a preceding root or rootnoverify command.
On what MBR partition type(s) (primary, extended, or logical) may the Linux root ( / ) partition reside?
The Linux root partition may reside on a primary or logical partition. Extended partitions are “placeholders” for one or more logical partitions.
Where do programs installed from source code normally reside?
They reside on /usr/local.
In what two forms does Linux swap space generally come?
It may come as a dedicated swap partition or a swap file within a regular filesystem.
What GRUB command specifies a background image file to be displayed at boot time?
The splashimage command does this job.
Where can the GRUB boot loader code be installed on a BIOS-based computer?
The GRUB boot loader can be installed on the hard disk’s MBR, a Linux partition’s boot sector, or a floppy disk’s boot sector. This code relies on files in the /boot partition as well.
What command would you use to obtain information on PCI devices installed in your system?
You’d use the lspci command.
Your computer has a large hard disk, and you can’t allow extended downtime doing filesystem checks after a power failure. How can you avoid this?
Use a journaling filesystem, such as ReiserFS, ext3fs, ext4fs, XFS, JFS, or Btrfs.
What devices must be terminated in a SCSI chain?
The devices at the ends of the chain must be terminated. (One of these may be the SCSI host adapter.
Where should you install GRUB on a BIOS-based computer if you want to be able to restore its functionality using DOS’s FDISK after installing DOS or Windows?
Install GRUB on a primary Linux partition’s boot sector (not the disk’s MBR).
What does the modprobe command do?
It loads or removes one or more modules, including the module you specify and any on which it depends.
What is the function of the sticky bit?
It’s set on directories to alter Linux’s normal file deletion rules. With the sticky bit set, only the file’s owner may delete the files in a directory.
What command will show you the numeric value currently being subtracted from the default permissions of newly created files and directories?
The umask command will show you the numeric value currently being subtracted from the default permissions of newly created files and directories.
What utility can be used to locate files in common binary, documentation, and configuration directories?
The whereis utility locates files in common binary, documentation, and configuration directories.
What utility allows you to edit disk quota information?
The edquota utility allows you to edit disk quota information.
What character does Linux use to symbolize the root directory?
The root directory is Linux is represented by /.
What text-mode programs might you use to edit the partitions on an MBR disk?
fdisk or parted
What command would you type at a shell prompt to view the contents of the /usr/local/bin directory?
Type ls /usr/local/bin.
Where do most system configuration files normally reside?
Most system configuration files reside in /etc or its subdirectories.
What is the difference between a hard link and a symbolic link?
A hard link is two or more filenames that point to the same inode and hence the same file. A symbolic link is a file that points to another file by name; accessing the symbolic link accesses the linked-to file.
An administrator wants to delete /home/baduser but mistakenly types rm -r /home /baduser as root (note the extra space). What will be the consequence?
This command recursively deletes all the files in the /home and /baduser directories, effectively destroying all user’s files (assuming they’re all in /home, as is common).
What does the mv command accomplish?
It moves or renames a file or directory.