CS 497C - Homework 2 - Name:_________________ DUE: Monday, September 17 (in class) Please show all work on a separate sheet attached to this sheet. (50 points - 5 points for each problem) 1. Name three major differences between UNIX commands and Windows programs. Ans: 1) UNIX commands are generally not interactive; Windows programs are. 2) UNIX commands don't need to have any specific extensions in their filenames; Window must have .EXE or .COM. 3) UNIX files are sensitive to case; Windows files are not. 2. Is an option also an argument? How do an argument and an option differ? Ans: 1) Yes, an option is also an argument. 2) An option generally begins with a hyphen. A command has a fixed number of options, but usually the number of non-option arguments is not fixed. 3. Consider the command tar -x -v -f /dev/rct0 -b 20 *. Can you combine the options in this way? If not, please write down the correct one. tar -xvfb 20 /dev/rct0 Ans: 1) No, you can't combine options in this way. The parameters for -f and -b are not lined up properly. 2) The correct one is tar -xvfb /dev/rct0 20. 4. You need to save the output of the who and date commands in a single file. How will you do? Write down the command you use. Ans: Use (who ; date) > out. The out file is used to save the output of the command. 5. Why are the directories /bin and /usr/bin usually found first in the output of echo $PATH? Ans: Because the commands there are most often used by users and would be located faster. 6. What does the command "ls -Fax" do? Try to look into the manual pages and explain it. Ans: It appends indicator (one of */=@|) (-F) to entries, doesn't hide entries starting with . (-a), and lists entries by lines instead of by columns (-x). 7. How do you display the current date in the form dd/mm/yyyy? Which command does the ordinary user use to change the system date and time? Ans: 1) Use date +"%d/%m/20%y" or date +"%d/%m/%Y". 2) The ordinary user can't change the system date and time. Only system administrator can change it. 8. Can you have the same login name more than once in the who output? How do you find out the users who are idling? Ans: 1) Yes, you can; two or more users can log in with the same user name. 2) Both who -Hu and w have an IDLE column showing the users who are idling. 9. If you find that your keystrokes are not being echoed, what remedies will you try? Ans: First enter the command stty echo. If that doesn't work, try stty sane. You may also need to use [Ctrl-j] or [Ctrl-m] to simulate the [Enter] key. 10. How will you find out the decimal equivalent of 1101001? Ans: Use bc, make the setting ibase = 2 and then enter the binary number. bc will echo 105. Note: The default obase is set to 10. If you've changed it, you need to make the setting obase = 10 to get the decimal value.