Lab 8 - UNIX Commands
-
The echo command takes a line that you type and repeats it back on the screen. Redirect your input line
to a file named myFile.
-
Use the echo command to input 5 more lines and redirect them to file myFile, which will contain a
total of 6 lines of text.
-
Using the commands who, who am i, and date, append to file myFile the outputs of the
above commands.
- Suppose myFile is in your working directory. Specify the command(s) you would use to do the
following:
-
Give everyone permission to read myFile; do not change any other privileges.
-
Permit the owner (you) and group members to read and write the file; remove all privileges from everyone else.
-
Remove writing privileges from everyone but the owner.
-
Give the owner and group members permission to execute myFile, while giving the owner sole permission to
read and write the file.
-
Suppose you have a directory named myStuff in your working directory. Specify the command(s) you would
use to do the following:
-
Give everyone permission to list files in myStuff; do not change any other privileges.
-
Permit the owner and group members to list, remove, or add files; remove all privileges from everyone else.
-
Remove writing privileges from everyone but the owner.
-
Give the owner and group members permission to execute myStuff, while giving the owner sole permission
to read and write the directory.
- Create a set of text files and name them backgammon, backpacking, baseball, boxing, biking, chess,
fencing, blackjack, groupA, groupB, groupX, groupY.
- How would you use cat to show the contents of the files ending in ing?
- How would you list any files containg x or X in the file names?
- How would you show the contents of files with names containing o?
- How would you show the contents of the files backgammon, backpacking and blackjack using just
one command?
- How would you copy the contents of all 3 files backgammon, backpacking and blackjack to a
file named all3 using just one command?
-
Given the file phone_book, specify the command(s) you would use to do the following:
- Display entries of people whose names contain pattern .alex., case-insensitive. (The output should be the
entries of alex johnson and Alexander Smith.)
- Count the number of people who area code is 905. Display just the count (not the entries).
- Display the entries of the babysitters.
- Count the number of friends whose names are in phone_book. Display just the count (not the
entries).