Linux Academy LPIC Exam 1 Study Guide
apt-get clean
Which apt-get command clears out the local repository of retrieved package files? It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/
dpkg -P
Will purge a package with dpkg, removing it and any dependencies no lnger needed by other packages.
dpkg -r
Will remove a package with dpkg. Dependencies no longer needed by that package will NOT be removed.
pr
Command used to convert files for printing (adds header, footer and sets breaks)
ps
Command used to display processes run from its own terminal.
env
Command used to display the current session's environment variables.
locate
Command used to find files by name, can only be run after updatedb.
join
Command used to join lines of two files based on a common field or delimitor.
killall
Command used to kill all processes of a certain name.
fmt
Command used to reformat streams or files for display as indicated (width of colums)
unset
Command used to remove an environment variable.
uniq
Command used to report or omit repeated lines.
yum info
Displays packages information with yum. Same as rpm -qi.
split
Command used to split a file into pieces, if no options are given, it defualts into splitting into pieces every 1000 lines.
swapon
Command used to turn on swap on a partition. Can only be used after mkswap.
/etc/apt/sources.list
Contains list of repositories for apt-get
/proc
Contains virtual system information.
...
...
lsusb
A utility for displaying information about USB buses and associated connected devices in the system.
make
A utility to read a source configuration file and maintain a group of files or programs. It is often used to compile source coude and install the binaries once complete.
2>>
Append standard error to the end of a file.
<<
Append the contents of a file into a command.
>>
Append the output of a command to a file.
telinit
Aside from init, what other command could you run to change the run level?
chattr +i
Assigns the file the immutable attribute: A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser can set or clear this attribute.
modprobe
Automatically loads (or lunloads any dependent modules and is usually the preferred way of loading kernel modules. Replaces the deprecated 'insmod' and 'rmmod' utilities.
BIOS
Basic Input Output system
xargs
Build and execute commands from standard input.
yum deplist
Displays dependencies for a package with yum.
yum list
Displays information about a package with yum
rpm -h
Displays operation progress of rpm.
/dev/bus/usb
By default, lsusb reads this directory for contents and configurations.
mount -a
Causes all files system mentioned in /etc/fstab to be mounted as indicated.
rpm --test
Checks the install operation for issues without acutally installing anything with rpm.
yum check-update
Checks to see if updates are available with yum.
yum clean
Cleans yum cache and removes package install files that are no longer needed.
dumpe2fs
Command that obtains file system info.
chattr +a
Command to assign the append only attribute. This makes the file editable in append only mode. Only the superuser can set or clear this attribute.
chattr +c
Command to assign the compression atrribute to a file.
chattr +u
Command to assign the recoverable attribute to a file.
init-checkconfig
Command to check the configuration of Upstart jobs
edquota
Command to edit user disk quotas.
umount -f
Command to force the unmounting of a filesystem.
mkfs -t ext4
Command to format the partition as ext4.
debugfs
Command to interactively modify a file system. Features: program provides abilities of tune2fs and dump2fs use debug fs to undelete a file if needed. Do not use on a mounted file system.
passwd -l
Command to lock a user account
dpkg -i
Command to manually install a .deb package. Does not install dependencies and thus the install may fail.
uname -i
Command to print hardware information.
uname -m
Command to print machine/cpu information.
uname -o
Command to print operating system name.
uname -p
Command to print processor information.
uname -s
Command to print the kernel name.
uname -r
Command to print the kernel release.
uname -v
Command to print the kernel version.
uname -n
Command to print the node name.
rpm --nodeps
Command to run rpm with out checking for dependencies.
chgrp
Command to set group ownership of a file or directory.
passwd -u
Command to unlock a locked user account.
file
Command use to determine file type.
renice
Command used to alter the priority of running processes.
rpm2cpio
Converts rpm packages to CPIO compressed files.
dselect
Deprecated high level package manager for debian based, similiar in fuction to aptitude. Allows the selection and installation of packages in the terminal using an 'ncurses' menu system.
insmod
Deprecated method used to INSERT modules into the running Linux kernel.
rmmod
Deprecated method used to REMOVE modules from the running Linux kernel
/proc/dma
Directory that displays DMA addresses in use on the system.
/proc/interrupts
Directory that shows the IRQs inuse on the system.
/proc/modules
Directory which displays all of the modules currently loaded by the running Linux Kernel.
od
Dump files in octal format.
<
Export the contents of a file into a command
dmesg
Extracts information about the boot process and can be viewed with the command directly. Prints or controls the "kernel ring buffer information." It also prints a number of messages on the screen taht display information about the hardware devices that the kernel detected during the boot process.
rpm -force
Force package installation with rpm.
apt-get install
This command will install whatever package that you indicate as well as any dependencies it requires on a debian based system.
SIGHUP 1
Hangup signal
runlevel
This command will print the last, and current runlevel to stdout.
aptitude
High level package manager for debian based systems.. It is the backend for several GUI package managers. Displayed in the terminal using an 'ncurses' system.
/lib
Holds libraries - code used by many other programs - these are critical for basic system operation
/var
Holds miscellaneous transient files. these are things like files and print spool files. /var/tmp deserves special mention much like the /mnt (see below) /var/tmp holds temporary files. These files should not be deleted when the computer reboots
/sbin
Holds program files that are critical for normal operation and that ordinary users seldom run.
/bin
Holds program files that are critical for normal operation and that ordinary users may run
/usr
Holds programs and data used in normal system operation but that aren't critical for a bare-bones boot of the system
/tmp
Holds temp files - often including temporary files created by users programs. While many distributions don't delete these temp files - they should be deleted when the computer reboot.
split -l 10 file.txt
How could you split the file, file.txt into 3 smaller of 10 lines each? It is 30 lines long.
6
How many sections does a properly formatted /etc/fstab have?
rpm -qpl
How would you list all files in a RPM package? For example all files inside of httpd.rpm
nice -n 10 freshclam
How would you start the freshclam utility with a niceness of 10?
nl
I want to add line numbers to a file. What command should I run?
head -n 25
I want to output the first 25 lines of a file to standard output, what command should I run?
true
If you remove the sources file on a hard link, then the link file will still exist
ldconfig
If you wanted to clear the library cache after adding library locations to the /etc/ld.so.conf file, what command would you run?
ZZ
In vi command mode, this will save changes and quit, similar to :wq
yum install
Installs a package with yum.
rpm -i
Installs an RPM package. Package names must be unique to system.
SIGINIT 2
Interrupt from keyboard signal
/etc/updatedb.conf
Location of the configuration for the updatedb command.
/etc/yum.conf
Location of the yum configuration file.
/etc/yum.repos.d
Location of yum repository files.
yum search
Searches for a package in the yum repositories.
SIGKILL 9
Kill signal ... This signal is unblockable and causes the program to terminate abruptly. Should only be used if you can't terminate with SIGTERM 15.
lsattr
List file attributes.
lsmod
List modules currently loaded by the running Linux Kernel. Nicely formats the contents of /proc/modules
whereis
Locates the sources/binary and manuals section for specific files
1
Man page for Executable programs or shell commands.
2
Man page for system calls (functions provided by the kernel).
modprobe -r
Modprobe command to remove a kernel module
2
On Debian and its derivatives, this run level is a full multi-user mode with X and a graphical log in. On other distributions, it is undefined.
5
On Red Hat and most others, run level ___ is the graphical, multi-user mode.
3
On Red Hat and most others, this run level is a full multi-user mode with console (non-graphical)
/etc/inittab
On SysVinit systems, this is the run level and default run level configuration file.
apt-get upgrade
On a debian based system, what command upgrades your packages?
apt-get source
On an Ubuntu system, what command could you use to download the source of a package?
/sbin/init
Once the kernel takes over the boot process, it performs system tasks and loads the final process of executing the initial program for your system. By default, this is the program _______________.
mount -o
Override mount options in fstab when manually mounting partitions.
repquota -a
Print quotas of all the file systems configured with a quota mount option file at its root.
uname -a
Prints all of the kernel/machine information.
rpm -q
Queries a package to determine if it is already installed on an rpm based system.
rpm -rebuild
Rebuilds a package with rpm.
rpm --rebuilddb
Rebuilds the rpm database.
&>
Redirect standard error & standard output
2>
Redirect standard error to a file.
>
Redirect the output of a command to a file.
yum remove
Removes a package. Same as yum erase.
yum erase
Removes a package. Same as yum remove.
nohup
Run a command immune to hangups, with output to console or non-tty
fsck -N
Run fsck without executing; just show what would be done
4
Run level ___ is uaully undefined and available for customization.
6
Run level ___ is used to reboot the system.
0
Run level ___ will shutdown and power off the system.
||
Run the command only if the previous command fails or results in error.
&
Run the previous command in the background.
rpm --checksig
Same as rpm -K: checks the package signature.
shutdown -k
Sends a warning message that the machine will be shutdown, but doesn't acutally shutdown the machine. Warning message only.
chmod 4770 file.txt
Set the permissions of file.txt to read/write/execute for the user and group, no permissions for other, and setuid.
rpm --prefix
Sets the specified path for installation with rpm.
free
Show free memory and swap.
blkid
Shows the UUID for devices.
rpm -qR
Shows the dependencies of the specififed package with rpm
rpm -qv
Shows the version of the specified package with rpm. Could be used to show if the specified package is already installed.
shutdown -h
Shutdown command to halt, or power off the system.
shutdown -P
Shutdown command to power off the machine.
shutdown -r
Shutdown command to reboot the machine after shutting down.
SIGSTOP 17, 19, 23
Signal to stop the process ... When a child process exits from a parent process it sends signal 1.
apt-get -f
Since dpkg doesn't automatically install dependencies, this command will download and install missing dependencies and complete the post-installation script that failed from a dpkg -i command.
SIGTERM 15
Termination signal. It asks the program to finish what it is doing and then exit. The preferred way of killing processes.
apt-get -s
This command will simulate the installation of a package without actually installing it, on a Debian based system
quotaon
This command will turn on user disk quotas.
chattr +s
The command to assign the secure deletion attribute, a file with this attribute will be unrecoverable when deleted.
0x83
The common type code for Linux file system.
0x82
The common type code for Linux swap.
0x07
The common type code for NTFS is ____.
/boot/grug/menu.lst
The configuration file for grub1 is located at:
1
The initial program gets the process ID (pid) of __.
kernel
The main part of the Linux operating system, responsible for the entire OS.
/media
The new mount point for removable media, again this is split it to subdirectories for each of the mounted file system
/mnt
The traditional mount point for removable media; this is usually split in to subdirectories for each of the then mounted file systems
uptime
This command will display the uptime and load average.
apt-get autoremove
This apt-get command will remove packages that are no longer needed for various reasons that did not get cleaned up as part of post-install.
apt-get remove
This apt-get command will remove whatever packages that you indicate, as well as any dependencies that are no longer needed by other packages.
init
This command can be used to change the run level or shutdown a machine. It is the last process to run in the boot process.
unexpand
This command converts spaces to tabs.
tune2fs
This command llows you to change the file system parameters such as: maximum mount count, time between checks, add a journal, set desire reserve blocks, obtain file system level.
ldd
This command prints shared library dependencies for the indicated proram or file.
ps aux
This command will display all running processes and their PID numbers.
jobs
This command will display minimal information about processes associated with the curent sesion.
/var/log/messages
This directory contains detailed post boot messages for your system as well as messages/errors/information from applications that communicate with your kernel, kernel modules (drivers, etc.) -- often referred to as the container of "global system messages."
/etc
This directory contains system configuration files.
/usr/lib/systemd/system
This directory contains the core system unit configuration files.
/boot
This directory holds important boot files, like the Linux kernel, initial RAM disk, and usually boot loader config files
dpkg -L
This dpkg command lists all the files that wre installed along with the package name as well as their location on the system.
dpkg -C
This dpkg command searches for partially installed packages and will suggest what to do with them. --audit
/etc/shadow
This file holds encrypted passwords.
/etc/apt/sources.list
This file stoes the repository locations that apt uses to search for packages specific to your system.
fsck -a
This fsck command will attempt to automatically repair all errors.
fsck -A
This fsck command will walk through /etc/fstab file and try to check all file systems
/dev
This holds device files, which in turn provides low-level access to the systems hardware
/root
This is the root users home directory this is different than the / folder that is also pronounced root
shutdown -c
This shutdown command will cancel an impending shutdown.
shutdown -f
This shutdown command will tell the system to skip fsck on the next book.
&>>
To append standard error & standard output
cat
Tool used to combine files (concatenate)
true
True or False: If you remove the source file on a hard link, then the link file will still exist.
mkswap
Turns a file system into swap space.
swapoff
Turns off swap on a partition being used for swap.
rpm --query --info
Which RPM command will show detailed information on a package?
rpm -e
Uninstalls a package with rpm. (Think erase from a system, or extraxt).
rpm -U
Upgrades or installs a NEW package with rpm.
dpkg
Used to manually install .deb packages outside of a repo.
/home
Users' home directories. By separating this directory in to its own low-level file system you effectively isolates most user data form the operating system - which is useful if you want to re install the OS without losing user data
rpm -a
Verifies all packages on an rpm based system.
head -c 1028
What command could I run to output the first 1028 bytes of a file to standard output?
uniq -d
What command could be run to print duplicate lines in a file?
du -h --max-depth 1 /home
What command could you run to estimate file space usage in your user's home directory. Include options to make it human readable and to keep from listing all of the subdirectories in your home directory.
export
What command is used to set environment variables?
sed 's/ugly/beautiful/g' myfile.txt | tee >> newfile.txt
What command should I run to replace all the instances of 'ugly' with 'beautiful' in myfile.txt, send it to standard output, and then append it to newfile.txt?
expand
What command would you run to convert tabs into spaces?
rpm2cpio file.rpm | cpio -dium
What command would you run to extract the files from an rpm package without installing the package.
join -t: -j hello
What command would you run to join two files with the specified delimitor of : and the same field of "hello" in both files?
init 1
What command would you use to change the run level to one?
tail
What command, similar to head, will output the last part of a file?
LD_LIBRARY_PATH
What is the Bash environment variable that determines additional library locations to be searched when looking for shared libraries.
apt-get update
What is the apt-get command that updates the repository list cache, making available packages for installation from any of those configured in the repositories.
-20
What is the highest priority niceness?
/etc/ld.so.conf
What is the location of the file that stores shared library paths for caching with ldconfig?
/usr/lib/rpm/rpmrc
What is the location of the rpm configuration file.
19
What is the lowest priority niceness?
id:2:initdefault
What would you add to /etc/inittab to set the defualt run level to 2?
-q
What would you pass to apt-get for it to run quietly? apt-get __
&&
When placed in between two commands, the second will only execute if the first completes successfully.
/boot/grub/grub.cfg
Where is the configuration file for grub2 located?
1
___ or Single user mode is the run level used for low level system maintenance, such as resizing partitions.
0x0c
____ is the common type code for FAT.
0x0f
____ is the newer common type code for extended partitions.
0x05
____ is the old common type code for extended partitions.
DMA
______s are an alternate method of communication with I/O ports.
dist-upgrade
apt-get ______________ will, in addition to performing the fuctions of apt-get update, will also intelligently handle changing dependencies with the new versions of packages.
apt-get check
apt-get command to check to make sure that all application dependencies have been install for all packages.
dpkg-reconfigure
dpkg command to reconfigure a package. Useful if you have messed up the configuration files somehow.
dpkg --get-selections
dpkg command to show all installed packages on the system. Can be piped to grep to filter.
initctl list
list all jobs located in /etc/init this does not list service files in /etc/init.d
5
man page for file formats and conventions, eg, /etc/passwd
6
man page for games
9
man page for kernel routines (non standard)
3
man page for library calls (functions within program libraries)
7
man page for mixcellaneous (including macro packages and conventions
4
man page for special files (usually found in /dev)
8
man page for system administration commands (usually only for root user)
rpm -b
rpm command to build a binary package.
rpm -qa
rpm command to print all installed packages.
rpm -f
rpm command to show which pacakes owns the specified file.
rpm -F
rpm command to upgrade a package, but only if an older version exists.
rpm -qi
rpm command to verify that a package is installed.
cpio
rpm packages are built from ____ archives.
yum resolvedep
yum command to resolve dependencies.
yum update
yum command to update the whole system.
yum upgrade
yum command to upgrade the system. Forces the removal of obsolete packages. It is interchangeable with yum update --obsoletes.