- Redirection is
- getting directions for a task
- getting input from or sending output to a different place
- saving to a file
- multitasking
-
What are the four redirection operators?
- _______
- _______
- _______
- _______
-
What is at least one use for each kind of redirection?
- __________________________________________
- __________________________________________
-
Assume you have a file called myfile. Write a command that could
be used to view the file using each listed command.
- cat _______________________________________
- vi ________________________________________
- echo ______________________________________
-
What is one use for each of these commands?
- mv ______________________________________
- cp ______________________________________
- pg ______________________________________
-
The ln command is used,
- to display line numbers
- to locate names
- to create links
- to honor Les Nesman
-
Assume you have a file called bigfile. What would each of these commands
return to you?
- wc -w bigfile ______________________________________
- wc bigfile ______________________________________
- ls > wc -l ______________________________________
-
What does each of these commands do?
- rm bigfile ______________________________________
- rm bigfile* ______________________________________
- rm bigfile * ______________________________________
-
What does each of these escape sequences stand for to the echo command?
- \n ______________________________________
- \b ______________________________________
- \t ______________________________________
- \r ______________________________________
-
grep is a search program. Write a grep command to do each of the
following:
- list all files in my home directory containing my name
- show all lines containing my name from the files above
- list all lines in myfile that do not contain my name
-
Which of these will print a personal greeting to a user?
- echo Hi.
- echo Hello, USER.
- echo Hello, $USER.
- Echo Hello, Sailor.
-
What is the command to:
- save your first name in your USER variable
- echo a message to the screen including the system date
- save your whole name with a space in your USER variable
-
What are the differences between double quotes, single quotes, accents
grave, and the backslash?
- Explain the difference between these by explaining what each command
does.
- Cat myfile date pwd
- cat myfile ; date ; pwd
- cat myfile ; date ; pwd > newfile
- (cat myfile ; date ; pwd) > newfile
-
What is the difference between correct use of the pipe and the output
redirection operator?
-
Explain how to use the tee command.
-
Back to grep: what is each of these options for?
- -i ______________________________________
- -n ______________________________________
- -vc ______________________________________
-
The sort command sorts in ASCII order unless you use these. What
is each for?
- -d ______________________________________
- -n ______________________________________
- -f ______________________________________
- -r ______________________________________
-
The sort command can sort on fields. What do these do?
- sort +1 phone.list
- sort -b +2 phone.list
- sort phone.list
-
Name three hidden startup files we would expect to find in your home
directory, and state what they are for.
-
What is the UNIX command to send a message directly to the screen
of user GeorgeW?
-
What command should GeorgeW enter to avoid the message above?
-
If the system operator wants to send a message to all users, NOW,
what is the command?
-
Our author described the use of the mailx command. What is the mailx
command to:
- view your messages
- compose a message to GeorgeW
- send myfile directly to GeorgeW in an e-mail
-
What is the difference between the q and x commands when reading
mailx e-mail?
-
What command would you type to create a mail group called Friends?
Include three users in the group.
-
What file should the above command be stored in to make the group
available to you in every session?
- Explain two differences between programs and scripts.
- Explain two ways scripts and programs are alike.
- How do you put a remark in a shell script? Why would you do so?
- Assume you have created a new script called MyFirst. What command
is used to enable users to execute the script?
- Assume the situation in the question above. User proper syntax to
give all rights to yourself, read and execute rights to your group,
and no rights to others on the system.
- Explain the use of the three allowable math operators when using the
chmod command: +, -, and =.
- Write a script that does the following:
- create a variable called Name
- ask the person running the script to enter their name
- capture what the user enters, and store it in the Name variable
- output a message to the user, using the captured data in the message