Question 1
In sed, when you do pattern matching, the largest pattern is always matched first, left to right.
True or False
Question 2
If shell script has owner, group, and others (world) execute permissions set but only read permissions set for group and others, this script can be executed by the owner.
True or False
Question 3
The command
cd /; tar cf - etc | ( cd /tmp ;tar -xf - )
copies the contents of /etc into /tmp
True or False
Question 4
The command
tr 'a-z' 'A-Z' | tr 'A-Z' 'a-z'
translates all lower case letters to upper case and all upper case letters to lower case.
After the command is run, case of the input stream will be swapped.
True or False
Question 5
The command
grep -iw shell | wc -l
correctly counts the number of times the text shell appears in the standard input stream.
True or False
Question 6
The command
echo "This is a message" 2>&1
writes its output "This is a message" to standard error.
True or False
Question 7
The command
cut -d: -f1 | more < /etc/passwd
would correctly print the first field of the password file and send the results to the program more.
True or False
Question 8
The command:
tr -d '\012'
removes the newline from the input stream
True or False
Question 9
The command
grep '^
file | wc -l
count all the lines in a file which are empty.
True or False
Question 10
The command
sort +2 -3 names
Sorts the file names on the third word.
True or False
Question 11
The command
ls | paste - -
lists all files in the current directory in three columns
True or False
Question 12
The uniq command will remove duplicate consecutive lines.
True or False
Question 13
Running the command
sort -u
is always the same as running the command
uniq
True or False
Question 14
The command
sed 's/a/b/g'
produces the same output as running the command
sed 's;a;b;g'
True or False
Question 15
The command
sed 's/a/&&/g'
doubles only the first occurance of 'a' on each line processed.
True or False
Question 16
Unquoted $@ and $* evaluate to the same thing
True or False
Question 17
Changes which a child process makes to the environment do effect its parents environment. For example, If a child process changes and environment variable, that change happens in the parent process.
True or False
Question 18
Changes which the parent makes to the environment after the child is created, do not effect the child's environment.
True or False
Question 19
Note, If field 7 of the password file is empty, it is assumed to be /bin/sh. Which of the following commands count the number of users whose login shell is /bin/sh? (Remember the rule from above.)
a. ( grep ':
/etc/passwd; grep ':/bin/sh
/etc/passwd) | wc -l
b. sed 's,:$,:/bin/sh,' /etc/passwd | grep ':/bin/sh
| wc -l
c. egrep -ce ':$|:/bin/sh
/etc/passwd
d. A & B & C
e. A & B