-
A user creates (or obtains) a file of shell commands named cmds
and puts it in the working directory. The user attempts to execute the
file, but gets an error message:
$ cmds
bash: cmds: command not found
- What's wrong?
- What command can the user type instead of cmds
to avoid this problem?
-
The user types the corrected command, but this time gets another error
message that ends permission denied.
- What's wrong now?
- What command can the user type to
fix this problem?
-
The script cmds reads from the standard input and writes to the
standard output. What command should the user type to run cmds,
to read from and write to the specified locations:
- Read from the keyboard, write to the screen
- Read from file infile, write to the screen
- Read from the keyboard, write to the new file outfile
- Read from file infile, write to the new file outfile
- Read from the keyboard, write to the end of the old file logfile
-
The Unix command cat simply copies its input to the standard output.
It may take its input from the standard input, or it may take its input
from all the files provided as command line arguments. What is the effect
of each of these commands?
- cat foo
- cat < foo
- cat > foo
- cat * > foo
- cat foo > bar
- cat foo bar | wc
-
There is a sorted dictionary of words (one word per line) in /usr/dict/words. Some of the words in the dictionary are capitalized.
- What command shows the number of words in the dictionary?
- What command shows the words in the dictionary that
contain the lowercase letter x?
- What command shows the number of words in the dictionary that
contain the lowercase letter x?
- What command shows the words in the dictionary that
begin with the letter x, lowercase or upper case?
- What command shows the number of four-letter words in the dictionary?
-
Say you wish to prevent other users from seeing what files you have
and from reading most of your files, but you want to allow them to
copy one file named pub in your home directory. However you
do not want to allow them to change this file.
- What command shows the protection on your home directory?
- Say you execute this command and it shows drwxr-xr-x.
Can other users see what files you have? Explain your answer.
- What command can you use to prevent other users from seeing what
files you have, but will still allow them to copy your pub file?
- What command shows the protection on your pub file?
- Say you execute this command and it shows drwxrwxr-x.
Can other users copy this file? Explain your answer.
- Can other users change your pub file? Explain your answer.
- What command can you use to prevent other users from changing
your pub file, but still allow them to copy it?
-
What is the value of the binary number 101 in decimal? In octal?