Course: UNIX Operating System I (13673)

Q: A Linux shell prompt is characterized by:
- a character which indicates that the shelll is waiting for a command.
- a graphical user interface.
- input from a point and click device.
- None of the above
A: a character which indicates that the shelll is waiting for a command.
If right: A character, usually a $ or # which indicates the shell is ready to accept a command.
If wrong: Refer to the material in Chapter 2.

Q: Telnet is not a secure utility because:
- Passwords are encrypted with the simple shift algoritm
- Passwords are sent over the network in clear text.
- Usernames are encryped using the standard offset algorithm before being transmitted over the network..
- All of the above
A: Passwords are sent over the network in clear text.
If right: Password are sent over the network in clear text.
If wrong: Refer to the material in Chapter 2.

Q: You can log out of a UNIX system by
- Pressing  <Cntrl-C>
- Turning off your computer and monitor
- Pressing  <Cntrl-Alt-Delete>
- All of the above
- None of the above
A: None of the above
If right: You can log out with <Cntrl D> or by typing exit. None of the above is correct.
If wrong: Refer to the material in Chapter 2.

Q: When you enter echo $0 and press return in response to a shell prompt, the shell displays:
- the user's login name such as:  rbass
- the name of the shell you are working with
- the value of the echo variable
- None of the above
A: the name of the shell you are working with
If right: That's correct. $0 contains the program name from the last successful command, in this case the name of the shell your are runnng.
If wrong: $0 contains the program name from the last successful command, in this case the name of the shell your are runnng.

Q: What command allows you to change your password?
- password
- passwd
- chpasswd
- set passwd
A: passwd
If right: Correct!!
If wrong: The password change command in UNIX is passwd.

Q: What command displays the contents of a file on the screen?
- display
- echo
- type
- cat
A: cat
If right: That is cat aract..I mean correct.
If wrong: cat is an abbreviation for concatentation and is used to display files. It has other uses as well.

Q: What does it mean to say that LInux is case sensitive?
- Lowercase and uppercase letters of the same type are not considered equivalent (u is not U).
- A command typed uppercase will not work.
- echo and ECHO are not the same.
- All of the above.
A: All of the above.
If right: That is correct!
If wrong: Lowercase a is not equivalent to uppercase A when using a UNIX shell.

Q: Which of the following is a common method for connecting and logging in to a LInux system.
- LAN connection.
- Internet connection.
- Stand-Alone connection
- All of the above
- Only choices 1 and 2 are correct.
A: All of the above
If right: That is the correct answer.
If wrong: LAN, internet and stand-alone are all common methods of connecting to a UNIX system.

Q: On the Linux command line, the default line kill key is:
- SHIFT-X
- CONTROL-K
- CONTROL-U
- Escape (Esc key)
A: CONTROL-U
If right: That is the correct response.
If wrong: The default is CONTROL-U but sometimes CONTROL-X is used.

Q: What is the purpose of the echo command?
- Displaying the contents of operating system variables and displaying text.
- repeating the output of a command.
- Displaying the contents of a file.
- Displaying a new text window on the screen
A: Displaying the contents of operating system variables and displaying text.
If right: That is correct. That is correct.
If wrong: echo is used to display variables and constants on the screen.

Q: What is the purpose of the "ls" command?
- lists the devices currently connected to the system.
- loads software (ls) prior to execution.
- displays files, directories and other entries in a directory.
- lists the users currectly using the system.
A: displays files, directories and other entries in a directory.
If right: That is correct.
If wrong: "ls" is the UNIX equivalent to the DOS command "dir".

Q: How do you use the apropos command?
- to interpret user commands.
- to identify the variant of UNIX running on a machine.
- to determine who is logged on a Linux system.
- to search for a keyword in the short description of a command in the man pages.
A: to search for a keyword in the short description of a command in the man pages.
If right: That is correct.
If wrong: It is used to find key words in the man pages of Linux commands.

Q: The man utility is used:
- to display the pages in the system documentation of a command.
- to make utility and program calls.
- to manipulate files and devices.
- to display the users files in the working directory.
A: to display the pages in the system documentation of a command.
If right: Correct!!
If wrong: The man command displays the documentation for a given command, ie: man ls will display the man pages for ls.

Q: A user who is not working with root priviledges may not list the files in:
- The /root directory.
- The /lost+found directory
- The /usrs directory
- All of the above.
A: The /lost+found directory
If right: Good. lost+found is correct.
If wrong: Users without root priviledges may not list the files in the lost+found directory.

Q: How is the info utility used?
- to display more complete and up to date information on GNU utilities than the man command.
- displays the contents of the man pages for a utility.
- provides information about a specific user, ie:  info rbass will display information about user rbass.
- None of the above.
A: to display more complete and up to date information on GNU utilities than the man command.
If right: Good. It displays more complete information about GNU utilities.
If wrong: Is a product of the GNU project which allows the user to display more complete information about GNU utilities.

Q: A complete collection of Linux guides, HOWTOs, FAQs, man pages, and Linux Magazines is available through the
- The Redhat Linux website
- documentation in the /usr/share/doc directory.
- The Linux Documentation Project
- The GNU Linux Libraries
A: The Linux Documentation Project
If right: The correct answer is the Linux Documentation Project
If wrong: Linux Documentation Project is correct.

Q: Linux and Unix systems have always had  a privileged user
- called root
- who can read and write to almost any file on the system regardless of ownership
- who execute programs that modify system resources
- all of the above
A: all of the above
If right: root is the superuser.
If wrong: the root login permits almost any action possible on a Linux system.

Q: When stopping a program with the kill signal
- a process has no chance to clean up its open files.
- it can corrupt application data
- it should be used only as a last resort.
- All of the above
A: All of the above
If right: All of these is correct.
If wrong: The kill signal is a last resort when may corrupt files and application data.

Q: After logging in to Linux, if the last login data was not from your previous login session, what is wrong?
- The system has been rebooted and your last login data was lost.
- An unauthorized user has logged into your account using your username and password.
- The sysadm has logged in to your account to do system maintenance.
- The last login data is not unique to you but shows the last login from any user of the system.
A: An unauthorized user has logged into your account using your username and password.
If right: Bad news. You are correct. Someone has your username and password.
If wrong: Your username and password are no longer secure.

Q: The data stored in the /etc/motd file is used:
- to display the Message of the Day.
- to configure the mail utility program.
- to display the last login data including the date time and location
- to accumulate the history of commands and activities for the login session.
A: to display the Message of the Day.
If right: Message of the Day is correct.
If wrong: It contains a message to be displayed on the screen at login.

Q: A textual interface is also known as:
- a graphical user interface (GUI)
- common user interface
- a single user interface
- a pseudographical interface
A: a pseudographical interface
If right: That is correct. It is a psuedographical interface.
If wrong: Hint: It isn't a GUI. And the term means literally "false graphical" inteface.

Q: Command options are specified with:
- asterisk followed by a search pattern.
- one or more letters preceded by a hyphen.
- a numeral between 1 and 4 enclosed in parentheses.
- one or more letters enclosed in brackets.
A: one or more letters preceded by a hyphen.
If right: That's right. For example: ls -al
If wrong: Options are specified following a command with one or two hypens followed by appropriate letters. For example: ls -al

Q: su and sudo are utilities which
- allow the user to gain root privileges.
- issues the TERM command to stop the current process.
- displays a list of all users on the system.
- None of the above.
A: allow the user to gain root privileges.
If right: That is correct.
If wrong: su and sudo give a user root privileges when the correct password is entered.

Q: The command to suspend the execution of a program is:
- ALT-X
- Esc (or Escape)
- CONTROL-H
- CONTROL-Z
A: CONTROL-Z
If right: That is correct.
If wrong: CONTROL-Z is the command.

Q: The acronym CLI means
- Common Line Input
- Command-Line Interface
- Common Linux Input
- Client Linear Input
- Color Linux Interface
A: Command-Line Interface
If right: Excellent.
If wrong: It is the abbreviation for command line interface.

Q: On a Linux system being used as a server, a GUI may not be installed because
- it consumes a lot of system resources.
- most system resources are better dedicated to the server's main purpose.
- security considerations mandate that a server run as few tasks as possible.
- All of the above.
- None of the above.
A: All of the above.
If right: That is the correct answer.
If wrong: All of the above is correct

Q: The Linux kernel
- is responsible for allocating the computer's resources and scheduling user jobs
- is a collection of application software packages
- is a collection of computer hardware and software assembled into a functioning unit.
- All of the above
A: is responsible for allocating the computer's resources and scheduling user jobs
If right: That is correct.
If wrong: allocates the computer's resources and schedules user jobs

Q: Linux was developed by
- Steve Jobs
- Linus Torvalds
- the GNU Project
- The POSIX Committee
A: Linus Torvalds
If right: That is correct
If wrong: Hint: He was a Finish college student.

Q: What is a multitasking operating system?
- Allows quick execution of jobs in succession.
- Allows multiple users to access the same file.
- Allows each user to run more than one job at a time.
- All of the above
A: Allows each user to run more than one job at a time.
If right: That is good!
If wrong: Time sharing makes possible a multiuser, multiprocess OS.

Q: What is a GUI?
- A Graphical User Interface
- Is implemented in Linux by X Windows
- Allows a point and click style of interaction.
- All of the above
A: All of the above
If right: All is correct
If wrong: GUI is the graphical user interface implemented in LInux by X Windows and provides a point and click environment.

Q: The C Programming Language was developed by
- Ken Thompson
- Linus Torvalds
- Dennis Ritchie
- Paul Allen
- None of the above
A: Dennis Ritchie
If right: You are correct
If wrong: Hint: Sounds like Linux

Q: Linux is
- A software system dirived from MS Windows.
- An operating system originally written by engineers at IBM.
- A version of Unix System V.
- None of the above
A: None of the above
If right: Linux is a Unix like operating system which has become the backbone of the internet.
If wrong: Linux is a Unix like operating system which has become the backbone of the internet.

Q: Linux was written in
- 1999
- C
- Bell Labs
- All of the above
- None of the above
A: C
If right: LInux was written in C.
If wrong: Linux was written in the C programming language

Q: An operating system
- Manages hardware resources in a computer system
- Manages software resources in a computer system
- Deals with complex hardware resources in a computer system and provides the user a virtual image of the machine that is much easier to deal with than the physical machine
- All of the above
- None of the above
A: All of the above
If right: Correct. It does all of these things.
If wrong: Study the definition of Operating System in Chapter 1.

Q: What is a portable operating system?
- An operating system that is used in systems that need response to an input within a fixed interval of time, such as the controller of a robot in a manufacturing plant
- Another name for a batch system
- One that runs  on many different machines
- All of the above
- None of the above
A: One that runs  on many different machines
If right: Multi-user, multi-processing system is correct.
If wrong: Refer to chapter 1.

Q: Currently, the most challenging issue in operating system design
- Security
- Communication
- Multitasking
- All of the above
- None of the above
A: Security
If right: Security. An increasingly so as the number of users of the internet grows.
If wrong: Security! Security! Security!

Q: What is a command line interface?
- a text-only terminal window
- a display with no graphics capability
- an interface which accepts keyboard entry only.
- all of the above
- None of the above
A: all of the above
If right: It is all of these?
If wrong: The first character stands for character.

Q: What is a file?
- the text for a report
- an image
- an executable program
- All of the above
- None of the above
A: All of the above
If right: It is all of these
If wrong: Refer to chapter 1.

Q: Linux shell commands can be arranged in a file commonly called a:
- shell script
- batch file
- macro
- All of the above
- None of the above
A: shell script
If right: Good. They are called shell scripts.
If wrong: Such files are called shell scripts.

Q: What is a link file?
- A logical connection between multiple computers on a network
- a means to access a file by two or more names.
- A physical connection to an external device
- All of the above
- None of the above
A: a means to access a file by two or more names.
If right: All of the above is correct.
If wrong: Refer to chapter 1.

Q: POSIX stands for
- Process Service in UNIX
- Pubic OS for X Developers
- Portable Operating System Interface
- None of the above
A: Portable Operating System Interface
If right: POSIX is the standard definition of of the minimum requirements of a Unix/Linux system.
If wrong: See Chapter 1.

Q: Device-independent input and output in a Linux system means:
- that the operating system is virtual and runs on a remote server.
- that input and output can be redirected to any appropriate device.
- that the operating system kernel will run on any computer.
- All of the above
- None of the above
A: that input and output can be redirected to any appropriate device.
If right: Correct. All input devices and output devices are defined as files in Linux.
If wrong: Input and output can be redirected to any appropriate device.

Q: Linux commands can be constructed as a pattern using special characters called:
- substitutes
- generics
- jokers
- wildcards
- None of the above
A: wildcards
If right: Special characters are called wildcards.
If wrong: Pattern constructing special characters are called wildcards.

Q: BSD and System V are examples of:
- Microsoft Windows Releases
- VMS
- UNIX
- All of the above
- None of the above
A: UNIX
If right: UNIX is correct.
If wrong: Refer to chapter 1.

Q: Ordinarily, if you type xy on the Linux command line, what happens?
- You get a display of the x and y coordinates of the screen cursor
- You get an error message saying that no such command can be found
- Nothing is displayed, the shell prompt reappears
- The results of the xy command are displayed on screen
- None of the above
A: You get an error message saying that no such command can be found
If right: An error message is displayed.
If wrong: An error. See Chapter 1

Q: Which of the following is a common Linux shell?
- Bourne Again Shell
- TC Shell
- Z Shell
- Debian Almquist Shell
- All of the above.
A: All of the above.
If right: All of the above is correct
If wrong: Refer to chapter 1.

Q: The X Window System was developed at
- Microsoft Labs
- The IBM Watson Research Labs
- The MIT
- University of California at Berkely
- None of the above
A: The MIT
If right: Massachusetts Institute of Technology is correct.
If wrong: Refer to chapter 1.

Q: The most essential thing that a beginner needs to know before operating in Linux is:
- How to log in and log out
- How to work with the API
- How to program in C
- All of the above
A: How to log in and log out
If right: In you can't log in you can't use the system. So, login and logout knowledge is essential.
If wrong: Logging in and Logging out. See Chapter 1.

Q: A Linux pipeline
- passes the output of one program to another program as input.
- is also known as an alias
- A network connection between Linux systems and other operating systems.
- None of the above
A: passes the output of one program to another program as input.
If right: Very good!
If wrong: Refer to Chapter 1 in the textbook.

Q: File security in Linux is provided by
- file access permissions
- anti-virus software such as Windows Defender
- Linux Filesystem Hierarchy (FHS)
- All of the above
A: file access permissions
If right: That is correct.
If wrong: file access permissions

Q: A virtual machine
- appears to the user, and, to the software running on it, as a complete physical machine.
- consists of the programs, files, hardware and software on a computer hardware system.
- runs programs intended for other operating systems.
- is all of the software system available to run on an operating system.
A: appears to the user, and, to the software running on it, as a complete physical machine.
If right: That is correct.
If wrong: See chapter 1.

Q: The command to display the first five lines of the sample file in the current working directory is:
- head sample
- head -5 sample
- display -5 sample
- cat -5 sample
- All of the above
A: head -5 sample
If right: head -5 sample is correct
If wrong: head displays 10 lines by default. To display a specific number of lines use a numeric option. For this question it is: head -5 sample

Q: The following command can be used to copy the sample file into the example file.
- cp sample example
- copy -f sample example
- mv sample example
- All of the above
- None of the above
A: cp sample example
If right: cp is the copy command in LInux.
If wrong: Refer to the commands covered in chapter 3.

Q: The purpose of the

mv configure configure.bak

command is to:
- Rename the configure file to configure.bak.
- Move configure.bak to the configure directory.
- Copy configure to configure.bak
- Move configure to the bak directory.
- Copy all configure files to the configure.bak directory.
A: Rename the configure file to configure.bak.
If right: Rename configure to configure.bak is correct.
If wrong: The move command in Linux acts sometimes acts as if it should be called rename. That is the case in this question.

Q: The command:

cp file1 /home/rbass/file2

will do which of the following?
- copy file to file2 in the /home directory if rbass is the owner of both directories.
- copies /home/rbass/file2 to file1
- copies file1 to file2 and places it in the /home/rbass directory.
- moves file1 to the /home/rbass directory.
- copies file1 to file2 then removes file1.
A: copies file1 to file2 and places it in the /home/rbass directory.
If right: It is a copy of file1 to file2 and places it in the /home/rbass directory.
If wrong: This command copies file1 to a different directory under a different name.

Q: The command

copy source destination
- moves files from one location to another.
- copies a source file to a destination file with exactly the same contents.
- copies an original file to a new file and then deletes the original file.
- copies all the files in a directory to an archive.
- None of the above since there is no copy command in Linux or Unix.
A: None of the above since there is no copy command in Linux or Unix.
If right: cp is the command to use. Very good.
If wrong: There is no command named copy in Linux.

Q: What is the command to display a list of files in a directory with each file's owner and attributes?
- list
- ls -l
- ls
- ls -a
- dir
A: ls -l
If right: ls -l is correct.
If wrong: the command is ls with the -l option, thus: ls -l

Q: The command to display the last 10 lines of a file is:
- tail sample
- cat -10 sample
- echo -t sample
- tail -5 sample
- cat -tail
A: tail sample
If right: Just plain ol' tail is correct.
If wrong: The default of the tail command is the last 10 lines.

Q: The command:

grep bb sample
displays which of he following
- displays a list of all words in sample with bb embedded in them.
- displays all lines in sample with bb embedded in them
- displays only the first line with bb embedded in it.
- displays all of the lines in file bb with the word sample in them.
- displays the first line in file bb with the word sample in it.
A: displays all lines in sample with bb embedded in them
If right: Good. Search for bb in sample, displaying all of the lines in which it fines the string.
If wrong: grep searches for a string in a file displaying all lines that match the search string.

Q: The command:

gzip myfile
produces what outcome?
- a compressed copy of myfile called myfile.z
- compresses myfile but leaves the name unchanged
- compresses myfile and produces myfile.gz; myfile is no longer a valid file name.
- compresses myfile and changes the name to myfile.tar.z
- None of the above
A: compresses myfile and produces myfile.gz; myfile is no longer a valid file name.
If right: That's correct. Changes myfile into myfile.gz which is compressed.
If wrong: The compress command compresses a file and adds a .gz to the file name.

Q: The diff file1 file2 command can be used to:
- Compare file1 and file2 line-by-line and display differences between them with highlighted text.
- Compare file1 and file2 word-by-word and display differences between them as a series of commands that can be used to convert file1 to file2, or vice versa
- Compares file1 and file2 line-by-line and displays differences between them as a series of commands that can be used to convert file1 to file2, or vice versa
- All of the above
- None of the above
A: Compares file1 and file2 line-by-line and displays differences between them as a series of commands that can be used to convert file1 to file2, or vice versa
If right: Right.
If wrong: Compares file1 and file2 line-by-line and displays differences between them as a series of commands that can be used to convert file1 to file2, or vice versa

Q: The command to compress a file, called mysort, is:
- gzip mysort
- gzexe mysort
- gzip -dl mysort
- zip mysort
- None of the above
A: gzip mysort
If right: gzip mysort is correct.
If wrong: gzip compresses a file.

Q: The command: ls -a will display:
- all files including hidden files.
- the directory in abbreviated format.
- all files with read access permissions.
- None of the above.
A: all files including hidden files.
If right: That is correct.
If wrong: Shows entries for the "hidden" files.

Q: What utility packs and unpacks archives?
- gzip
- zip
- compress
- tar
- All of the above
A: tar
If right: tar is correct.
If wrong: tar is the archiving utility.

Q: The zcat command is used to:
- Display files created by zombie processes
- Display files whose names start with z or Z
- Display files compressed with the compress or gzip command
- is the GNU version of the cat utility.
- None of the above
A: Display files compressed with the compress or gzip command
If right: That's right.
If wrong: zcat displays compressed files.

Q: The whereis command can be used to:
- Locate files containing executable codes for commands on your UNIX system
- Locate files containing source code for commands on your UNIX system
- Locate files containing manual pages for commands on your UNIX system
- All of the above
- None of the above
A: All of the above
If right: Good.
If wrong: whereis helps you locate executables, source files, and man pages.

Q: What command will assist you in determing the contents of a file?
- file
- ls
- whatis
- find
A: file
If right: That is correct.
If wrong: file is the command which attempts to classify files.

Q: What command lists users on the system?
- who
- finger
- w
- All of the above
A: All of the above
If right: That is the correct answer.
If wrong: All of these display users.

Q: What command displays system load and duration information?
- free
- uptime
- locate
- all of the above.
A: uptime
If right: Correct!!
If wrong: uptime give you the up time.

Q: When examining the output of the command:

ls -F

entries followed by a "/" are:
- directories
- ordinary files
- links
- executable files
A: directories
If right: That correct.
If wrong: Directories.

Q: What command will locate a utility and display the full path name to it?
- where
- locate
- which
- find
- None of the above.
A: which
If right: That is correct.
If wrong: Which.

Q: Which is the following is not another accepted name for named pipes:
- IPC mechanisms.
- links
- sockets
- FIFO pipes
A: links
If right: That is correct.
If wrong: Named pipes are not links.

Q: What utility can be used to compress a tar file?
- gzip
- compress
- bzip2
- All of the above.
A: All of the above.
If right: Correct.
If wrong: Page 66 in the textbook!

Q: Which of the following is an example of a pipe?
- ls > directory
- ls | wc
- ls *tar
- ls ?tar
A: ls | wc
If right: That is correct.
If wrong: A pipe uses the symbol |

Q: While logged into a Linux system, the write utility
- sends a message to another user who is logged into the system.
- opens the email utility to compose a message.
- opens the write editor to create a text file.
- allows you to write a command sequence to the script buffer.
- None of the above.
A: sends a message to another user who is logged into the system.
If right: Write a message to another logged in user is correct!!!
If wrong: Writes a message to another user of the system.

Q: The command to deny messages from other users of the system you are logged into is:
- deny -a
- mesg n
- write -n
- mesg d
A: mesg n
If right: mesg n is correct.
If wrong: mesg -n blocks other users from using write to display a message on your screen.

Q: What does the uniq command do?
- Removes duplicate lines from a sorted file.
- Displays duplicate lines.
- Deletes duplicate lines in a sorted file and then saves the file.
- None of the above.
A: Removes duplicate lines from a sorted file.
If right: Very good.
If wrong: Displays only one of two or more adjacent duplicate lines in a file.

Q: What does the command:

remove all

do?
- removes all files in the directory/
- removes the file named all.
- deletes files beginning with the letters "all".
- None of the above.
A: None of the above.
If right: There is not a remove command. The delete command in Linux is rm.
If wrong: There is not a remove command in Linux.

Q: In LInux, less is more, because:
- The OS is smaller than Unix but more powerful.
- There are fewer commands but each is more powerful.
- The less command is similar to the more command but displays and END message.
- None of the above.
A: The less command is similar to the more command but displays and END message.
If right: less is more (does what more does but adds a little).
If wrong: the more command and the less command are largely the same. So "less is more".

Q: What option puts the rm command in interactive mode requiring you to confirm the deletion?
- rm -i
- rm -r
- rm *
- rm ?
A: rm -i
If right: The -i option invokes the interative mode of the rm command.
If wrong: The command rm -i somefilename will ask you to confirm the removal. So its considered a safer usage.

Q: A Linux directory is also often referred to as a:
- Package
- Archive
- Folder
- D. All of the above.
- None of the above
A: Folder
If right: That is correct.
If wrong: It is frequently referred to as a folder.

Q: How can you determine the name of the shell you are currently using on your UNIX system?
- A. Enter the command echo SHELL
- B. Enter the command echo $myshell
- C. Enter the command cat $0
- D.None of the above.
A: D.None of the above.
If right: Careful! None of the above is correct.
If wrong: $SHELL is the variable which contains the name of your shell. Without the $ the word SHELL is just a string to be echoed on the screen. So none of these will work.

Q: In Linux, what command will print a copy of file: Names to printer: lp1?
- print Names lp1
- lpr -P lp1 Names
- C. Print Names
- D. cat Names>print
A: lpr -P lp1 Names
If right: lpr is the correct command
If wrong: lpr is used in Linux to print to a printer.

Q: What does the utility hostname do?
- displays the type of OS installed.
- displays the name of the system you are working on.
- displays the mac address of the system.
- displays OS configuration parameters.
A: displays the name of the system you are working on.
If right: Correct.
If wrong: displays the system name.

Q: What commands makes a copy of file1 and names it file1.bak?
- cp file1 file1.bak
- cp file1.bak file1
- mv file1 file1.bak
- copy file1 file1.bak
A: cp file1 file1.bak
If right: That is correct.
If wrong: the copy command is cp and format is: cp source destination.

Q: What command will change the name of sample to sample.bak?
- move sample sample.bak
- move sample.bak sample
- mv sample.bak sample
- rename sample sample.bak
- mv sample sample.bak
A: mv sample sample.bak
If right: Correct!!
If wrong: The rename command is mv. And the format is mv oldname newname.

Q: What happens when the following command executes, if program1a.cpp already exists?

cp program1.cpp program1a.cpp
- cp will ask if you wish to overwrite program1a.cpp
- cp will make a backup of program1a.cpp (program1a.cpp.bak) before it overwrites it.
- an error message will be generated informing you that program1a.cpp already exists.
- cp will overwrite program1a.cpp thus destroying it while creating a new file.
A: cp will overwrite program1a.cpp thus destroying it while creating a new file.
If right: That is correct.
If wrong: cp will overwrite the destination file.

Q: The UNIX file system is hierarchical similar to an organization chart. The top level directory in the hierarchy of directories is the:
- root (/)
- prime (*)
- executive (-)
- top (^)
- All of the above are correct.
A: root (/)
If right: That is correct.
If wrong: It's the root (/).

Q: The date command:
- displays the current date
- displays the time
- Both A and B
- None of the above
A: Both A and B
If right: The date command displays the current time and date.
If wrong: It is date.

Q: The free command will
- display swap space
- display amount of physical RAM
- C. clean-up corrupt files
- Both A and B are correct.
- A, B, and C are all correct.
A: Both A and B are correct.
If right: That is correct.
If wrong: free displays the amount of RAM and swap space.

Q: The command:

sudo -s
- spawns a new shell with root privileges.
- typically displays a # symbol as the prompt.
- requires you to enter a password to gain root privileges.
- All of the above.
A: All of the above.
If right: All is correct.
If wrong: All of the above is correct.

Q: The TERM shell variable
- estables the characteristics of a character-based terminal or terminal emulator.
- sets the maximum duration of the login session.
- doesn't exist on LInux systems.
- None of the above
A: estables the characteristics of a character-based terminal or terminal emulator.
If right: Good.
If wrong: Sets the characteristics of the terminal.

Q: How do you repeat a command on the command line?
- enter CONTROL *
- press the up-arrow key
- enter SHIFT INSERT
- press the F8 function key and press enter.
A: press the up-arrow key
If right: Correct!!
If wrong: Use the up-arrow key to repeat a command.

Q: What command allows you to get a hint if you have forgotten your password?
- passwd -h
- help -password
- cat /etc/password/hint
- D. get passwd -d
- None of the above.
A: None of the above.
If right: Correct!! There is no command which will give you a password hint.
If wrong: There is no command which will give you a password hint.

Q: What is the output of this comand:

echo hostname
- The assignmed name for the server is displayed
- hostname
- your user id
- none of the above.
A: hostname
If right: echo is also used to display text so in this case the output is "hostname".
If wrong: echo is also used to display text so in this case the output is "hostname".

Q: What does the following command do?

file mytext
- creates a new file titled mytext
- archives mytext
- searches for mytext in the current working directory.
- identifies the content of file mytext.
- E. None of the above.
A: identifies the content of file mytext.
If right: That is correct.
If wrong: file is the command which attempts to identify files.

Q: What is the difference between the following commands?

command 1:  sort months | head

command 2:  Sort months | tail
- After sorting, command 1 displays the first 10 lines and command 2 displays the last 10 lines.
- After sorting, command 2 displays the last 5 lines and command 1 displays the 5 lines
- Command 1 sorts months and displays the first 10 lines; while command 2 gives an error message.
- Command 2 sorts months and displays the last 10 lines; while command 1 gives an error message.
A: Command 1 sorts months and displays the first 10 lines; while command 2 gives an error message.
If right: That is correct!
If wrong: Since LInux is case sensitive, command 2 is illegal and gives an error message.

Q: What is a Linux shell?
- It is a command interpreter and a programming language.
- It is a simplified version of a GUI.
- It is a program which acts as a protective shield from computer viruses and malware.
- All of the above.
A: It is a command interpreter and a programming language.
If right: That is correct.
If wrong: A shell is a character user interface which provides command line interpretation.

Q: What gives anyone the right to copy, modify, and redistribute the source code for Linux?
- The POSIX standards.
- The GNU General Public License.
- the Common Agreement License adopted by the creaters and developers of the operating system.
- D. The Linux Public Copyright and Patent.
A: The GNU General Public License.
If right: That is correct
If wrong: The GNU GPL (general public license).

Q: What is a multitasking operating system?
- A combined AUI and API with a supporting kernel.
- B. A collection system management software packages
- C. A collection of computer hardware and software assembled into a functioning unit.
- D. A software system which allows a user to run many programs on a single physical computer.
A: D. A software system which allows a user to run many programs on a single physical computer.
If right: You are correct.
If wrong: It is the software that allows a user to run many programs on a single computer.

Q: What is a link?
- A link allows two or more files to be viewed as one.
- A link allows a file to be accessed by means of two or more names.
- A link allows the output of one program to become the input of another program.
- A link allows two files to be executed simultaneously.
A: A link allows a file to be accessed by means of two or more names.
If right: That is the correct response.
If wrong: A link is a second name for a file. So that the file may be accessed by either name.

Q: What is the purpose of the "ls" command?
- lists the devices currently connected to the system.
- displays a list of files, directories and other entries in a directory.
- loads software (thus the name ls) prior to execution.
- lists the users currectly using the system.
A: displays a list of files, directories and other entries in a directory.
If right: That is correct.
If wrong: "ls" is the UNIX equivalent to the DOS command "dir".

Q: What is the purpose of the echo command?
- Displaying the contents of shell variables and echoing text to stdout.
- Repeating the output of a command.
- Displaying the contents of a file.
- Displaying a new text window on the monitor.
A: Displaying the contents of shell variables and echoing text to stdout.
If right: echo That is correct That is correct
If wrong: echo is used to display shell variables and echo text

Q: Which of the following is credited with developing UNIX?
- Richard Stallman and programmers associated with the GNU Project
- Linux Torvalds and members of the Free Software Foundation.
- Researchers (at Bell Labs) who needed a set of modern computing tools to help with their projects.
- Faculty of the University of California at Berkley
A: Researchers (at Bell Labs) who needed a set of modern computing tools to help with their projects.
If right: Very good.
If wrong: Check for the correct answer in Chapter 2.

Q: Which of the following is the most commonly used text editor in Linux and UNIX?
- joe
- vim (aka: vi)
- pico
- EMACS
A: vim (aka: vi)
If right: Good. vim (aka: vi) comes with all versions of LInux.
If wrong: vim is the only text editor you can be assured will be available on all LInux systems.

Q: A proprietary operationing system is one that is
- sold commercially to run on a wide variety of computer desktop systems.
- B. that charges for the installation media and user licenses for each desktop style computer on which it is installed.
- C. written, owned, and installed by manufacturers of the computer hardware.
- D. All of the above.
A: C. written, owned, and installed by manufacturers of the computer hardware.
If right: That is correct.
If wrong: Proprietary operating systems are owned by the hardware manufacturer.

Q: A generic operating system is one that is
- sold or given to computer manufacturers and owners for installation on their systems.
- very general in scope and must be extensive modified and expanded before installation on a computer system.
- used as the basis of any number of specific custom designed operating systems.
- uses a command line interface only.
A: sold or given to computer manufacturers and owners for installation on their systems.
If right: Very good.
If wrong: Linux, UNIX, and Windows are generic operating systems because they run on many different manufacturers computer hardware.

Q: In the following Linux command, which is the "command argument?" ls -al m*
- m*
- -al
- ls
- None of the above.
A: m*
If right: Thats correct. The command argument is m*. The command options are -al. And, the command is ls.
If wrong: The command line consists of the command (ls), the command options (-al), and the argument (m*).

Q: The output of the command: ls -l produces information about each file in the working directory including:
- file name, file size, and time.
- file type, link count, and date.
- owner and owner's group.
- all of the above.
A: all of the above.
If right: That is right!!!!
If wrong: It is all of them.

Q: The
who | sort > grep John
command:
- Generates an error because John is processed as a command.
- Displays line(s) containing the string John in the output of the who command
- Redirects the sorted version of the who command to the grep utility.
- None of the above
A: Generates an error because John is processed as a command.
If right: Correct: should be who | sort | grep John
If wrong: This command creates a file called grep; then tries to execute John as a command.

Q: What are the two types of shell commands?
- shell builtins and and stand alone utilities
- utility and program calls.
- file references and device calls
- hardware manipulators and software.
A: shell builtins and and stand alone utilities
If right: Correct!!
If wrong: Builtins and utilities make up the two types of commands.

Q: What is a LInux shell?
- A program which interprets and executes user commands.
- A program which uniquely identifies the variant of Linux running on a computer
- A primitive predecessor to a graphical user interface
- The LInux users command library.
A: A program which interprets and executes user commands.
If right: That is correct.
If wrong: A shell provides a character user interface and command line interpretation.

Q: What character is used to separate elements on the Linux command line?
- spaces and tabs.
- hypens
- asterisks
- All of the above
- None of the above
A: spaces and tabs.
If right: Good.
If wrong: Spaces and tabs are the default separators on the command line.

Q: What is the purpose of the "--help" option?
- lists the hardware devices available for use with the command.
- provides error messages that assist in debugging if a command fails.
- provides interactive assistance with a command as it executes.
- None of the above
A: None of the above
If right: None of these are correct!
If wrong: None of these are correct. The help option provides a help screen to show proper usage.

Q: What is the shell special character that creates a pipe between commands?
- Greater than sign (>)
- Less than sign (<)
- Tilde (~)
- Colon (:)
- None of the above
A: None of the above
If right: The pipe ( | ) character but it is not one of your choices.
If wrong: None of these are the pipe (|) symbol.

Q: What is the shell special character that matches zero or more characters?
- Square brackets [ ]
- Pound sign (#)
- Dollar sign ($)
- Asterisk (*)
- None of the above
A: Asterisk (*)
If right: *
If wrong: The asterisk is the wildcard character that matches 0 or more characters in a filename.

Q: When interpreting your commands, the shell assumes the first word you type on the command line is
- a valid command name or program.
- a valid command option to a command.
- an argument for the command.
- the correct path to the command.
- None of the above
A: a valid command name or program.
If right: A command name is correct.
If wrong: A command or a program is the answer.

Q: Which command will append file "extra" to "customers"?
- append extra to customers
- cat extra >> customers
- cp customers extra to customers
- mv customers extra to customers
A: cat extra >> customers
If right: That is correct.
If wrong: The append operator is >>.

Q: The question mark (?) is a special character that cause the shell to:
- generate a help screen associated with a specific command.
- generate an interactive use of the command it is used with.
- generate filenames which match any single character in the name of a file.
- generate filenames which match any number of characters from 0 to 99 in the filename.
A: generate filenames which match any single character in the name of a file.
If right: That is correct!
If wrong: It generate filenames which match any single character in the name of a file.

Q: The command:

ls program[12345]

can generate which of the following lists of filenames?
- program1 program2 program3.cpp program.2
- program1 program2 program5
- program1 program3 programX
- program5 program3 program1 program9
A: program1 program2 program5
If right: Good. The correct list would be any file which begins with program and ends with 1 of the single digits between 1 and 5.
If wrong: The list will contain filenames which begin with "program" and ends with a single digits between 1 and 5.

Q: Given the command:

cat ?[xyz]*.cpp

which of the following files with be displayed?
- Myfile.cpp
- Xyz.cpp
- 9zjunkfile.cpp
- All of the above.
- None of the above.
A: All of the above.
If right: Very good.
If wrong: All of these filenames meet the criteria in the command.

Q: What command will send page1, page2, page3, page4, page5, and page6 to the local printer?
- lpr *[123456]
- lpr page?
- lpr p*
- lpr p*[123456]
- All of the above.
A: All of the above.
If right: Good.
If wrong: All of these commands will work.

Q: If a command is a simple file name, the shell will seach:
- the directories listed in the PATH variable.
- the directories in the path to the working directory and including the working directory.
- the working directory, the /usr/bin directory, and the /bin directory.
- All of the above.
A: the directories listed in the PATH variable.
If right: Good. It searches the directories listed in the PATH variable.
If wrong: The PATH variable lists al of the directories to be searched by the shell looking for a specific executable file.

Q: A command that reads its standard input from the output of another command; and, writes its standard output to the standard input of another command is called:
- a redirect
- a filter
- a link
- All of the above.
- None of the above.
A: a filter
If right: A filter is correct.
If wrong: It is a filter. For example: ls -l | grep Ron | sort uses grep as a filter between ls and sort.

Q: Which "ls" command option will display hidden files?
- -h
- -all
- -a
- None of the above.
A: -a
If right: Correct.
If wrong: ls -a will include a list of the hidden files in the directory listing..

Q: Where is the output of the following command displayed?

cat file1 | grep rbass > /dev/null
- the output disappears without a trace.
- the output is redirected to file null in directory /dev
- since the output is redirected before /dev/null is opened, it appears on stdout.
- None of these.
A: the output disappears without a trace.
If right: Good.
If wrong: /dev/null acts as a data sink. The output disappears without a trace.

Q: The command:

ls -al | less

is an example of ___________________.
- output redirection
- pipleline
- input redirection
- file extending
A: pipleline
If right: A pipeline is correct.
If wrong: This is a pipeline or "pipe."

Q: Which of the following commands is executed in the background?
- find / -name memo55 > mem.out &
- ls -al / | grep root > rootsFiles ?
- find ~ -name rbass > mystuff <2 background
- None of the above.
A: find / -name memo55 > mem.out &
If right: Good. The & causes the process to occur in the background.
If wrong: The & causes the process to occur in the background.

Q: What command will terminate process 18228 which is running in the background?
- del 18228
- rm 18228
- kill [18228]
- kill 18228
A: kill 18228
If right: kill 18228 is correct.
If wrong: The command to use is kill with the process id as the argument.

Q: The command:

ls ~/*

will list:
- all files in the user's working directory
- all files in the user's home directory.
- all files in the user's home directory except hidden files
- all files in the user's working directory except hidden files.
A: all files in the user's home directory except hidden files
If right: Very good.
If wrong: the ls ~/* displays all files in the home directory except hidden files.

Q: Which file will not be displayed with the following command?

cat page[134589]*
- page3
- page1
- page6
- page9
- None of the above.
A: page6
If right: page2, page6, and page7 are not displayed.
If wrong: page2, page6, and page7 are not displayed.

Q: What is the output of the jobs command?
- A list of all running processes.
- A list of suspended jobs and background jobs.
- a list of jobs scheduled to be run.
- a list of the jobs executed by the user during the current work session.
A: A list of suspended jobs and background jobs.
If right: A list of suspended jobs and background jobs is the correct choice.
If wrong: jobs displays a list of suspended jobs and background jobs.

Q: Which keystroke command in vim allows you to append text AFTER the character the cursor is on?
- i
- a
- o
- u
- None of the above
A: a
If right: Append is entered with an "a" .
If wrong: Append is entered with an "a" .

Q: In which vim mode do you actually type-in the text?
- Command Mode
- Insert Mode
- Last Line Mode
- Data Mode
- Typing Mode
A: Insert Mode
If right: The Insert Mode.
If wrong: The Insert Mode.

Q: The vim command 4dw does which of the following?
- Deletes four spaces after the current word
- Deletes four words starting at the cursor position
- Deletes 4 words after the current line
- Deletes four characters from the buffer
- None of the above
A: Deletes four words starting at the cursor position
If right: Deletes four words starting at the cursor position
If wrong: Deletes four words starting at the cursor position

Q: Which character in vim allows you to go from Insert Mode to Command Mode?
- Control Key
- Escape Key
- Control, Alt, Delete Keys Simultaneously
- Any of the above will work.
- None of the above
A: Escape Key
If right: Use the excape key to return to command mode.
If wrong: Use the excape key to return to command mode.

Q: Which of the following best describes what an editor buffer is?
- A disk file
- A temporary storage area for text you are editing
- A protective shell between vim and malicious software.
- A brief delay between data entry and storage in memory.
- None of the above
A: A temporary storage area for text you are editing
If right: A buffer is a temporary memory location for storing data for a limited time.
If wrong: A buffer is a temporary memory location for storing data for a limited time.

Q: Which of the following is a Linux clone of vi?
- elvis
- nvi
- vile
- vim
- All of the above.
A: All of the above.
If right: All of the above is correct.
If wrong: It is all of the above.

Q: While in vim command mode, what command will exit without saving the file?
- :q
- :Q
- :q!
- :wq
A: :q!
If right: From command mode it is: :q!
If wrong: From command mode it is: :q!

Q: Which one of the following statement is not true?
- vim editor is the improved version of vi editor
- vim editor commands are case sensitive
- vim editor has three modes of operation: command mode, last line mode, and insert mode
- vi stands for virtual editor
A: vi stands for virtual editor
If right: vi stands for visual editor.
If wrong: vi stands for visual editor.

Q: Which vim editor command copies the current line of the file?
- yy
- yw
- yc
- none of the above.
A: yy
If right: yy is correct
If wrong: It is yy.

Q: Which command is used to delete the character before the cursor location in vim editor?
- x
- X
- d
- D
A: X
If right: It is upper case X
If wrong: X is the command.

Q: What are the vim modes of operation?
- command, escape, and append.
- command, last line, and insert
- input, command, and visual
- last line, insert, and execute
A: command, last line, and insert
If right: The modes are command, last line, and input.
If wrong: The modes are command, last line, and input.

Q: Which command searches the work buffer in a file opened in the vim editor?
- * or ?
- < or >
- / or ?
- & or /
A: / or ?
If right: / searches forward and ? searches in reverse
If wrong: / searches forward and ? searches in reverse

Q: In the vim editor, the key combination CTRL+f
- moves screen up one line
- moves cursor down one line
- moves cursor up one line
- moves screen down one page
A: moves screen down one page
If right: CTRL+f moves screen down one page
If wrong: CTRL+f moves screen down one page

Q: What command causes vim to display line numbers next to the text being edited?
- :i nu
- :set number
- :insert numbers
- :set nums
A: :set number
If right: Correct!
If wrong: :set number will insert line numbers in the text.

Q: What vim command searches the current line in the buffer for "big" and replaces it with "large"?
- :s/big/large/
- :s/large/big/
- :s/big/:r/large/
- :/s/big/r/large/
A: :s/big/large/
If right: Very good.
If wrong: The command is s followed by the search string then the replacement string; :s/big/large/

Q: What does the vim command:

:1,$s/ten/10/g

do?
- Replaces every occurence of ten with 10 from line 1 to the current line.
- Replaces every occurrence of the string ten with with the string 10.
- Searches for the first occurrence of ten on line 1 and replaces it with 10.
- Searches for the first occurrence of ten on line 1 and replaces it with $10.
A: Replaces every occurrence of the string ten with with the string 10.
If right: Correct.
If wrong: Replaces every occurrence of the string ten with with the string 10 in the active work buffer.

Q: The vim period (.) command:
- cause the last command to be undone.
- moves the cursor to the top of the buffer.
- repeats the last command.
- None of the above.
A: repeats the last command.
If right: Correct.
If wrong: The period (.) is the repeat command in vim.

Q: The vim yank command (y) is identical to the delete command (d)
- except that it does not delete text from the work buffer..
- except that it deletes the text from the work buffer without making a copy in the general purpose buffer.
- except that it does not place a copy of the deleted text in the general purpose buffer.
- and there is no difference between the two commands.
A: except that it does not delete text from the work buffer..
If right: Correct.
If wrong: Yank is a copy command while delete is a cut command. So they are identical except that yank does not remove the marked text from the work buffer.

Q: What is the vim command to delete the text from the cursor to the end of the paragraph?
- d}
- d$
- xx
- X
A: d}
If right: Correct.
If wrong: It is d}.

Q: What command will write the work buffer to the disk and then exit vim?
- ZZ
- :wq
- both of the above are correct.
- You must enter two commands;

:s

then

:x
A: both of the above are correct.
If right: Very good.
If wrong: Either ZZ or :wq will work.

Q: To insert a blank line below the line the cursor is on in the vim work buffer, the command is:
- A
- i
- $a
- o
A: o
If right: That is correct.
If wrong: command "o" inserts a blank line below the line with the cursor.

Q: What vim command restores text that you just deleted?
- u
- :undo
- Control-U
- :r
A: u
If right: Very good. That is correct.
If wrong: It is the "u" command.

Q: In Vim, text that has been deleted or yanked to the general-purpose buffer can be inserted after the position of the cursor with the command
- :put
- :/i
- p
- Control-Insert
A: p
If right: Correct!
If wrong: the p comand pastes the text into the work buffer after the position of the cursor.

Q: In Vim, how can you view the files in your home directory without exiting the editor?
- enter the command :/ls $HOME
- enter the command  :!ls ~
- enter the command  :shell the do an ls command.
- none of the above.
A: enter the command  :!ls ~
If right: Very good.
If wrong: The command is :!ls ~

Q: What is the name of the startup file which sets the parameters for vim?
- .bash_profile
- .bashrc
- VIMINIT
- .vimrc
A: .vimrc
If right: .vimrc is the vim startup file.
If wrong: .vimrc is the vim startup file.

Q: You can change your default login shell with the following command:
- set shell
- setenv shell
- chsh
- Both A and B are correct.
- None of the above
A: chsh
If right: Very good.
If wrong: Refer to the textbook chapter 8 to see the discussion of changing the login shell (chsh).

Q: BASH is an acronym for:
- Bourne Shell
- Born and Korn Shell
- Bourne Again Shell
- Dash Shell
- None of the above
A: Bourne Again Shell
If right: Good answer.
If wrong: Refer to the textbook chapter covering Bourne Again Shell.

Q: Under Bash Shell, the command:  city=Los Angeles
- Creates a user-defined variable, called city, and initializes it to Los Angeles
- Creates a user-defined variables city and initializes it to Los, and tries to execute Angeles as a command.
- Create a user-defined variable, called city, and initializes it to Los and creates a string variable, called Angeles and sets it to a null string.
- None of the above
A: Creates a user-defined variables city and initializes it to Los, and tries to execute Angeles as a command.
If right: Excellent. You can demonstrate this for yourself at the command prompt.
If wrong: It sets city to Los and tries to execute Angeles as a command, which, normally, will generate an error message.

Q: Under Bash shell, the command:

export place=Austin
- Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell
- creates a file called "place" with the contents equal to "Austin".
- generates an error message because the correct command is setenv
- None of the above
A: Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell
If right: Good.
If wrong: Sets the value of place and makes it available to all processes running under the current process.

Q: The Bash Shell is based upon and compatible with the
- The Unix Bourne Shell
- The Korn Shell
- The C Shell
- All of the above.
- None of the above
A: The Unix Bourne Shell
If right: Good answer.
If wrong: The Bash shell is based upon and compatible with the Bourne shell.

Q: Under Bash Shell, the command:  echo The current date is `date`  creates:
- an error message
- screen output with the current date displayed.
- screen output of "The current date is date"
- None of the above
A: screen output with the current date displayed.
If right: Very good.
If wrong: Displays the message "The current date " followed by the output of the date command using command substitution.

Q: Under Bash shell, the environment variable HOME contains the absolute pathname of:
- Your current directory
- Your home directory
- The root directory
- All of the above
- None of the above
A: Your home directory
If right: Correct. Very good.
If wrong: The home directory of the logged in user.

Q: Under Bash shell, the environment variable PATH contains the absolute pathnames of:
- A list of directory paths to be searched to locate an external command
- Your home directory
- Your current directory
- None of the above
A: A list of directory paths to be searched to locate an external command
If right: Good
If wrong: PATH contains the seach path through a list of directories the shell uses to locate commands.

Q: Under Bash shell, the following command creates a user-defined shell variable, called name, and initializes it to John Doe:
- export name="John Doe"
- name= 'John Doe'
- name= "John Doe"
- All of the above
- None of the above because name must be declared before initializing it.
A: All of the above
If right: Very good.
If wrong: All of the first three commands will work.

Q: Under Bash shell, the command:  export CDPATH=$HOME:$HOME/MyFiles  causes:
- the cd command to search the HOME directory
- the cd command to search the MyFiles directory (under the HOME directory)
- the cd command to search the working directory
- all of the above
- None of the above
A: all of the above
If right: Good answer.
If wrong: The cd command will search the HOME directory, the MyFiles directory, then the working directory.

Q: A Bash shell script is:
- saved in an ordinary UNIX file.
- consists of shell commands.
- allows the use of programming logic.
- supports the use of variables.
- All of the above.
A: All of the above.
If right: That is right.
If wrong: It is all of the choices in A, B, C, and D.

Q: Under the Bash Shell the command:  cat myaliases > ronsaka 2> errors  will
- sends any error messages to file "errors"
- redirects stdout to file "ronsaka"
- create the file "ronsaka" even if file "myaliases" does not exist.
- All of the above.
A: All of the above.
If right: That is right.
If wrong: All of the above is the correct choice.

Q: The file ".bashrc" is an example of
- A secret file
- A system file
- A private file
- A startup file
- A configuration file
A: A startup file
If right: Good.
If wrong: It is a startup file.

Q: If a user modifies the .bash_profile file, it can then be executed to put the changes into effect without logging out, by using the command:
- bash .bash_profile
- . .bash_profile
- set .bash_profile
- sh .bash_profile
A: . .bash_profile
If right: Good!!
If wrong: The dot (also known as the source command) can be used to run a startup file to put changes into effect without logging out and loggin back in.

Q: Which of the following commands will declare file descripter 2 (stderr) to be a dupblicate of file descripter 1 (stdout) and sends both to the tr command?
- cat myfile names |& tr "[a-z]" "[A-Z]"
- cat myfile names 1>&2 > tr "[a-z]" "[A-Z]"
- cat myfile names 1&2 | tr "[a-z]"  "[A-Z]"
- None of these will work since you cannot combine stdout and stderr under the Bash Shell.
A: cat myfile names |& tr "[a-z]" "[A-Z]"
If right: Very good.
If wrong: The token |& is shorthand for 2>&! | and either will send output redirected through a pipe to another command.

Q: What comand makes the file:  "myaliases" executable?
- chmod u+x myaliases
- set -e myaliases
- set u+x myaliases
- chmod -e myaliases
A: chmod u+x myaliases
If right: That is good.
If wrong: The command is chmod u+x myaliases.

Q: If whoson is a newly created Bash shell script without execute permissions, what command will allow it to be executed?
- execute whoson
- run whoson
- whoson +x
- whoson
- None of the above
A: None of the above
If right: Very good. A tricky question.
If wrong: The command to run whoson is: bash whoson. So, none of the choices given will work.

Q: If your search path does not include the path to a particular shell file, and you try to run that shell file by typing its name on the command line, what happens?
- You will be prompted to enter the path to the shell file.
- You will get an error message of "command not found"..
- Nothing, and, a prompt for a new command will be displayed.
- None of the above
A: You will get an error message of "command not found"..
If right: Good. command not found is the error.
If wrong: Normally, the error will be "command not found".

Q: The error message:  "permission denied" occurs when:
- an unauthorized user logs into your account.
- a file name entered at the shell prompt is not executable.
- when you misspell a command such as "echo" as "echx".
- None of the above.
A: a file name entered at the shell prompt is not executable.
If right: That is correct.
If wrong: When a file does not have execute permission and is run from the command line, this error will result.

Q: The Bash Shell command to create variable: "SUM" and assign "0" to it is:
- set SUM<0
- SUM=0
- int SUM = 0;
- new SUM; set SUM=0
A: SUM=0
If right: That is correct.
If wrong: Variables are created in the bash Shell when used for the first time. So the command Sum=0, creates the variable and then assigns it a value.

Q: The file:  /bin/sh on a Linux system:
- is a copy of the original Bourne Shell.
- is a link to the Unix /etc/korn shell file.
- is a link to the /bin/bash file.
- None of the above
A: is a link to the /bin/bash file.
If right: This is a link to the bash shell. The original Bourne shell is incorporated into the bash shell.
If wrong: This is a link to the bash shell. The original Bourne shell is incorporated into the bash shell.

Q: The list of directories stored in the PATH variable is known as
- the environment.
- the search path.
- the execution path.
- the metacharacter set.
- None of the above
A: the search path.
If right: Correct.
If wrong: It is the search path used for locating commands and shell scripts.

Q: The command:  find /usr -name ace -print > findout &
- searches for the file:  "ace"
- begins the find search in the directory: "/usr"
- runs the command in the background.
- All of the above.
A: All of the above.
If right: Excellent.
If wrong: The command does all of the things listed in the first three choices.

Q: The command:  echo \$person
- will display the value of the person variable.
- will display the string:  "$person"
- will generate the error message:  "$person not found"
- will search the working directory for the file "person"
A: will display the string:  "$person"
If right: Very good.
If wrong: The back slash "quotes" the leading $ and prevents it from displaying the value of the variable. Instead the string: $person is displayed.

Q: The names of the common shell programs in UNIX are:
- Bourne, Korn, and C shells
- C , X-Windows, and Bourne shells
- Bourne, Bash, and T shells.
- Bourne, Bash, Korn, C, and X Shells.
A: Bourne, Korn, and C shells
If right: Good. They are the Bourne, the Korn, and the C shells.
If wrong: They are the Bourne, the Korn, and the C shells.

Q: Variables "name" and "place" can be made constant by:
- use of the readonly command.
- removing the write permission from each.
- use of the set +r command.
- None of the above.
A: use of the readonly command.
If right: readonly is correct!
If wrong: It is the readonly command.

Q: What is the character used to separate elements on the Linux command line?
- Space character
- Tab character
- Newline character
- All of the above
- None of the above
A: All of the above
If right: Good.
If wrong: It is a space character, a tab, or a newline.

Q: What is the symbol that creates a pipe between commands?
- Greater than sign (>)
- Less than sign (<)
- Tilde (~)
- Colon (:)
- None of the above
A: None of the above
If right: The pipe ( | ) character but it is not one of your choices.
If wrong: It is the pipe ( | ) character but it is not one of the choices. So none of the above is the answer.

Q: When interpreting your commands, the shell assumes the first word you type on the command line is
- a valid Linux command name.
- an option to a command.
- an option argument to the command.
- a command argument to a valid command.
- None of the above
A: a valid Linux command name.
If right: A command name is correct.
If wrong: A command name is correct.

Q: Which command can be used to display the value of a specific variable?
- echo
- cat
- display
- type
A: echo
If right: Excellent.
If wrong: Echo is the answer.

Q: Which of the following is an example of command substitution?
- echo `pwd`
- pwd=/home/user01
- $command=pwd
- echo "pwd"
A: echo `pwd`
If right: Very good.
If wrong: It's the command: echo `pwd`

Q: Why would you want to change your default shell?
- To use a different programming language.
- To execute applications more rapidly.
- To get the different functionality of another shell.
- To create more hidden files
- None of the above
A: To get the different functionality of another shell.
If right: Good..different functionality is correct.
If wrong: To get different functionality.

Q: What command removes the variable "name" that has been created in a shell?
- rm name
- del name
- unset name
- All of the above.
A: unset name
If right: Good. Unset is correct.
If wrong: To remove a variable use the unset command.

Q: If you are logged into the host: "COIS-Linux" what command will change the default Bash Shell prompt to:  "COIS-Linux => "
- PROMPT=/host /=>
- PS1=/HOST / +>
- PS1="/h / => "
- PS1='\h => '
A: PS1='\h => '
If right: Good. PS1 is the prompt variable. \h displays the host and the rest of the prompt is => .
If wrong: PS1 is the prompt variable. \h displays the host and the rest of the prompt is => .

Q: The default value of the IFS variable is:
- a colon
- a semi-colon
- a comma
- None of the above.
A: None of the above.
If right: Good. The default is space:tab:newline, so none of the above is correct.
If wrong: The default is space:tab:newline, so none of the above is correct.

Q: What special character represents 0 or more characters on the Bash shell command line?
- ?
- :
- *
- None of the above
A: *
If right: Good.
If wrong: It is the asterisk (*).

Q: What is the name of the utility program which will prompt the user for information necessary to set the timezone?
- tzselect
- timeset
- set $TIME
- timeselect
A: tzselect
If right: Good.
If wrong: tzselect is a utility which will prompt the user for information necessary to select the correct time zone.

Q: What creates a process under Linux?
- execution of a command utility.
- running a shell script
- running a shell builtin command.
- All of the above
- Both Answers A and B are correct.
A: Both Answers A and B are correct.
If right: Good.
If wrong: And program, command utility, or shell script creates a new process.

Q: What is the name of the root process under Linux?
- root
- init
- parent
- login
A: init
If right: Good.
If wrong: init is the root process.

Q: What command shows a list of the current processes Linux is executing?
- ps
- process
- set
- get
A: ps
If right: Good. ps is correct.
If wrong: ps shows the current executing processes.

Q: What is a PID?
- Personal Identification code
- Process Identification Number
- Program Initiation Designation Number
- Parent Identification Number
A: Process Identification Number
If right: Good.
If wrong: It is the process identification number.

Q: What system calls are made when you run a program from the command line?
- fork() and exec()
- init() and bash()
- process() and exec()
- ps() and init()
A: fork() and exec()
If right: Very good. Tough question!
If wrong: The system makes the fork() system call to create a new child shell and exec() converts it into the executable program.

Q: What command displays commands from the history list?
- show history
- history
- hs
- set history
A: history
If right: Good.
If wrong: The command is history.

Q: How is command line editing implemented under the Bash Shell?
- The pico editor.
- the Editor LIbrary
- the Readline LIbrary
- the Command Library
A: the Readline LIbrary
If right: Good. This is a tough question.
If wrong: The Readline Library is correct.

Q: When using the Readline Library under Bash, what is the default editor mode?
- emacs
- vim
- pico
- ed
A: emacs
If right: Good.
If wrong: It is emacs.

Q: What command will create an alias name dir which will execute the "ls -al" command?
- dir = 'ls -al'
- alias dir='ls -al'
- alias ls -al = dir
- alias = dir<ls -al
A: alias dir='ls -al'
If right: Good.
If wrong: To set the alias dir use the command dir='ls -al'

Q: What is the difference between a shell function and a shell script?
- functions are stored in RAM while scripts are stored on disk.
- functions are preprocessed (parsed) so they start more quickly than a shell script.
- functions are executed in the shell that calls it; while, scripts are executed in a subprocess.
- All of the above
- Only answers A and C are correct.
A: All of the above
If right: Good.
If wrong: All of the above is the answer.

Q: Under Bash, how do you turn on the noclobber feature.
- noclobber="yes"
- set noclobber
- set -o noclobber
- None of the above
A: set -o noclobber
If right: Very good. Tricky question.
If wrong: set -o noclobber turns on the noclobber feature.

Q: How do double quotation marks (") differ from single quotation marks (') affect expansion on the command line?
- single quotations permit variable expansion while double quotations do not.
- double quotations permit variable and parameter expansion while single quotations suppress all expansions.
- double quotations suppress all expansions while single quotation permit both variable and parameter expansion.
- There is no difference between double and single quotations.
A: double quotations permit variable and parameter expansion while single quotations suppress all expansions.
If right: Good. Another tough questions.
If wrong: The command: echo "Your home directory is: $HOME" produces output such as: Your home directory is /home/rbass. While the command echo 'Your home directory is: $HOME" produces the output: Your home directory is $HOME. So, double quotation allow variable and parameter expansion while single quotation does not.

Q: What is the difference in output between these two command:

echo The working directory is `pwd`

echo The working directory is $(pwd)
- The first displays:  The working directory is pwd

while the second displays the working directory is (pwd)
- In the first command pwd is expanded to display the working directory, while in the second command the variable pwd is displayed.
- In the second command the result of the command pwd is placed in parentheses, while in the first there are no parentheses.
- No difference
A: No difference
If right: Good. Difficult question.
If wrong: They are identical in result.

Q: Under tcsh shell, the environment variable:

home
contains the absolute pathname of:
- Your current directory
- Your home directory
- The root directory
- All of the above
- None of the above
A: Your home directory
If right: Good.
If wrong: Both the Tcsh shell (home) and Bash shell (HOME) use a similar (except for capitalization) variable name to store the users home directory.

Q: The command:

echo `who | more`
- Displays output of the who | more command
- Displays the text "who | more"
- Display the user id and his/her demographic data.
- None of the above
A: Displays output of the who | more command
If right: Good you noted the grave accent marks which creates command substitution.
If wrong: Note the grave accent marks. They cause the command to execute as part of the echo command.

Q: Under tcsh shell, the command:

setenv place "New Haven"
- Initializes the shell variable place to New Haven and makes a copy of it available to any commands/scripts executed under the shell
- Initializes the shell variable place to New Haven and makes it available to the user each time he/she logs in.
- creates an error
- None of the above
A: Initializes the shell variable place to New Haven and makes a copy of it available to any commands/scripts executed under the shell
If right: Very good
If wrong: setenv works like export under the bash shell. It creates the variable and assigns the string following it as the initial value. Note that no equal sign is used.

Q: Under tcsh shell, the environment variable: path contains the absolute pathname of:
- A set of directories to be searched to locate a command or executable program.
- Your home directory
- Your current directory
- None of the above
A: A set of directories to be searched to locate a command or executable program.
If right: Excellent.
If wrong: path under the Tcsh shell is equivalent to PATH under Bash shell. It contains the search path used to locate commands and programs.

Q: Assume you are using a Linux system running a tcsh login shell, what local startup files will run when you login?
- ~/.bashrc, ~/.tcshrc, and ~/.bash_profile.
- /etc/.cshlogin, ~/.start and ~/.login
- Either ~/.tcshrc or ~/.cshrc; and ~/.login
- ~/.cshrc, ~/.myprofile, and /etc/.login.
A: Either ~/.tcshrc or ~/.cshrc; and ~/.login
If right: Correct!
If wrong: The Tcsh shell will run either ~/.tcshrc or ~/.cshrc; and ~/.login.

Q: Assuming that execute permission for a shell script named: "testscript" has not been set to on, then this script:
- cannot be executed.
- can be executed with the command: /bin/tcsh testscript
- can be executed by adding as the first line in the script #!/bin/tcsh
- can be executed by typing run testscript.
A: can be executed with the command: /bin/tcsh testscript
If right: That is very good.
If wrong: It can be executed by typing the shell name first then the script, /bin/tcsh testscript.

Q: Which of the following features are common to both the tcsh shell and the bash shell?
- Aliases
- Job control
- Command substitution
- All of the above.
- None of the above are common to both shells.
A: All of the above.
If right: Very good.
If wrong: Command-line expansion, history, aliases, job control, directory stack manipulation, and command substitution are common to both the tcsh Shell and the bash Shell.

Q: Assume that xfile does not exist and yfile contains the string "hello world", under the Tcsh, what are the contents of the hold file after executing the following command?

cat xfile yfile >& hold
- hello world

hello world
- No such file or directory

hello world
- Error

No such file or directory
- hello world

error: file not found
- None of the above
A: No such file or directory

hello world
If right: Very good.
If wrong: The output will be: No such file or directory hello world

Q: Given the following tcsh shell statement:
if ( ($#argv == 0) || ($#argv > 1) )
then
echo "Usage: $0 ordinary file"
exit 1
endif
what condition will cause the echo command to be executed?
- when $#argv is 1.
- if no file name is listed on the command line.
- if more than one filename is listed on the command line.
- B and C only.
- None of the above.
A: B and C only.
If right: That is correct.
If wrong: If any circumstance other than a single file name entered on the command line occurs, the echo comand showing an error message will be displayed.

Q: Given the following block of code in a tcsh shell  script:

#EXAMPLE C
set option = $argv[1]
switch ("$option")
case [dD]: date
breaksw
case [lL]: ls
breaksw
case [wW]: who
breaksw
case [qQ]: exit 0
breaksw
endsw

What value of $option will cause the date to be displayed?
- d
- D
- dD
- All of the above.
- Responses A or B will work.
A: Responses A or B will work.
If right: Very good.
If wrong: Either a lowercase "d" or uppercase "D" will work.

Q: Given the following code segment in a tcsh shell script,

while ("$secretcode" != "$yourguess")
echo "Good guess but try again!"
echo -n "Enter your guess: "
set yourguess = `head -1`
end

What will cause the loop to continue?
- When $yourguess is equal to $secretcode.
- When $secretcode gets a new value.
- When $secretcode is equal to head -1
- When $yourguess is not equal to $secretcode.
A: When $yourguess is not equal to $secretcode.
If right: Good!
If wrong: The loop will continue while $yourguess and $secretcode are not equal.

Q: Given the following statement, in tcsh Shell script: demo1:
if ( -f $argv[1] )
then
set filename = $argv[1]
set fileinfo = `ls -il $filename`
endif
What will be the value of $filename if the following command line is entered?
demo1 customers addresses
- it will be equal to customers.
- it will be equal to addresses.
- it's value is undefined because 2 filenames were entered..
- it's value is demo1.
A: it will be equal to customers.
If right: Very good.
If wrong: It is customers.

Q: How can you execute a bash shell script from a tcsh login shell?
- by making the first character in the file anthing but a #
- enter on the first line of the script the statement: #! /bin/bash
- run the script with the command: "/bin/bash scriptname".
- All of the above.
A: All of the above.
If right: Very good.
If wrong: All of the above is correct.

Q: The first argument on the command line when executing a tcsh shell script is stored in the variable:
- $argv[1]
- #1
- argument1
- A or B is correct.
A: $argv[1]
If right: That is correct.
If wrong: It is $argv[1] or $1.

Q: The purpose of the following line in a tcsh shell script:

#!/bin/tcsh

is to:
- cause the script to be executed as a tcsh shell script only..
- allow the script to be run as a tcsh shell script from a bash shell.
- assures that the tcsh shell is the one used to interpret the script.
- All of the above
- A and B only.
A: All of the above
If right: That is correct.
If wrong: The first 3 answers are correct, thus all of the above is the answer.

Q: The relationship between the C shell and the tcsh shell is:
- that they are identical.
- that the tcsh shell is an expanded version of the C shell.
- no relationship at all.
- that the tcsh shell is also a C language interpretor.
A: that the tcsh shell is an expanded version of the C shell.
If right: Very good.
If wrong: The tcsh shell is an expansion of the C shell.

Q: Using the tcsh Shell, the total number of command line arguments is stored in variable:
- $#argv
- $!
- $@
- All of the above
- Both A and B
A: $#argv
If right: That is correct.
If wrong: $#argv contains the number of command line arguments.

Q: What tcsh Shell command will create variable username and assign it the value of "George W. Bush"?
- set username = George W. Bush
- setenv username "George W. Bush"
- @username = George W. Bush
- All of the above
A: setenv username "George W. Bush"
If right: Very good!!
If wrong: All are close but only B is correct.

Q: What tcsh Shell environmental variable is set equal to the path of the current working directory?
- $dir
- $cwd
- $pwd
- $wd
A: $cwd
If right: Very good.
If wrong: It is $cwd in the tcsh shell.

Q: What tcsh command will remove variable:  country  ?
- country = null
- set country
- unset country
- None of the above.
A: unset country
If right: Very good.
If wrong: The command is unset country.

Q: What is the result of the following tcsh Shell command?

set line = "$<"
- outputs the first line of a redirected text file.
- reads one one line from stdin into variable "line".
- resets the variable "line" to the string "head 1"
- stores the first line of head in variable "line".
A: reads one one line from stdin into variable "line".
If right: That is right!
If wrong: In the tcsh shell this stores the first line of stdin in variable "line".

Q: What is the result of the following tcsh Shell command?
set name = John Doe II
- variable name is created with the value of John Doe II.
- variable name is created with value of John.
- variables name, Doe and II are created.
- None of the above
- B and C are correct.
A: B and C are correct.
If right: Very good.
If wrong: set created name with value John, but also created Doe and II as variables.

Q: If the first character in a shell script is NOT a #, the tcsh runs the script:
- under the default shell: tcsh
- under bash or dashf shells
- under sh shell
- Both answers B and C are correct.
- None of these since the first character must be a # or tcsh generates an error.
A: under bash or dashf shells
If right: That is great!
If wrong: Tcsh uses either bash or dash depending on the default value Linux has assigned to run a shell script if it does not begin with a #. If the first character is a #, tcsh uses the tcsh shell to run the script.

Q: When using the tcsh Shell, values can be assigned to shell variables with the command:
- @
- set
- setenv
- All of the above
- B and C only.
A: All of the above
If right: Excellent.
If wrong: Any of the commands will work in the tcsh shell.

Q: Which tcsh shell command is used to export a variable to new sub shells so they will be "global"?
- export $variable
- setenv variable "some value"
- set variable = "some value"
- This is not possible in the tcsh shell.
A: setenv variable "some value"
If right: Very good.
If wrong: The command is setenv.

Q: How can you interrupt the following script?

#!/bin/tcsh

onintr close

while (1)

echo "Program is running in a loop"

sleep 2

end

close:

rm -f /tmp/$$*

echo "End of Program"
- Enter a SHIFT-I
- Enter CONTROL-C
- Enter the ESC key
- Type "kill last"
A: Enter CONTROL-C
If right: Very good.
If wrong: Enter a CONTROL-C (a keyboard interrupt).

Q: Given, the following tcsh shell command, what is the value of buffer[4]?

buffer = (6 9 3 7 2 4 8 1)
- 2
- 7
- 4
- 0
A: 7
If right: Good. Under the tcsh shell (unlike the bash shell) buffer is an array with the first position being buffer[1].
If wrong: Buffer is an array with the first position being buffer[1]. So, buffer[4] is equal to 7.

Q: What are "builtin" commands?
- They are the executable command files located in /usr/bin/builtin.
- They are the system calls to the Linux kernel.
- They are the command files which are packaged with the Linux distribution.
- None of the above.
A: None of the above.
If right: Very good.
If wrong: Builtins that are part of the shell and it is not necessary to fork a new process to use them. Examples are alias, cd, echo and exit.

Q: What is globbing?
- Globbing is the byproduct of creating too many aliases.
- Globbing occurs when you inadvertently modify the path variable to omit /usr/bin.
- Globbing refers to the matching of strings containing special characters such as *
- Globbing refers to the process of creating environmental variables with identical values but different names.
A: Globbing refers to the matching of strings containing special characters such as *
If right: Very good.
If wrong: Globbing is tcsh shell term that refers to matching of strings containing special characters. For example the command: ls *.c will list all files that have the .c extension.

Q: What command allows you to logout without terminating background processes.
- continue
- nohup
- logout -n
- break -e
A: nohup
If right: Very good.
If wrong: the nohup command allows a background process to continue even when you logout. For example: nohup find / -name core -print > corefiles.out &

Q: You can display names and current values of all bash shell environment variables with the following command:
- printenv
- setenv
- env
- Both A and C are correct.
- None of the above
A: Both A and C are correct.
If right: Very good.
If wrong: Printenv and env both display environmental variables and their values when issued without parameters.

Q: If the bash shell variable total is equal to 15, which of the following commands displays 3?
- echo `$ (($total / 4))`
- echo `$(($total%4))`
- echo `$(($total/5))`
- All of the above
- None of the above
A: All of the above
If right: Excellent
If wrong: All of the first 3 choices are correct..

Q: If the current value of the bash shell variable total is equal to 10, the following command displays 100:
- echo `$total \* 10`
- echo $((total*10))
- echo `pow($total,2))`
- Both A and C are correct
- None of the above
A: echo $((total*10))
If right: Very good.
If wrong: You can do arithmetic expression in the bash shell with expressions such as $((total*10))

Q: Inside a bash shell script, you can access the PID of the script using which of the following environment variables:
- $#
- $!
- $$
- All of the above
- None of the above
A: $$
If right: Good answer to a difficult question.
If wrong: The variable containing the PID is $$.

Q: Which of the following commands increments the value of a bash shell variable, sum, by one:
- sum = $sum + 1
- sum=$(($sum+1))
- sum += 1
- $sum++
- Both A and B are correct.
A: sum=$(($sum+1))
If right: Very good.
If wrong: The expression sum=$(($sum+1)) is correct.

Q: Under the bash shell, the command

set $(date)
is used to:
- Displays the output of the command:  date
- Sets the variable argv to the the output of the date command
- Set the positional parameters to the output of the date command
- Both A and C are correct.
- None of the above
A: Set the positional parameters to the output of the date command
If right: Good answer.
If wrong: set can be used to set the values of the positional parameters.

Q: Under bash shell, you can use the following command to read a line from stdin into a variable called word:
- read word
- set word = `head 1`
- @ word < `head 1`
- readline word
- None of the above
A: read word
If right: Good answer.
If wrong: The read command is used to read data from stdin and assign it to a variable.

Q: When the command:

kill 12345
is executed, the following signal is sent to the process with process ID 12345:
- HUP
- TERM
- INT
- SIGKILL
- None of the above
A: TERM
If right: TERM or SIGTERM is correct
If wrong: Since it is not specified in this command, TERM was sent by default.

Q: You can display the signals supported by your Linux system with the following command:
- echo $signals
- kill -l
- onintr all
- All of the above
- None of the above
A: kill -l
If right: Excellent
If wrong: The kill command with the -l option is used to list the signals available.

Q: A function is used:
- to create an encapsulated block of code to be called when needed in a shell script.
- must be created in a C program and then compiled.
- is legal only in the tcsh shell.
- none of the above.
A: to create an encapsulated block of code to be called when needed in a shell script.
If right: That is correct.
If wrong: Functions in a shell script are similar to functions in any programming language.

Q: A keyboard interrupt is:
- created by typing CONTROL- C.
- generates signal 9.
- defaults to the killall command.
- All of the above.
- A and B only.
A: created by typing CONTROL- C.
If right: Very good.
If wrong: CONTROL-C is the keyboard interrupt.

Q: An interrupt is generated by:
- entering control C.
- logging out of the system.
- by the kill command.
- All of the above.
- A and C only.
A: All of the above.
If right: That is correct.
If wrong: A, B, and C all generate an interrupt.

Q: Assume the following is entered into a bash shell script:

ct=0
ls ~ | while read file
do
ct=$(($ct+1))
echo $ct. $file
done
What will be displayed?
- The count of the number of files in the user's home directory.
- Each entry in the user's home directory.
- The file permissions of each entry in the user's home directory.
- All of the above.
- A and B only.
A: A and B only.
If right: That is correct.
If wrong: A numbered list of the entries in the user's home directory will be displayed.

Q: Assume the following statement occurs first in a bash shell script:
if [ $# = 0 ]
then
directory="~"
fi
What happens if the shell script is run without an argument?
- The user's home directory is used.
- The current working directory is used.
- The user will be asked to supply a directory.
- None of the above.
A: The user's home directory is used.
If right: Correct.
If wrong: The home directory is used. ~ is shorthand for $HOME

Q: If the command:
exec date
is typed at the bash command line, what happens.
- the date is displayed.
- the login session is terminated.
- an error occurs.
- All of the above.
- A and B only.
A: A and B only.
If right: That is correct.
If wrong: The date is displayed but the login session is then terminated. There is no error.

Q: If the following command occurs in a bash shell script:
trap ' ' 2 3
what will occur when it is executed.
- the interrupts in the list are ignored.
- signals 2 and 3 will cause the script to terminate.
- all signals except 2 and 3 are ignored.
- the trap command works only in the tcsh shell.
A: the interrupts in the list are ignored.
If right: Very good.
If wrong: The interrupt signals listed are ignored.

Q: In the shell script below, what occurs if no command line argument is entered after the script name?

#!/usr/bin/bash
# EXAMPLE shell script
# Filename addall
# Purpose: To demonstrate use of numeric calculations

# Brief Description: Maintain running sum of numbers in a numeric

# variable called sum, starting with 0. Read

# the next integer and add it to sum. When all

# elements have been read, stop and display the

# answer.

# If run with no arguments, inform the user of command syntax

if [ $# = 0 ]

then

echo .Usage: $0 number-list.

exit 1

fi

sum=0 # Running sum initialized to 0

count=0 # Count the count of numbers passed as arguments

while [ $# != 0 ]

do

sum=$((sum+$1)) # Add the next number to the running sum

count=$((count+1)) # Update count of numbers added so far

shift # Shift the counted number out

done

# Display final sum

echo .The sum of the given $count numbers is $sum..

exit 0
- The correct usage message

"Usage: addall number-list"

is displayed.
- The script stops without doing any calculations.
- There are no numbers to add.
- All of the above.
- A and C only.
A: All of the above.
If right: That is correct.
If wrong: It prints a proper usage message, exits and does not add any numbers.

Q: Referring to the shell script below, what is the purpose of the exit commands?

#!/usr/bin/bash
# EXAMPLE shell script
# Filename addall
# Purpose: To demonstrate use of numeric calculations

# Brief Description: Maintain running sum of numbers in a numeric

# variable called sum, starting with 0. Read

# the next integer and add it to sum. When all

# elements have been read, stop and display the

# answer.

# If run with no arguments, inform the user of command syntax

if [ $# = 0 ]

then

echo .Usage: $0 number-list.

exit 1

fi

sum=0 # Running sum initialized to 0

count=0 # Count the count of numbers passed as arguments

while [ $# != 0 ]

do

sum=$((sum+$1)) # Add the next number to the running sum

count=$((count+1)) # Update count of numbers added so far

shift # Shift the counted number out

done

# Display final sum

echo .The sum of the given $count numbers is $sum..

exit 0
- Provides an exit from the loop.
- Terminates the shell script.
- Provide a numeric exit status value.
- All of the above.
- B and C only.
A: B and C only.
If right: That is correct.
If wrong: The script terminates and provides an numeric exit value.

Q: Referring to the shell script below, what is the value of $# when the loop terminates?

#!/usr/bin/bash
# EXAMPLE shell script
# Filename addall
# Purpose: To demonstrate use of numeric calculations

# Brief Description: Maintain running sum of numbers in a numeric

# variable called sum, starting with 0. Read

# the next integer and add it to sum. When all

# elements have been read, stop and display the

# answer.

# If run with no arguments, inform the user of command syntax

if [ $# = 0 ]

then

echo .Usage: $0 number-list.

exit 1

fi

sum=0 # Running sum initialized to 0

count=0 # Count the count of numbers passed as arguments

while [ $# != 0 ]

do

sum=$((sum+$1)) # Add the next number to the running sum

count=$((count+1)) # Update count of numbers added so far

shift # Shift the counted number out

done

# Display final sum

echo .The sum of the given $count numbers is $sum..

exit 0
- 0
- 7
- 1
- undefined
A: 0
If right: That's right.
If wrong: It is 0.

Q: Referring to the example shell script below, what would happen if you deleted the shift command?

#!/usr/bin/bash
# EXAMPLE shell script
# Filename addall
# Purpose: To demonstrate use of numeric calculations

# Brief Description: Maintain running sum of numbers in a numeric

# variable called sum, starting with 0. Read

# the next integer and add it to sum. When all

# elements have been read, stop and display the

# answer.

# If run with no arguments, inform the user of command syntax

if [ $# = 0 ]

then

echo .Usage: $0 number-list.

exit 1

fi

sum=0 # Running sum initialized to 0

count=0 # Count the count of numbers passed as arguments

while [ $# != 0 ]

do

sum=$((sum+$1)) # Add the next number to the running sum

count=$((count+1)) # Update count of numbers added so far

shift # Shift the counted number out

done

# Display final sum

echo .The sum of the given $count numbers is $sum..

exit 0
- An infinitely executing loop occurs.
- Both Sum and Count would be equal to 7.
- The exit status is set to 1.
- All of the above.
A: An infinitely executing loop occurs.
If right: That is correct.
If wrong: This would cause an infinite loop.

Q: Referring to the shell script below, what does the shift command do?

#!/usr/bin/bash
# EXAMPLE shell script
# Filename addall
# Purpose: To demonstrate use of numeric calculations

# Brief Description: Maintain running sum of numbers in a numeric

# variable called sum, starting with 0. Read

# the next integer and add it to sum. When all

# elements have been read, stop and display the

# answer.

# If run with no arguments, inform the user of command syntax

if [ $# = 0 ]

then

echo .Usage: $0 number-list.

exit 1

fi

sum=0 # Running sum initialized to 0

count=0 # Count the count of numbers passed as arguments

while [ $# != 0 ]

do

sum=$((sum+$1)) # Add the next number to the running sum

count=$((count+1)) # Update count of numbers added so far

shift # Shift the counted number out

done

# Display final sum

echo .The sum of the given $count numbers is $sum..

exit 0
- shifts through the arguments on the command line.
- assigns the values on the command line to $1 in sequence.
- causes the value $# to be recalculated.
- All of the above.
- B and C only.
A: All of the above.
If right: Very good!
If wrong: All of the above is correct. It shifts the values from the command line to $1 sequentially and recounts the aruguments to be processed.

Q: Referring to the following shell script, what would happen if a user typed the following command line?

command line:  addall 1 4 9 16 25 36 49

#!/usr/bin/bash
# EXAMPLE shell script
# Filename addall
# Purpose: To demonstrate use of numeric calculations

# Brief Description: Maintain running sum of numbers in a numeric

# variable called sum, starting with 0. Read

# the next integer and add it to sum. When all

# elements have been read, stop and display the

# answer.

# If run with no arguments, inform the user of command syntax

if [ $# = 0 ]

then

echo .Usage: $0 number-list.

exit 1

fi

sum=0 # Running sum initialized to 0

count=0 # Count the count of numbers passed as arguments

while [ $# != 0 ]

do

let sum=sum+$1 # Add the next number to the running sum

let count=count+1 # Update count of numbers added so far

shift # Shift the counted number out

done

# Display final sum

echo .The sum of the given $count numbers is $sum..

exit 0
- count is equal to 7
- sum is equal to 139
- an error occurs after the done statement
- all of the above.
A: count is equal to 7
If right: That's right.
If wrong: The count is 7 and the sume is 140. There is no error. The let command is an alterntive way of doing integer arithmetic in the bash shell.

Q: The exec command can be used to:
- to open and close file descriptors.
- to make a file executable.
- to allow a superuser login session.
- All of the above.
A: to open and close file descriptors.
If right: Very good.
If wrong: It can be used to open and close file descriptors.

Q: In the bash Shell the following command
exec < customer
results in the following:
- Opens file customer as stdin.
- Attaches file customer to stdout.
- Executes shell script customer.
- None of the above.
A: Opens file customer as stdin.
If right: That is right.
If wrong: It opens the file and it replaces stdin until it is closed.

Q: The hangup interrupt is created when:
- a user disconnects from a connection.
- a user logs out of the system.
- a time out occurs in the time sharing algorithm.
- All of the above
- A and B only.
A: A and B only.
If right: That's right.
If wrong: A hangup interrupt occurs when a system disconnect occurs through a logout or a communication disconnect occurs.

Q: The here document:
- is standard on Linux systems and can be found at /usr/sbin/here.
- is useful in encapsulating data which changes frequently
- is available only in the tcsh shell.
- redirects standard input to a command and attaches it to data typed into a script.
A: redirects standard input to a command and attaches it to data typed into a script.
If right: Very good.
If wrong: The here document allows data to be entered directly into a script and then directed to a command.

Q: The interrupt processing feature of the bash shell:
- allows a shell to ignore interrupts.
- intercepts an interrupt and takes a specified action.
- allows the creation of new interrupts as desired.
- All of the above.
- A and B only.
A: A and B only.
If right: That is correct.
If wrong: An interrupt can be ignored or used to trigger some user specified action.

Q: How are arithmetic calculations performed in a bash shell command?
- using the an expression such as x=$((365*24))
- using the "calc"; for example calc x=365*24
- using the assignment operator; for example x=365*24
- arithmetic calculations can't be performed in a bash shell command
A: using the an expression such as x=$((365*24))
If right: That is correct.
If wrong: Using expressions such as sum=$((sum+$1)) # Add the next number to a running sum count=$((count+1)) # Update count of numbers allows the user to do arithmetic calculations .

Q: What does the following command do?

mystery () {

who

date

ls

}
- Executes the function called mystery.
- creates a shell script encapsulating who, date, and ls.
- Creates a function that will execute the commands: who, date , and ls in sequence when called
- All of the above
- A and C only.
A: Creates a function that will execute the commands: who, date , and ls in sequence when called
If right: That is right.
If wrong: It creates the function mystery, but the function does not execute until called with the command: mystery

Q: What is the result of the following command line?  echo Number of days in 60 years: $((60*365))
- generates an "unexpected token" error message
- displays: Number of days in 60 years:  21900
- displays  "Number of days in 60 years:  $((60*365))"
- none of these; you must use the let command.
A: displays: Number of days in 60 years:  21900
If right: Very good.
If wrong: This expression will calculate 60*365 and display it.

Q: A bash shell script is:
- saved in an ordinary Linux file.
- consists of shell commands.
- allows the use of programming logic.
- supports the use of variables.
- All of the above.
A: All of the above.
If right: That is right.
If wrong: It is all of the choices in A, B, C, and D.

Q: A command line argument is:
- required for shell scripts.
- a user defined variable.
- also known as a positional argument.
- All of the above.
A: also known as a positional argument.
If right: That is right.
If wrong: A command line argument is also a positional parameter.

Q: A bash shell script file is executable if
- it has execute permission/s set using the chmod command.
- it has or can be given an ".exe" extension.
- C.it is placed in the /usr/bin directory.
- D. it is preprocessed with the bash shell script interpreter
A: it has execute permission/s set using the chmod command.
If right: That is correct.
If wrong: It has execute permission for the owner, group members or other users.

Q: An interrupt can be sent to the shell by:
- entering CONTROL-C.
- logging out of the system.
- with the kill command.
- D. All of the above.
- E. A and C only.
A: D. All of the above.
If right: That is correct.
If wrong: A, B, and C all generate an interrupt.

Q: Assume the following statement occurs first in a bash shell script:

if [ $# = 0 ]
then
directory="."
fi

What happens if the shell script is run without an argument?
- The user's home directory is assigned to directory.
- The current working directory is assigned to directory.
- The user will be asked to supply a directory.
- None of the above.
A: The current working directory is assigned to directory.
If right: Correct.
If wrong: The current working directory (designated by the dot ( . ) )is assigned to directory.

Q: Assume you are given the following shell script:

#!/bin/tcsh
#Positional Parameters
foreach filename (`cat filelist`)
set argv = `ls -il $filename`
set inode = $argv[1]
set size = $argv[5]
echo $filename $inode $size
end

What is the value of $argv[1]?
- The string "ls"
- First value listed in filelist.
- The first field of the output of ls -il.
- None of the above.
A: The first field of the output of ls -il.
If right: Correct!
If wrong: It's the first field in the output of ls -il.

Q: Assuming that execute permission for a tcsh shell script named: "testscript" is not given, then the script:
- cannot be executed.
- can be executed with the command: /bin/tcsh testscript
- can be executed by adding as the first line in the script:  #!/bin/tcsh.
- can be executed by typing /usr/bin/sh testscript.
A: can be executed with the command: /bin/tcsh testscript
If right: That is very good.
If wrong: It can be executed by typing the shell name "/bin/tcsh" first then the script.name

Q: Given the following command line using the tcsh shell:

displayit Hello World! Welcome to Linux

What variable or parameter will contain the word "Welcome".
- $argv[3]
- displayit
- $4
- None of these.
- Both A and C.
A: $argv[3]
If right: Very good.
If wrong: argv[3] is the correct answer.

Q: Given the following statement using the tcsh shell in the shell script : demo1:

if ( -f $argv[1] ) then
set filename = $argv[1]
set fileinfo = `ls -il $filename`
endif

What will be the value of $filename if the following command line is entered?

demo1 customers addresses
- it will be equal to addresses.
- it will be equal to customers.
- it's value is undefined because 2 filenames were entered..
- it's value is demo1.
A: it will be equal to customers.
If right: Very good.
If wrong: It will be customers.

Q: How can you run a tcsh shell script file: "scriptX", when your current login shell is the bash shell?
- enter /bin/tcsh scriptX on the command line.
- insert #!/user/bin/tcshell as the first line in scriptX before running it..
- enter start tcsh at the command line then run scriptX under the new shell.
- All of these are correct.
- None of these is correct.
A: enter /bin/tcsh scriptX on the command line.
If right: That is correct.
If wrong: Enter /bin/tcsh scriptX on the command line.

Q: If the following bash shell command lines are entered:

exec > data
ls ~
exec > /dev/tty # /dev/tty is the display screen

What happens?
- the directory listing of your home directory is stored in file data.
- the first name in file data is used as $1 in the ls command.
- data is executed and the shell terminates before the ls command is performed.
- the output of the command is sent to /dev/tty.
- E. None of the above.
A: the directory listing of your home directory is stored in file data.
If right: That is right.
If wrong: The output of the command "ls ~" is stored in file data.

Q: In Linux, PID means:
- Potential Identification
- Printer Identification
- Program Identification
- Process Identification
A: Process Identification
If right: Process ID is correct.
If wrong: It's process ID.

Q: In the bash shell, when will the following if statement yield a true result?

if [ -d $1 ]
then
echo "This is a ???"
fi
- when $1 is a hard link to another file.
- when $1 has been deleted.
- when $1 is a directory name.
- when $1 has the write permission set.
A: when $1 is a directory name.
If right: Excellent.
If wrong: If $1 is a directory the statement will be true.

Q: Refer to the example below. How many times does the loop execute?

#!/bin/tcsh
#Foreach Loop Demo
foreach filename (`cat filelist`)
set argv = `ls -il $filename`
set inode = $argv[1]
set size = $argv[5]
echo $filename $inode $size
end
- Once for each value in the current working directory.
- Impossible to know without counting the values in the directory.
- Once for each separate value in the file: "filelist".
- Until there are no more files in the current working directory.
A: Once for each separate value in the file: "filelist".
If right: That is correct.
If wrong: Each value in the file becomes the value of filename until there are no more values.

Q: Refer to the example below. What is argv?

#!/bin/tcsh
#foreach Loop Demonstration
foreach filename (`cat filelist`)
set argv = `ls -il $filename`
set inode = $argv[1]
set size = $argv[5]
echo $filename $inode $size
end
- An array of positional parameters.
- A generic reference to the values in argc
- It is an array defined by the script author
- None of the above
- A and B only.
A: An array of positional parameters.
If right: That's right.
If wrong: It is an array of positional parameters.

Q: The bash shell command to create variable: "SUM" and assign "0" to it is:
- set SUM to 0
- integer SUM=0
- SUM=0
- declare SUM=0
A: SUM=0
If right: That is correct.
If wrong: Variables are created in the bash shell when used the first time. In this case SUM=0 creates it and assigns it an initial value.

Q: The exec system call:
- compiles an external binary command.
- creates the parent process for the command to be executed.
- creates a new sub shell running under the login shell
- All of the above.
- None of the above
A: None of the above
If right: That is very good.
If wrong: The answer is none of the above.

Q: The exit status of any successfully executing Linux command or program is set to:
- 1
- false
- 0
- true
A: 0
If right: Excellent.
If wrong: It is a zero.

Q: The interrupt processing feature of the bash shell:
- allows the creation of new interrupts as needed.
- intercepts an interrupt and either: takes a specified action or ignores it
- will cause the login shell to terminate.
- All of the above.
- None of the above.
A: intercepts an interrupt and either: takes a specified action or ignores it
If right: That is correct.
If wrong: An interrupt can be ignored or used to trigger some user specified action.

Q: The name of the program or command is stored in the bash shell parameter:
- $0
- $1
- $#
- $Name
- $PROGRAM
A: $0
If right: Very good.
If wrong: It is $0.

Q: The process that is created by the fork system call:
- is an exact copy of the original process.
- is called the child process.
- will terminate the parent process.
- None of the above
- Both A and B (but not C) are correct.
A: Both A and B (but not C) are correct.
If right: Very good.
If wrong: It is both a child process and is an exact replica of the parent.

Q: What command in the tcsh shell will create variable username, assign it the value of "George W. Bush", and exports it to subsequent shells?
- set username = George W. Bush
- setenv username "George W. Bush"
- @username = George W. Bush
- username="George W. Bush"
A: setenv username "George W. Bush"
If right: Very good!!
If wrong: It is setenv username "George W. Bush"

Q: What is the output of the following bash shell script file, when the input is: "UNIX rules the computing world!"?

#!/bin/bash
echo "Enter a line of input: "
read word1 word2 word3
echo $word3
- the
- rules
- the computing world!
- UNIX rules the
A: the computing world!
If right: Very good.
If wrong: In this script, word3 contains the remainder of the data on the line.

Q: What is the output of the following bash shell script?

#!/bin/bash
set `date`
echo $2 $3, $6

Assume the output of the date command to be: Wed Jul 4 12:12:12 CDT 2001
- Wed July , 2001
- Jul 4, CDT
- Wed Jul 4, 2001
- Jul 4, 2001
A: Jul 4, 2001
If right: That is right.
If wrong: It is Jul 4, 2001

Q: What is the output of the following bash shell script?

#!/bin/bash
for name in `cat filelist`
do
echo "$name"
done
- the first line in the file
- $name
- each separate word (string) in the file.
- cat on one line followed by filelist on the second.
A: each separate word (string) in the file.
If right: Very good.
If wrong: It is each word in the file on a separate line.

Q: What bash shell command is used to permit repeated execution of a block of code?
- while
- for
- repeat
- do/until
- both A and B are correct.
A: both A and B are correct.
If right: Excellent.
If wrong: Both the for and while are repetition commands.

Q: What signal (number) is known as the sure kill?
- 1
- 7
- 9
- 11
- 15
A: 9
If right: Nine is correct.
If wrong: It is signal 9.

Q: When a Linux shell command is executed in the foreground:
- it maintains control of the keyboard and the display screen.
- another command can not be started until it is complete.
- access to the shell is lost until the command in the foreground is completed.
- All of the above.
- Both A and C but not B.
A: All of the above.
If right: That is correct.
If wrong: All of the first three are correct.

Q: Which tcsh shell command is used to export a variable to new shells so they will be "global"?
- A. export $variable
- B. setenv variable "some value"
- C. set variable = "some value"
- D. Exporting is not possible in the tcsh shell.
A: B. setenv variable "some value"
If right: Very good.
If wrong: The command is setenv.

Q: What is the output of the command:  ps
- a list of jobs running in the background
- the status of all currently executing processes
- a display of all users and the programs eah is running.
- none of the above
A: none of the above
If right: That is correct.
If wrong: ps is correct.

Q: Which of the following is an example of command substitution?
- A. echo `pwd`
- B. pwd=/home/user01
- C. $command=pwd
- D. echo "pwd"
- E. Both A and D are correct
A: A. echo `pwd`
If right: Very good.
If wrong: It's the command: echo `pwd`

Q: A permission value of 764 for the sample file means that:
- Owner of sample can read, write, or execute sample
- Users in owner s group can read or write sample
- Everyone else can read sample
- All of the above
- None of the above
A: All of the above
If right: All of the above is correct.
If wrong: Study the material in the Chapter covering File Security.

Q: After the chmod 600 sample command has been executed (where sample is a directory):
- Access privileges for sample are set to read and write for the owner
- Nobody other than the owner can perform any operations on sample
- The cd sample command would report an error message, Permission denied (or something similar)
- All of the above
- None of the above
A: All of the above
If right: Removing the execute bit to a directory makes it unsearchable.
If wrong: Study the material in the Chapter covering File Security.

Q: After the chmod a+rw sample command has been executed:
- Removes read and write permission for all Users except the owner
- Nobody (except the superuser) can read or write sample
- Adds read and write permission for all users
- All of the above
- None of the above
A: Adds read and write permission for all users
If right: Removes all access permissions!
If wrong: This command adds read and write permissions for all users but does not change execute permissions.

Q: For the cp file1 ~/dir1/dir2 command to successfully copy file1 into ~/dir1/dir2, you must have:
- Read access for file1, read access for ~ and dir1, and write access for dir2
- Read access for file1, execute access for ~ and dir1, and write access for dir2
- Read access for file1, execute access for ~, dir1, and dir2, and write access for dir2
- All of the above
- None of the above
A: Read access for file1, execute access for ~, dir1, and dir2, and write access for dir2
If right: That's right.
If wrong: Refer to the material in the textbook chapter on File Processing.

Q: If you have any empty directory called ~/backups, you can copy directory ~/courses into it by using the following command:
- cpdir ~/courses ~/backups
- cp -r ~/courses ~/backups
- cp -d  ~/courses ~/backups
- All of the above
- None of the above
A: cp -r ~/courses ~/backups
If right: cp -r is correct
If wrong: Refer to the material in the textbook chapter on File Processing.

Q: If you want to set all three special access bits (SUID, SGID, and sticky) for the sample file and set the rest of its access bits to 754 with one command:
- You need to run the command chmod -s sample command.
- You need to execute the chmod 7754 sample command
- You need to execute the chmod 7547 sample command
- All of the above
- None of the above
A: You need to execute the chmod 7754 sample command
If right: The special access bits are set with the first octal value in a four digit number.
If wrong: Study the material in the Chapter covering File Security.

Q: In the output of the ls - l sample command, the leftmost three letters indicate the:
- Values of the SUID, SGID, and sticky bits for sample
- Type of file and state of read and write privileges for the owner of sample
- State of read, write, and execute permissions for the owner of sample
- All of the above
- None of the above
A: Type of file and state of read and write privileges for the owner of sample
If right: The first character in the string denotes the type of file.
If wrong: Study the material in the Chapter covering File Security.

Q: The command: chmod 600 sample :
- Sets others privileges to read and write
- Takes away all privileges from the owner of sample
- Takes away all privileges from the group users
- All of the above
- None of the above
A: Takes away all privileges from the group users
If right: It does several things but one is to remove privileges for group members.
If wrong: Study the material in the Chapter covering File Security.

Q: A identity of the current working directory can be displayed with what command?
- cwd
- dir
- pwd
- All of the above
- None of the above
A: pwd
If right: Good.
If wrong: pwd is the command to display the present working directory.

Q: A file whose owner has read, write, and execute permissions has file permissions equivalent to an octal value of:
- 7
- 6
- 5
- 4
A: 7
If right: Seven is correct.
If wrong: The answer is 7.

Q: A file with the following permissions: -rwxr-xr-x
- is readable by all users.
- is writeable by the owner only.
- is executable for other users.
- All of the above.
A: All of the above.
If right: That is correct.
If wrong: All is correct.

Q: An inode in Linux
- is an entry in the lost&found directory
- is the control structure for a file.
- can be created by using the mkinode command
- All of the above
- None of the above
A: is the control structure for a file.
If right: Good.
If wrong: An inode is the control structure for a file.

Q: File access permissions are grouped into the categories:
- user, group, and others.
- owner, group, and root.
- owner, others, and all.
- none of the above.
A: user, group, and others.
If right: That's correct.
If wrong: User, group, and others.

Q: File access permissions include:
- input/output, add/delete, and modify.
- owner access, group access, and others.
- read, write, and execute.
- none of these.
A: read, write, and execute.
If right: That's correct.
If wrong: Sorry. It is read, write, and execute.

Q: For a directory, users granted read and execute permissions are allowed to:
- write to the directory.
- delete files in the directory.
- execute files in the directory.
- read the directory's contents.
A: read the directory's contents.
If right: That is correct.
If wrong: It allows a user to read the directory's contents.

Q: For the file with the name: solid, which of the following is not a valid use of the chmod command?
- chmod 777 solid
- chmod ugo-rw solid
- chmod a+x solid
- chmod solid +read
A: chmod solid +read
If right: Correct.
If wrong: All except the last one.

Q: The absolute pathname of a file in Linux starts with the
- Home directory of the user
- users directory on the system
- Root directory on the system
- All of the above
- None of the above
A: Root directory on the system
If right: Correct. Absolute paths start with the root directory.
If wrong: Refer to Chapter 7 in the textbook for more information.

Q: The inode number of a file in LInux is
- Unique for every file
- An integer number between -64372 and +64373
- an integer indicating the physical location of a file on the system hard drive.
- All of the above
- None of the above
A: Unique for every file
If right: Unique to each file is correct.
If wrong: Is unique to each file.

Q: The ls -l ~ displays the long listing of all the files in your
- Home directory
- System s root directory
- $PATH directory
- All of the above
- None of the above
A: Home directory
If right: Home directory denoted by the ~. Good.
If wrong: It is the home directory denoted by the ~

Q: The output of the command: ls -l produces information about each file in the working directory including:
- file name, file size, and time.
- file type, link count, and date.
- owner and owner's group.
- all of the above.
A: all of the above.
If right: That is right!!!!
If wrong: It is all of them.

Q: The relative pathname of a file in Linux
- locates a file relative to the current working directory.
- locates a file relative to the root directory.
- location of a file within a user's home directory only.
- None of the above
A: locates a file relative to the current working directory.
If right: The relative path begins with the current working directory.
If wrong: A relative path traces a path from the working directory.

Q: The root user has the authority to:
- delete all user accounts (including management personnel) on the system without prior notification.
- delete any file on the system including those, that if deleted, would make the system inoperable.
- change or remove any password on the system without prior notification of the user.
- all of the above
- None of the above.
A: all of the above
If right: That's right.
If wrong: The system administrator logs in as the root and may do anything to the system; no matter, how inadvisable.

Q: The set-user-ID bit (SUID) allows an executable file to:
- contain the user's id.
- be changed directly.
- take on the privileges of the owner of the file when it executes.
- All of the above.
A: take on the privileges of the owner of the file when it executes.
If right: Correct!!!
If wrong: See the section on special access bits in the textbook.

Q: Linux supports the following file types:
- Ordinary file, directory, link file, block special file, character special file, named pipe (FIFO), and socket
- Text files, C/C++/Java source files, graphics files, multimedia files, html files, and directories
- Text files, C/C++/Java source files, and directories
- All of the above
- None of the above
A: Ordinary file, directory, link file, block special file, character special file, named pipe (FIFO), and socket
If right: Good.
If wrong: Ordinary file, directory, link file, block special file, character special file, named pipe (FIFO), and socket

Q: What is the result of the following command? chmod 700 myfile
- sets access privileges for myfile to read, write, and execute for the owner.
- removes access permissions to myfile.
- adds read, write and execute permission for all users.
- All of the above.
A: sets access privileges for myfile to read, write, and execute for the owner.
If right: That is correct.
If wrong: sets access privileges for myfile to read, write, and execute for the owner.

Q: What types of files are candidates for having the execution access permissions set for users?
- data files.
- script files.
- configuration files.
- source files.
A: script files.
If right: That is correct.
If wrong: Programs and script files.

Q: When a user is given execute permission for a directory, he/she may:
- read the directory contents.
- write files to the directory.
- search it.
- All of the above.
A: search it.
If right: That is correct.
If wrong: No. It allows searches and the use of the ls command.

Q: Which of the following commands will remove all access permissions to file:  sample  for the group and others?
- chmod go=rwx sample
- chmod a-rw sample
- chmod go= sample
- chmod a= sample
A: chmod go= sample
If right: That's correct.
If wrong: Sorry, please review the chmod command summary in Table 8.5 of the textbook.

Q: A hard link is:
- A new file inode referring to the same data.
- A pointer to the inode of an existing file.
- A new file containing the path name to the original file.
- Any of the above can be a hard link.
A: A pointer to the inode of an existing file.
If right: Correct.
If wrong: A hard link is a pointer to an inode.

Q: After creating a hard link to a file, the original file is deleted, what happens to the hard link?
- It is automatically removed.
- It still points to the file but the original name is deleted.
- It will point to nothing.
- You will get the error:  "Unable to delete this file."
A: It still points to the file but the original name is deleted.
If right: Correct.
If wrong: The original file name is deleted but the hard link still points to the file.

Q: What command will allow you to remove a link to a file?
- rm
- del
- delink
- ln -r
A: rm
If right: Correct!!!
If wrong: rm is correct.

Q: If a file to which a soft link exists is deleted, what happens?
- The soft link points to a non-existent file.
- The soft link is automatically removed.
- A file can not be deleted if a soft link to it exists.
- The original file can be accessed via the softlink even if the original file entry is removed.
A: The soft link points to a non-existent file.
If right: That is correct.
If wrong: A soft link will point to nothing if the original file is removed.

Q: What command will create a soft link named: "mypass" to /etc/passwd?
- ln /etc/passwd mypass
- ln -s mypass /etc/passwd
- ln -s /etc/passwd mypass
- ln mypass /etc/passwd
A: ln -s /etc/passwd mypass
If right: Correct!!
If wrong: The ln command with the -s switch creates a soft link.

Q: What is a soft link?
- A pointer to another file's inode.
- A new file containing the path name to another file.
- A copy of the original file.
- A file with a file node which is a duplicate of the original file's inode.
A: A new file containing the path name to another file.
If right: That is correct.
If wrong: A soft link is a new file with the path name to the original file.

Q: What is the most common and preferred method of sharing files among selected Linux/UNIX users?
- Duplicate files.
- Common logins.
- Common group for selected users.
- links
A: links
If right: Very good.
If wrong: The most common method of file sharing is the use of the link command.

Q: Which command creates a link?
- link
- ln
- cp -l
- None of the above is correct.
A: ln
If right: Correct
If wrong: ln is the command.

Q: Which type of link can be used to create a directory entry to a file in another file system?
- hard link
- soft link
- cross system link
- any type of link will work
A: soft link
If right: That is correct.
If wrong: Soft links are used to link files across file systems.

Q: What command will create a new directory called sourcefiles?
- mkdir sourcefiles
- md sourcefiles
- make sourcefiles
- crdir sourcefiles
A: mkdir sourcefiles
If right: mkdir is the command to create a directory.
If wrong: mkdir is the command to create a directory.

Q: What command will remove directory sourcefiles
- del sourcefiles
- rmdir sourcefiles
- rm sourcefiles
- delete sourcefiles
A: rmdir sourcefiles
If right: Very good.
If wrong: rmdir is the command to remove directories.

Q: What command will change the working directory to /home/rbass/sourcefiles?
- chdir /home/rbass/sourcefiles
- cd /sourcefiles
- cd /home/rbass/sourcefiles
- cdir /home/rbass/sourcefiles
A: cd /home/rbass/sourcefiles
If right: Very good.
If wrong: The linux command to change directory is cd. Since we don't know the present working diretory the full path of the directory must be given.

Q: If myprograms is a directory, what does the command:

rm -r ~/myprograms

do?
- deletes myprograms only if it contains no files.
- recursively deletes files including any subdirectories in myprograms, and then deletes the directory myprograms.
- deletes all the subdirectories in myprograms and moves the files into the primary directory.
- None of the above.
A: recursively deletes files including any subdirectories in myprograms, and then deletes the directory myprograms.
If right: Very good.
If wrong: It is a recursive delete operation which traverses the directory deleting everything in it, then the directory itself.

Q: What directory contains all the files needed by the system for initial startup?
- the root directory
- /bin
- /sbin
- /boot
A: /boot
If right: Good work.
If wrong: /boot contains the files needed for startup.

Q: If a user (not the owner or a group member) can use cd to change to a directory such as /home/rbass/studentstuff; and use ls to view the files in the directory; what permissions must be set?
- Read and write for other users.
- Read and execute for the owner.
- Read and execute for other users.
- Read and write for the owner.
A: Read and execute for other users.
If right: Very good.
If wrong: You must have read and execute permission to cd to a directory and ls it's contents.

Q: The shell expands the characters:  ~/ (a tilde followed by a slash) at the start of a pathname
- into the pathname of your home directory.
- into the pathname of the working directory.
- into the pathname of the parent directory.
- into the pathname of the root directory.
A: into the pathname of your home directory.
If right: Good. A tilde is a reference to your home directory.
If wrong: A tilde is expanded into the the value of the HOME variable (the path to your home directory).

Q: To dereference a symbolic link means:
- to remove the link to the target file.
- to follow the link to the target file.
- to change the symbolic link to the target file to a hard link.
- to temporarily gain owner permissions to the target file.
A: to follow the link to the target file.
If right: Very good.
If wrong: To dereference means to follow the symbolic link to the target file.

Q: A command line argument is:
- required for shell scripts.
- a user defined variable.
- usually causes the generation of an error code.
- None of the above.
A: None of the above.
If right: Good. It is none of the above.
If wrong: A command line argument is a token that the command acts upon.

Q: A file whose group members have read and write permissions has file permissions equivalent to an octal value of:
- 4
- 5
- 6
- 7
A: 6
If right: Correct. Read = 4, Write = 2; so the total is 6.
If wrong: Read = 4, Write = 2; so the total is 6.

Q: A file with the following permissions: -rwxr-xr-x
- is readable by the owner and group members only.
- is writeable by the group members.
- is not executable by the owner.
- None of the above.
A: None of the above.
If right: That is correct.
If wrong: None of the above is the correct choice.

Q: After setting the noclobber option under the bash shell, what operator permits overwriting the file to which output is redirected?
- There is not a noclobber option under this shell.
- !>
- unset noclobber
- >|
A: >|
If right: That is correct.
If wrong: It is >|

Q: How can you see the long listing of a lengthy directory one page at a time?
- ls -l -n
- ls -a > temp; cat temp
- ls -l | more
- ls -long > more
A: ls -l | more
If right: Right!!
If wrong: ls -l | more is the command.

Q: In Linux, the standard output and standard input of commands are in the form of:
- specially encrypted codes
- binary
- both binary and text depending upon the command
- text (ascii) characters
A: text (ascii) characters
If right: That is correct.
If wrong: stdin and stdout are all in text format.

Q: Most executing programs can be abnormally terminated by:
- entering control C (^C).
- with the kill command..
- by logging out of the system.
- D. All of the above will work.
A: D. All of the above will work.
If right: That is correct.
If wrong: Any of the three will work under most circumstances.

Q: The command:

cat < lab1 > lab2
- makes a copy of lab2 name lab1
- creates an object lab2 of datatype lab1.
- creates a copy of lab1 name lab2.
- is equivalent to the command:

mv lab1 lab2
A: creates a copy of lab1 name lab2.
If right: It is equivalent to cp lab1 lab2
If wrong: No it makes a copy of lab1 in lab2.

Q: What command permits splitting stdout into two streams which can be directed to a file and a command simultaneously?
- >>
- split
- <>
- tee
A: tee
If right: That is correct.
If wrong: It is the tee command.

Q: What command searchs files in a file list for a given pattern, string, or expression?
- find
- sed
- grep
- All of the above.
- None of the above.
A: grep
If right: That is correct.
If wrong: grep searches for a string, pattern or expression.

Q: What command will delete all files with a ".c" extention?
- rem *.c
- rm *.c
- rm ?.c
- del *.c
A: rm *.c
If right: That is correct.
If wrong: The delete command in Linux is rm.

Q: What connects the standard output of a command to the standard input of another command?
- A connector.
- A pipeline
- A redirection operator.
- None of the above.
A: A pipeline
If right: Correct!!
If wrong: A pipeline

Q: What does the following command accomplish? sort customernames > orderlist
- creates a newfile named orderlist.
- sorts customernames
- redirects stdout from the screen to a file.
- All of the above.
- none of the above
A: All of the above.
If right: That is correct.
If wrong: The command sorts then redirects customernames to a new file named orderlist.

Q: What is the most common and, also, the preferred method of sharing files among Linux users?
- Duplicate files.
- B. links
- Common group for slelected users.
- Common logins.
A: B. links
If right: Very good.
If wrong: The most common method of file sharing is the use of the link command.

Q: What single command line can be used to replace the following three command lines?

sort namest > newst

uniq newst > uniquest

rm newst
- cat namest | sort | uniq > uniquest
- sort namest | uniq > uniquest
- sort < namest | uniq > uniquest
- Any of the above
A: Any of the above
If right: That is correct!
If wrong: Any of them will work.

Q: When a Linux shell command is executed in the foreground:
- it maintains control of the keyboard and the display screen.
- another command can not be started until it is complete.
- access to the shell is lost until the command in the foreground is completed.
- All of the above.
- Both A and C but not B.
A: All of the above.
If right: That is correct.
If wrong: All of the first three are true.

Q: When specifying parallel execution of commands on one command line, commands are followed by:
- ;
- |
- ,
- &
- -
A: &
If right: That is correct.
If wrong: It's the ampersand (&).

Q: When using vi, which command will find a line beginning with the word: "Object"?
- /^Object/
- /Object
- find Object
- s/Object
A: /^Object/
If right: That is correct!
If wrong: The regular expression /^Object/ works in vi to search for a line beginning with Yes.

Q: Which command creates a link?
- link
- set
- cp -l
- None of the above is correct.
A: None of the above is correct.
If right: Correct
If wrong: ln is the command, so the answer is none of these.

Q: Which command will allow you to read the contents of the compressed file "letter.z"?
- cat letter.z
- cat -z letter.z
- uncompress letter.z | cat
- zcat letter.z
A: zcat letter.z
If right: That is correct. zcat is used with compressed files.
If wrong: zcat is the command.

Q: Which command will combine files: address and cities in a new file called customerlist?
- cp address cities customerlist
- mv address cities > customerlist
- cat address cities > customerlist
- more address cities >> customerlist
A: cat address cities > customerlist
If right: That is right.
If wrong: The > is the redirection operator and can be used to combine files when used with the cat command.

Q: Which command will append file "extra" to "customers"?
- cat extra >> customers
- append extra to customers
- cp customers extra to customers
- mv customers extra to customers
A: cat extra >> customers
If right: That is correct.
If wrong: The append operator is >>.

Q: Which of the following commands will sort the contents of inventory, remove duplicate lines, and save the result in new.inventory?
- cat inventory | sort | uniq > new.inventory
- cat inventory | uniq | sort > new.inventory
- uniq inventory | sort < new.inventory
- cat inventory >uniq > sort > new.inventory
A: cat inventory | sort | uniq > new.inventory
If right: That is correct.
If wrong: Remember that unique removes duplicated adjacent lines.

Q: Which of the following is an example of input redirection?
- sort | customers
- cat names > printfile
- grep John < namelist
- cut -d: f1 | /etc/password
A: grep John < namelist
If right: OK. That's right.
If wrong: Input redirection is done with the < operator.

Q: Which type of link can be used to create a directory entry to a file in another file system?
- soft link
- hard link
- cross-system link
- any link will work
A: soft link
If right: That is correct.
If wrong: Soft links are used to link files across file systems.