LPI 101-500 LPIC-1 Linux Administrator Exam Flashcards
what file in the users home directory contains Bash history
.bash_histfile
a debian package creates several files during its installation. What command searches for packages owning /etc/debian_version?
find /etc/debian_version -dpkg
what expression represents a single upper-case letter
[A-Z]
the command dbmaint was used to run in the background. However, dbmaint is terminated after logging out of the system. What alt dbmaint invocation lets it continue to run even when the user running the program logs out
bg dbmaint
what umask value ensures that new directories can be read, written and listed by their owning user, read and listed by their owning group and not accessible at all for everyone else.
0027
yum repository configs can include these
$basearch or $releasever
in case /etc/yum.repos.d contains files, /etc/yum.conf is ignored
if /etc/yum_repose.d contains files then this file will be ignored
/etc/yum_conf
Wildcard characters will match following file names
ttyS0
ttyS1
ttyS2
tty?[0-5]
tty[A-Z][012]
what is a valid reason to not use hard links
because they are not available on all linux systems and filesystems like ext4 do not support them
vi command deletes two lines, the current and following line
2dd
command list all files and directories within the /tmp/ directory and its subdirs that are owned by root user
find /tmp -user root -print
find -path /tmp -user root -print
this can use and read certain file systems and is stored in a special area within the GPT metadata
UEFI firmware
command displays the output of the foo command on the screen and also writes it to a file called /tmp/foodata
foo | tee /tmp/foodata
command redirects the output of ls to standard error
ls > &2
what should be changed when a linux vm is cloned
permissions of /root/
SSH host keys
what command changes all CR-LF line breaks in the text file userlist.txt to Lunux standard LF breaks and stores the result in lewlist.txt
tr -d ‘\r’ < userlist.txt > newlist.txt
given the following input stream
txt1.txt
atx.txt
txB.txt
what regular expression turns this input stream into the following output
tx1.bak.txt
atxt.bak.txt
txB.bak.txt
s/txt/bak.txt/
command displays the path to the executable file that would be executed when the command foo is invoked?
lsattr foo
considering this directory
drwxrwxr-x 2 root sales 4096 Jan 1 15:21 sales
what command ensures that files created wihin the directory sales are owned by the group sales
chgrp -p sales sales
chmod 2775 sales
daemon that handles power management events on linux system
acpid
default % of reserve space for root user on new ext4 filesystems
5%
what does the mount –bind do
makes contents of one directory available in another directory
command uninstalls a package but keeps its config in case the package is reinstalled
dpkg -r pkgname
command displays the current disk space usage for all mounted file systems
du
apt-get subcommand installs the newest version of all currently installed packages
update
lists dependencies of the RPM package file foo.rpm
rpm -qpR foo.rpm
valid stream redirection operators in Bash
<
2>&1
first program the linux kernel starts at boot time when using System V init
/sbin/init
when redirecting the output of find to the xargs command, what option to find is useful if the filenames contain spaces
-print0
when is content of kernel ring buffer reset
using dmesg –clear
when system is shut down or rebooted
what is contained on the EFI System Partition
first stage boot loader
what is true about this command
ls > files
if it does not exist
the file is created and contains the output of ls
file loga.log with timestaps of format DD/MM/YYY:hh:mm:ss
what command filters out all log entries in the time period between 8:00 am and 8:59 am?
grep -E ‘:08:[0-9]+:[0-9]+’ loga.log
what happens in boot sequence of PC using BIOS
some parts of the boot proccess can be configured from the BIOS and the BIOS initiates the boot process after turning the computer on
program runs a command in specific intervals and refreshes the display of the program’s output
watch
command must be entered before exiting vi to save the files as filea.txt
:w filea.txt
directories on 64 bit linux system typically contain shared libs
~/.lib64/
/lib64/
true when a file system that is neither listed in /etc/fstab nor known to system is mounted manually
cmd systemctl mountsnc can be used to create a mount unit based on the existing mount
command prints list of usernames (first column) and their primary group (fourth column) from /etc/passwd file
cut -d :-f 1,4 /etc/passwd
cmd installs all packages with a name ending with the string foo
zypper install “*foo”
cmd installs GRUB 2 into MBR on third hard disk
grub-install /dev/sdc
a faulty kernel module is causing issues with a nic so what action ensures that the module is not loaded automatically when the system boots
adding a black line including the name of the offending module to the file
/etc/modprobe.d/blacklist.conf
exists in standard GRUB 2 install
/boot/grub/i386-pc/1vm.mod
/boot/grub/grub.cfg
output displayed when user fred exececutes echo fred $USER
fred fred
cmd ls -i
how would new file named c.txt be created with same inode number as a .txt (Inode 525385)
ln a.txt c.txt
in bash inserting 2>&1 after a command redirects
standard output to standard error
filesystem created by mkfs when it is executed with the block device name only and without any additional parameters
ex2
after moving data to new filesystem how can the former path of the data be kept intact in order to avoid reconfig of existing apps
by create symbolic link from old to new path of data and by mounting new filesystem on the original path of the data
cmd used to display inode number of given file
ls
this system config file is commonly used to set default runlevel
/etc/inittab
cmd enables setuid (suid) permission on the executable /bin/foo
chmod 4755 /bin/foo
command reads standard input (STDIN) and builds up command lines to execute
xargs
where does BIOS search for bootloader
on all connected storage media in the defined boot device order
purpose of the Filesystem Hierarchy Standard
FHS
it is a distribution neutral description of locations of files and directories
pressin Ctrl-C combination on the kb while cmd is executing in the foreground send this signal
2(SIGINT)
modes of VI editor
insert mode
command mode
cmd uninstall a package but leave its config files in case the pkg is re-installed
dpkg -r pkgname
permission and ownership of the file /etc/passwd
-rw-r–r–1 rootroot531 Jun 5 22:45 /etc/passwd
cmd makes /bin/foo executable by everyone but writeable only by its owner
chmod u=rwx,go=rx /bin/foo
when using regular expressions what character match beginning of a line
cmd changes nice level of running process
renice
cmd used to locate programs and their corresponding man pages and config files
whereis
device file name for second partition on the only SCSI drive
/dev/sda2
cmd instructs SysVinit to reload its config file
telinit q
program updates database used by locate command
updatedb
default signal send by kill cmd
SIGTERM(15)
cmd line creates on incase it already exists, overwrites a file called data with the output of ls
ls > data
utility would be used to chang how often a filesystem check is performed on an ext2 filesystem without losing any data stored on that filesystem
tune2fs
cmd changes the number of days before ext3 filesystem on /dev/sda1 has to run through a full filesystem check while booting
tune2fs -i 200 /dev/sda1
cmd converts spaces in file to tab characters and prints the result to standard output
unexpand
file from /proc file system contains list of all currently mounted devices
mounts
cmd line ending with a & character
the command is run in background of the current shell
apt-get cmd will install newest version of all currently installed packages
dist-upgrade
settings for umask ensures that new files have the default permissions
rw-r—–
0027
shell commands makes already defined var TEST visible to new child processes
export TEST
set sticky bit for the directory /tmp
chmod +t /tmp
chmod 1775 /tmp
GRUB install all required files and configures the boot loader on device/dev/sda
grub-install /dev/sda
cmd changes metadata and option for ext3 filesystem
tune2fs
how many fields are in a sytactically correct line of /etc/fstab
6
why does creating a hard link to an ordinary file return an error
the source and target are on different filesystems
cmd updates already installed RPM package rpmname
rpm -U rpmname
file in /proc describes IRQs that are used by various kernel drivers
interrupts
how is symbolic link called bar.conf pointing to foo.conf created
ln -s foo.conf bar.conf
correct order in which the components of system boot process are started
BIOS, bootloader, kernel, init system
what do permissions -rwSr-xr-x mean for a binary file when it is executed as a command
the command will be executed with the effective rights of the owner and group
ensures all file systems listed with the option auto in /etc/fstab are mounted
mount -a
cmd loads a kernel module along with any required dependency modules
modprobe
when piping output of find to the xargs command what option to find is useful if the filenames have spaces in them
-print0
cmd will change quota for specific user
edquota
cmd changes all occurrences of word “bob” in a file data to “Bob” and prints the result to standard output
sed ‘s/b0b/Bob/g’ data
filesystems used on linux root partitions
ext3
swap
limitation of cut cmd
it cannot reorder fields
permissions belong to symbolic link
lrwxrwxrwz
option of the tee cmd will cause the output to be contatenated on the end of the output file instead of overwriting the existing file contents
-a
cmd creates a swap space on a block device or file
mkswap
cmd reads and displays the current contents of the Kernel Ring Buffer on the cmd line
dmesg
cmd prints a list of available package updates when using RPM-based package management
dpkg check-update
after creating a hard link called bar to the ordinary file foo, foo is deleted from the filesystem
so what is resulting situation
foo would be removed while bar would remain accessible
cmd will print imprtant system info such as kernel version and machine hw architecture
uname
partition type used for linux swap spaces when partitioning hard disk drives
82
cmd creates ext3 filesystem on /dev/sdb1
/sbin/mke2fs -j /dev/sdb1
/sbin/mkfs -t ext3 /dev/sdb1
what info is changed on a file when a hard link pointing to that file is created
link count
linux filesystems preallocates a fixed number of inodes at the filesystem’s make/creation time and does NOT generate them as needed.
ext2
ext3
how can the list of files that would be installed by RPM package file file apache-xml.rpm be previewed
rpm -qpl apache-xml.rpm
cmd used to query info about available packages on Debian system
apt-cache
have same permissions and owner
share same inode
must be on same filesystem
hard linked files
cmd used to create an initialize the files used to store quota info
quotacheck
cmd used to start another cmd with given nice level
nice
statement describes a diff between GNU GRUB Legacy and GRUB 2
partition numbers start at 0 in GRUB Legacy
partition numbers start at 1 in GRUB 2
cmd changes ownership of file.txt to the user dan and the group staff.
chown dan:staff file.txt
Filesystem Hierarchcy Standard (FHS)
where should binaries that have been compiled by the sys admin be placed in order to be made available to all users on the system
/usr/local/bin/
prints working directory when using Bash shell
pwd
echo “${pwd}”
cmd used to search for the executable file foo when it has been placed in a directory not included in $PATH
query
process ID number of the init proccess on a SysV init based system
1
cmd shows the definition of a given shell cmd
type
vi
cmd will copy (but not paste) from the current line at the cursor and the following 16 lines (17 lines in total)
17yy
cmd mounts all filesystems listed in /etc/fstab that have the option auto set
mount -a
to display all mounted filesystems what cmds could be used
cat /proc/self/mounts
mount
cmd will change the ownership to dave and the group to staff on a file named data.txt
chown dave:staff data.txt
VI
cmd will change all CR-LF pairs in an imported text file, userlis.txt to Linux standard LF characters and store it as newlist.txt
tr -d ‘\r’ < userlist.txt > newlist.txt
option must be passed to a filesystem’s entry in /etc/fstab in order to mount the file system without root privileges
user
instead of supplying an explicit device in /etc/fstab for mounting what options maby used to id the intended partition
LABEL
UUID
cmd shows all shared libs required by a binary executable or another shared library
idd
SysV init config file commonly used to set the default run level
inittab
cmd will display inode usage of each mounted file system
df -i
common cmds for file management
mv
cp
in compliance with FHS in what directory are doc files found
/var/share/doc
cmd will mount an already inserted CD-ROM in /dev/sr0 onto an existing directory /mnt/cdrom when issued with root priv
mount -t cdrom /dev/sr0 /mnt/cdrom
cmd used to modify quota settings
edquota
after running umount /mnt the following error is displayed
umount: /mnt: device is busy
what is the common reason for the message
a user has an open file in the /mnt directory
umask
value will result in default access permissions of
600 (rw——-) for files
700 (rwx—–) for directories
0077
007
you are trying to make a hard link into an ordinary file but it returns an error
the source and the target are on different filesystems
VI
what happens when you issue the vi cmd without any parameters
vi starts in command mode and opens a new empty file
cmd sets the Bah var named TEST with the content FOO
TEST=”FOO”
from a bash shell which cmd directly executes the instructions from the file
/usr/local/bin /runme.sh
without starting a subshell
source /usr/local/bin/runme.sh
./usr/local/bin/runme.sh
cmd used in Linux env to create new env
mkdir /usr/bin/mkdir
lists currently mounted devices
/etc/mtab file
cmd kills the process with the PID 123 but allows the process to “clean up” before exiting
kill -TERM 123
default action of the split cmd on an input file
breaks file into new files of 1,000 line pieces each
cmd will generate a list of user names from /etc/passwd along with their login shell
cut -d: -f1.7 /etc/passws
cmd used to continue background execution of a suspended cmd
bg
regular expression
what does ? represent
match the prceeding qualifier zero or one times
shell redirection will write standard output and standard error output to a file named filename
> filename 2>&1
cmd displays the contents of the gzip compressed tar archive
tar ztf archive.tgz
output of following cmd
echo “Hello World”| tr -d aeiou
Hll Wrld
signal is missing from the following cmd that is commonly used to instruct a daemon to reinitilize itself including reading config files
HUP, SIGHUP,1
given cmd line
echo “foo bar”| tee bar | cat
what output is created
foo bar
valid stream redirection operators with Bash
<
«<
>
cmd sends output form program myapp to both stdout and the file file1.log
myapp | tee file1.log
vi
immediately after deleting 3 lines of text in and moving the cursor to a different line, which sing character cmd will insert the deleted content below the current line
p (lowercase)
variable that defines the directories in which a bash shell searches for executable cmds
PATH
cmd displays a list of all background tasks running in the current shell
jobs
cmd will reduce all consecutive spaces down to a single space
tr -s ‘‘<a.txt> b.txt</a.txt>
cmd prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file
cut -d: -f 1,4 /etc/passwd
when starting a program with nice cmd without any additional params what nice level is set for the resulting process
10
when running the command
sed -e “s/a/b/” /tmp/file > /tmp/file
while /tmp/file contains data why is /tmp/file empty afterwards
when the shell establishes the redirection it overwrites the target file before the redirected cmd starts and opens it for reading.
cmd moves and resumes in the background that last stopped shell job
bg
VI
what is the diff between i and a cmds
i (insert) inserts text before the current cursor position whereas a (append) inserts text after the cursor.
cmd used to change options and positional params for a running bash
set
cmd will print the last 10 lines of a text file to the standard output
tail -n 10 filename
purpose of the bash built-in export cmd
sets up env vars for apps
why run a cmd in the background of your shell
cmd has to run immediately but the user needs to log out
character added to the end of a cmd runs that cmd in the background as a child process of the current shell
&
what can be said about the cmd
foo 1 > bar
stdout from cmd foo is appended to the file bar and the cmd foo receives its stding from the stdout of the cmd bar
vi
saves opened document and exits the editor
esc ZZ
esc :wq!
what is max niceness value that a regular user can assign to a process with the nice command when executing a new process
19
nested directory structure
which find cmd would be used to restrict the cmd to searching down a particular number of subdirectories
-maxdepth
nice -5/user/bin/prog
what can be said about this
/usr/bin/prog
executed with nice level of 5
vi
while editing a file the file changes due to another process. without exiting vi how can the file be reopened for editing with the new content
:e
default nice level when a process is started using the nice cmd
10
cmd determines the type of a file by using a def db file that contains info about all common file types
file
cmd prints all files and directories within the /tmp directory or its subdirectories that are also owned by user root
find /tmp -user root -print
find /tmp -user root
cmd can be used to create a USB storage media from a disk image
dd
in bash inserting 1>&2 after a command redirects it to
standard output to standard error
VI
cmd will copy the current line into the vi buffer
yy
what does the + symbol mean in the following grep regular expression
grep ‘^d[aei]+d$’ /usr/share/dict/words
match the preceeding character set ([aei]) one or more times
cmd replaces each occurrence of ‘bob’ in the file letter with ‘Bob’ and writes the result to the file newletter
sed ‘s/bob/Bob/g’ letter > newletter
cmd will NOT update the modify timestamp on the file /tmp/myfile.txt
file /tmp/myfile.txt
which characters can be combined with a separator string in order to read from the current input source until the separator string that is on a separate line and without any trailing spaces is reached
«
cmds can be used to determine how long the system has been running
uptime
top
cmd will print only the lines that do not end with a / in the file foo
grep -v ‘/$’ foo
vi
how can cmds such as moving the cursor or copying lines into the buffer be issued multiple times or applied to multiple rows
by specifying the number right in front of a command such as 4l or 2yj
which following signals is sent to a process when the key combo CTRL+C is pressed on the kb
SIGINT
user accidentally created the subdirectory \dir in his home directory so what cmd will remove it
rmdir ~/\dir
which bash env var defines what file the user history is stored when exiting a bash proccess
HISTFILE
file located in the home directory is used to store the Bash history
.bash_history
in compliance with FHS which directories are man pages found
/usr/share/man
what is the effect of the egrep cmd wthe -v option is used
it outputs only non-matching lines
when using rpm –verify to check files created during the install of RPM packages what info is taken into consideration
Timestamps
MD5 checksums
File sizes
env var overrides or extends the list of directories holding shared libraries
LD_LIBRARY_PATH
RPM command will output the name of the package which supplied file /etc/exports
rpm -qf /etc/exports
env var will you assign or append a value if you need to tell the dynamic linker to look in a build director for some of a program’s shared libraries
LD_LIBRARY_PATH
option used in GRUB legacy config file to define the amount of time that the GRUB menu will be shown to the user
timeout
after modifying GNU GRUB’s config file, what cmd must be run for the changes to take effect
No action is required
following cmd can be used to perform a full text search on all availalble packages on a Debian system
apt-cache
you want to preview where the package file apache-xml.i386.rpm will install its files before install it so what cmd do you use
rpm -qpl apache-xml.i386.rpm
cmd will ask config questions for a specified package just as if the package were being installed for the first time
reconfigure
cmd overwrites the bootloader located on /dev/sda without overwriting the partition table or any data following it
dd if=/dev/zero of=/dev/sda bs=440 count=1
to prevent users from being able to fill up the / partitions this directory should be on a separate partition if possible as it would be writeable
/tmp
tmp
Debian package management tool asks the config questions for a specific, already installed package just as if the package were being installed for the first time
dpkg-reconfigure
file should be edited to select the network locations from which Debian install package files are loaded
/etc/dpkg/dselect.cfg
what is the name of the main config file for GNU GRUB
menu.lst
grub.conf
grub.cfg
cmd lists the dependencies of a given dpkg package
apt-cache depends package
when removing a package which of the following dpkg options will completely remove the files including config files
–purge
which apt-get cmd will install the newest versions of all currently installed packages without removing any packages or installing new packages that are not already installed
upgrade
world-writeable directory should be placed on a separate partition in order to prevent users from being able to fill up the / filesystem
/tmp
tmp
/var/tmp
an admin has issued the following cmd
grub-install –root-directory=/custom-grub /dev/sda
in what directory will new config files be found
/custom-grub/boot/grub
cmd lists all currently installed packages when using RPM package management
rpm –query –all
cmd can be used to download the RPM package kernel without installing it
yumdownloader kernel
directory must definition files be placed to add additional repositories to yum
/etc/yum.repos.d
what is correct about mount points
every existing directory can be used as a mount point
dynamically changes the size of logical volumes, creates snapshots and can dynamically create or delete logical volumes
Logical Volume Manager (LVM)
option to the yum command will update the entire system
update
upgrade
cmd will disable swapping on a device
swapoff
/sbin/swapoff
dpkg cmd that removes programs
–remove
dpkg cmd that removes config files
–purge
which function key is used to start Save Mode in WIndows NT
Windows NT does not support Safe Mode
cmd updates the linker cache of shared libraries
idconfig
which top level system directory is used for files and data that change regularly while the system is running and are to be kept between reboots
/var
cmd is used to update the list of available packages when using dpkg based package management
apt-get update
during system boot cycle what is the program that is run after the BIOS completes its task
bootloader
what is true about /proc
all changes to files in /proc/ are immediately recognized by the kernel
info stored within BIOS
Boot device order
H/W config
you suspect that a new ethernet nic card might be conflicting with another device. what file should you check within /proc tree to learn which IRQs are being used by which kernel drivers
interrupts
/proc/interrupts
USB device filesystems can be found und
/proc/bus/usb/
option for kernel command line changes the systemd boot target to resue.target instead of the default target
systemd.unit=rescue.target
your having some trouble with disk partition and you need to do maintenance on this partition but your users home directories are on it and several are logged in. Which cmd woud disconnect the users and allow you to safely execute maintenance tasks
telinit 1
cmd reboots the system when using SysV init
shutdown -r now
telinit 6
kernel parameter instructs the kernel to suppress most boot messages
quiet
init systems used within Linux systems
systemd
Upstart
SysV init
the message “Hard Disk Error” is displayed on the screen during Stage 1 of the GRUB boot process so what does that mean?
the next State cannot be read from the hard disk because GRUB was unable to determine the size and geometery of the disk
SysV init config file should be modified to disable the ctrl-alt-delete key combo
/etc/inittab
during a system boot cycle, what program is executed after the GIOS completes its tasks
bootloader
first program that is usually started at boot time by the Linux kernel when using SysV init
/sbin/init
cmd brings a system running SysV init into a state in which it is safe to perform maintenance tasks
init 1
telinit 1
cmd to display message from the kernel that were output during the normal boot sequence
dmesg
/bin/dmesg
how can additional rules for udev can be created
by adding them to /etc/udev/rules.d/
filesystem of type tmpfs and is mounted by udev during system startup
the /dev/ directory
run levels should never be declared as default run level when using SysV init
0
6
what does lspci command display about the system hw
Device IRQ settings
PCI bus speed
Device vendor identification
cmd will write a msg to the terminals of all logged users
wall
file in /proc filesystem lists params passed from the bootloader to the kernel
cmdline
/proc/cmdline
cmd displays the contents of the Kernel Ring Buffer on the command line
dmest
/bin/dmesg
the system is having trouble and the engineer wants to bypass the usual /sbin/init start up and run /bin/sh what is the usual way to pass this change to the kernel from your boot loader
Pass init=/bin/sh on the kernel parmameter line