Tuesday the 2nd of October I will do my first step into the world of a qualified Linux Professional.
I am invited to show my skills at the LPI 101 exam – in the testing center Auldhouse Computer Training. But I still forget a lot of simple stuff that I will collect here to make myself mental notes:
In the Bash shell, entering !! has the same effect as which one of the following?
- Ctrl-P and Enter
Which of the following commands can be used to check an ext2 filesystem? Select three that apply.
- fsck /dev/hda5
- e2fsck /dev/hda5
- fsck.ext2 /dev/hda5
Carolyn has a text file named guest_list containing 12 lines. She executes the following command. What is the result?
# split -4 guest_list gl
- The lines of guest_list are evenly divided among new files glaa, glab, and glac.
An ext2 filesystem is configured with user quotas enabled. The soft limit is set at 100 MB per user, the hard limit is set at 110 MB per user, and the grace period is seven days. User bsmith already owns 90 MB of the data stored on the filesystem. What happens when bsmith writes a new file of size 30 MB? Select one.
- The write will continue until the hard limit of 110 MB is reached, after which the write fails and data is lost.
Which of the following commands displays the comments from a bash script? Select all that apply.
- sed ‘/^#/ !d’ /etc/rc.d/init.d/httpd
- grep ^# /etc/rc.d/init.d/httpd
(find and locate do not search the contents of files. /etc/passwd is not a script)
State the syntax to direct the standard output of cmd1 directly into the standard input of cmd2.
- cmd1 | cmd2
Which one of the following answers creates an environment variable VAR1, present in the environment of a bash child process?
- VAR1=”fail” ; export VAR1
(The variable must be set and exported. The semicolon separates the two commands.)
Which of the following directories must be part of the root filesystem? Select two of the following that apply.
(/etc, /lib, /bin, /sbin, and /dev must be in the / filesystem.)
Alex is currently working in a directory containing only one file, Afile1. What is displayed after the following commands are entered in bash?
# echo $MYVAR “$MYVAR”
- ls ls $MYVAR Afile1
(The first echo argument is unquoted and thus returns its contents, ls. The second is quoted with double quotes, which do not preserve the $, so it too returns ls. The third is quoted with single quotes, which do preserve the $, so it returns the string $MYVAR. The last argument is backquoted, which means that it returns the result of the command stored in $MYVAR. The command is ls, which displays the only file in the directory, Afile1.)
Which one of the following outcomes results from the following command?
- The SGID bit will be set for /home/software, in order to keep group membership of the directory consistent for all files created.
(The g indicates that we’re operating on the group privilege, and the +s indicates that we should add the “set id” bit, which means that the SGID property will be applied.)
What command can display the contents of a binary file in a readable hexadecimal form? Select one.
(The octal dump program, when used with the -t x option, will output in hexadecimal notation.)
Which one of the following commands copies files with the .txt extension from /dir1 into /dir2, while preserving file attributes such as dates?
- cp -p /dir1/*.txt /dir2
(The -p, or preserve, option is required to retain dates.)
With a umask of 027, how is the initial mode set for a newly created file?
- 0640 (b)
(By default, files do not have the execute privilege, which rules out all responses containing odd numbers in the mode. They also do not by default have the sticky bit set, which eliminates response e. Response b is the result of masking initial bits 666 with umask 027, leaving 640, which is the same as 0640.)
Alex wants to protect himself from inadvertently overwriting files when copying them with cp. How should he go about this?
- Put alias cp=’cp -i’ in ~/.bashrc.
- or Put alias cp=’cp -i’ in ~/.bash_profile.
(cp should be aliased to the interactive mode with the -i option in .bashrc. .bash_profile normally doesn’t include aliases, but it will also work.)
Which one of the following is an accurate statement regarding this regular expression?
- It matches 9, 0, and other nonletter and nonnumber characters.
With regard to the use of regular expressions to match text in a file, describe a metacharacter. Select one.
- Metacharacters aren’t used in regular expressions.
(A metacharacter is a special character that is used to modify and control the interpretation of literals. File globbing is generally considered distinct but very similar to the use of regular expressions.)
How can you query the RPM database for a list of all installed RPM packages? Select one.
- The query mode is required, which implies -q. The -a option in query mode yields all packages.
Which pair of dpkg options are equivalent and what do they do? Select one.
- -C and –audit; they search for partially installed packages.
What will happen when rpm is launched as follows?
rpm -Uvh file
- Provided that file is an RPM file, the -U indicates that an upgrade should occur. -h turns on hash marks.
When using xdm, which of the following files can be used to start a window manager? Select one.
How can you obtain a list of files contained in an .rpm file? Select one.
- rpm -qlp queries and lists files in the package.
Which of the following accurately describes the contents of the xdisp:1.0 DISPLAY environment variable? Select one.
- The system, xdisp, will display programs on the second display of its X server.
Which is not a valid dpkg installation command? Select one.
- b. Options -i (install) and -L (list installed files) are incompatible and don’t make sense together.