Linux Chapter 2
Which of the following umask values will result in files with rw-r----- permissions? A. 640 B. 210 C. 022 D. 027
027
To simplify access to a directory with a long path, /opt/clipart/standard/office/ products, you want to create a link. You type ln /opt/clipart/standard/ office/products ./ca, but you receive an error message. How must you change this command to make it work? A. Change ln to mv. B. Change ./ca to ./products. C. Add -s after ln. D. Add / after products, with no intervening space.
Add -s after ln.
You type mkdir one/two/three and receive an error message that reads, in part, No such file or directory. What can you do to overcome this problem? (Choose all that apply.) A. Add the --parents parameter to the mkdir command. B. Issue three separate mkdir commands: mkdir one, then mkdir one/two, then mkdir one/two/three. C. Type touch /bin/mkdir to be sure the mkdir program file exists. D. Type rmdir one to clear away the interfering base of the desired new directory tree.
Add the --parents parameter to the mkdir command. Issue three separate mkdir commands: mkdir one, then mkdir one/two, then mkdir
Who may set default environment variables for an ordinary user? A. Either root or the user, with the user's settings taking precedence B. Either root or the user, with root's settings taking precedence C. root only D. The user only
Either root or the user, with the user's settings taking precedence
Where is the best location for the current directory indicator (.) to reside in root's PATH environment variable? A. Before all other directories B. After all other directories C. Nowhere; it shouldn't be in root's path D. Wherever is convenient
Nowhere; it shouldn't be in root's path
After using a text editor to create a shell script, what step should you ordinarily take before using the script? A. Set one or more executable bits using chmod. B. Copy the script to the /usr/bin/scripts directory. C. Compile the script by typing bash scriptname, where scriptname is the script's name. D. Run a virus checker on the script to be sure it contains no viruses.
Set one or more executable bits using chmod.
Which of the following procedures normally launches a shell? (Choose all that apply.) A. Starting an xterm window. B. Typing shell at a command prompt. C. Logging in using SSH. D. You can't; the shell is started automatically at boot time.
Starting an xterm window. Logging in using ssh
What key does the Bash shell use to complete filenames based on the first few characters? A. End B. Tab C. Enter D. Insert
Tab
Which of the following file-location commands is likely to take the most time to find a file that might be located anywhere on the computer? A. The find command. B. The locate command. C. The whereis command. D. They're all equal in speed.
The find command.
Youwanttomoveafilefromyourharddisktoafloppydisk.Whichofthefollowingistrue? A. You'll have to use the --preserve option to mv to keep ownership and permissions set correctly. B. The mv command will adjust filesystem pointers without physically rewriting data if the floppy uses the same filesystem type as the hard disk partition. C. You must use the same filesystem type on both media to preserve ownership and permissions. D. The mv command will delete the file on the hard disk after copying it to the floppy.
The mv command will delete the file on the hard disk after copying it to the floppy.
You want to learn about the /dev/tty device file, so you type man tty. This action, how- ever, produces information on the tty command, which displays the name of the terminal device from which it was called. How would you obtain the documentation you wanted? A. Type man /dev/tty. B. Type man 2 tty. C. Type man 4 tty. D. Type man tty device.
Type man 4 tty.
Which of the following wildcards will match the filenames scan.txt, Skin.txt, and skin.txt but not scan.odt, skin.TXT, or skinny.txt? A. *.* B. s*.txt C. [Ss]*n.txt D. s??n*
[Ss]*n.txt
You want to find the documentation for a Linux scanner program, but you can't remember the name of the software. What command might you type to help you track down the docu- mentation? A. info scanner B. help scanner C. apropos scanner D. find scanner
apropos scanner
Which of the following commands would you type to change the group associated with the modes.tex file to marketing? A. chgrp modes.tex marketing B. chgrp marketing modes.tex C. group modes.tex marketing D. newgrp modes.tex marketing
chgrp marketing modes.tex
What command would you type to change the ownership of somefile.txt from ralph to tony? A. chown ralph:tony somefile.txt B. chmod somefile.txt tony C. chown somefile.txt tony D. chown tony somefile.txt
chown tony somefile.txt
Which of the following will add /usr/local/bigprog/bin to the end of the PATH environ- ment variable, if placed in /etc/profile? A. export PATH=/usr/local/bigprog/bin B. setenv PATH=$PATH:/usr/local/bigprog/bin C. export PATH=$PATH:/usr/local/bigprog/bin D. setenv PATH "${PATH}:/usr/local/bigprog/bin"
export PATH=$PATH:/usr/local/bigprog/bin
Which of the following commands would you type to print lines from the file world.txt that contain matches to changes and changed? A. grep change[ds] world.txt B. sed change[d-s] world.txt C. find "change'd|s'" world.txt D. search world.txt changes changed
grep change[ds] world.txt
Which of the following commands is an improved version of more? A. grep B. tail C. cat D. less
less
You want to discover the sizes of several dot files in a directory. Which of the following commands might you type to do this? A. ls -la B. ls -p C. ls -R D. ls -d
ls -la
A program you're using logs errors to the ~/.someprog/errors.txt file. You've seen cryptic error messages in this file, and you want to determine what function of the pro- gram is generating these messages. What command would you type to enable you to see these messages as they're written to the file? A. tail -f ~/.someprog/errors.txt B. vi ~/.someprog/errors.txt C. chmod 644 ~/.someprog/errors.txt D. monitor-logs
tail -f ~/.someprog/errors.txt