Blog 4 -- Week 4 Assignment:
Textbook page 119, answer the questions to Self Test 3.
1) When you enter the following command, what happened and why?
Cat > dog – nothing happens on the screen, the curser sits at the next line waiting for input. The Default input is the keyboard, whatever you type cat will output to the screen or a file. However, the file "dog" was created.
2) What results from the following commands?
who | grep $USER – This looks for the $USER value, passes it to grep, and grep looks for that value in the output of who. The result is that any line that has my user name in it will be output to the screen.
grep \$HOME file1 – Nothing happens because the backslash is preventing grep from interpreting the "$HOME" command.
echo u* >> file1 – This command finds the lines that begin with "u" and adds the line to "file1".
echo 'u*' >> file1 – This command finds the lines that end with a "u" and adds the line to "file1".
ps – This command lists the processes that are running on the machine. There are two or three pages of switches to modify the information ps looks for.
. fileA – A period at the front of a command with a file name after it, indicates to the shell that all the commands in the file should be read and executed one after the other.
set noclobber – This command changes a setting to on in the shell that will not allow a utility to overwrite what is already in a file if the file already exists. This command is for the csh and tcsh shells.
set -o – This command produces a list that allows you to see if the shell variables are set to on or off. This command works in ksh and bash shells.
chmod + x file2 – This command changes the permissions on "file2" and allows the file to be executed.
3) How can we change the prompt to be "Next?" in both families of shells?
C shell – set prompt = 'Next'
Korn shell – PS1 = 'Next'
4) What data is in each field in the passwd file?
Login (the name of the account), password (your encrypted password), UserID (a number that is assigned to your account), GroupID (users must belong to a group, used to assign permissions), misc (information about the user), home directory (your current directory when you logon), Startup program (the program that is loaded when you log on, usually a shell).
5) What command instructs the shell not to accept CTRL-D as a signal to log off?
In the c-shells use set ignoreeof and in the k-shells use set –o ignoreeof.
No comments:
Post a Comment