click below
click below
Normal Size Small Size show me how
IT 244
| Question | Answer |
|---|---|
| What command would you use to keep a record of every command you type and the output of those commands? | script |
| What key would you press to get the last command you typed? | up arrow |
| What keys would you hit to go to the beginning of the command line? | Control A |
| How do you you abort a running program? | Control C |
| What would you type at the command line to get the man page for the ls command? | man ls |
| If you wanted to use one of the characters that have special meaning to Unix in a filename, what TWO things could you do? | put a backslash in front of it or quote it |
| What would you type on the command line if you wanted to go to the directory /home? | cd /home |
| What would you type at the command line to delete the file named memo.txt? | rm memo.txt |
| What would you type at the command line to copy the file named memo.txt to memo.bak? | cp memo.txt memo.bak |
| What would you type at the command line to move the file named memo.txt into the directory named work? | mv memo.txt work |
| What key would you press to get the last command you typed? | ↑ |
| What keys would you hit to go to the end of the command line? | Control E |
| What is the text editor used by most system administrators? | vi or vim |
| How do you get the next screenfull when using man? | hit the Space bar |
| How do you exit the man program? | hit q |
| What is the other program, besides man, that you can use to get help? | info |
| Name the three whitespace characters. | Space, Tab and newline (Enter or Return) |
| What would you type on the command line if you wanted to go to the directory /courses? | cd /courses |
| What would you type at the command line to see what directory you are currently in? | pwd |
| What would you type at the command line to see ALL the files in the directory named /home/ghoffman? | ls -a /home/ghoffman |
| What would you type at the command line to print to the screen the contents of the file named memo.txt? | cat memo.txt |
| What would you type at the command line to create a directory named work? | mkdir work |
| What would you type at the command line if you wanted to see the value of the variable SHELL? | echo SHELL |
| What would you type at the command line if you wanted to know the network name of the Unix computer you were using? | hostname |
| Name one of the two pager programs that allow you to read a long file one screenful at a time. | more or less |
| If you started typing the name of a file on the command line and wanted Unix to supply the rest, what would you do? | hit the Tab key |
| What would you type at the command line if you wanted to find all lines in the file results.txt that contained the word "homework"? | grep homework results.txt |
| What would you type at the command line if you wanted to find all lines in the file results.txt that DID NOT contain the word "homework"? | grep -v homework results.txt |
| What would you type at the command line if you wanted to see the FIRST 10 lines of the file log.txt? | head log.txt |
| What would you type at the command line if you wanted to see the LAST 10 lines of the file log.txt? | tail log.txt |
| What would you type at the command line if you wanted to see all the lines in the file results.txt in sorted order? | sort results.txt |
| What would you type at the command line if you wanted to see all the lines in numbers.txt sorted in REVERSE NUMERIC order? | sort -nr numbers.txt |
| If you saw the following prompt, what USER was logged into the machine? | it244gh |
| If you saw the following prompt, what was the HOSTNAME of the machine? | vm75 |
| If you saw the following prompt, what is your CURRENT DIRECTORY? | /courses/it244/s19/ghoffman |
| What would you type at the command line if your wanted to find all lines in the file red_sox.txt that had the word "Win", but NOT the word "Rays"? | grep Win red_sox.txt | grep -v Rays |
| What would you type at the command line if your wanted to find all lines in the file red_sox.txt that had the word "Win", but NOT the word "Rays", and have the lines sorted alphabetically? | grep Win red_sox.txt | grep -v Rays | sort |
| What command would you use to find the date and time? | date |
| What program would you use to find where the program file for tar is located? | which or whereis |
| What would you type at the command line if you wanted to find all files with "link" as part of their name? | locate link |
| What command would you use to find out all the users currently logged on to the machine you are using? | finger or who |
| What would you type at the command line if you wanted to find out all you could about the user with account name wombat? | finger wombat |
| What is the name of the directory at the top of the Unix filesystem? | root |
| What symbol is used to represent the top of the Unix filesystem? | / |
| What do you call the directory directly above your current directory? | the parent directory |
| What do you call a directory inside your current directory? | a child directory |
| What would you type at the terminal to go to the top of the hierarchical file system? | cd / |
| Can you have two files with the same name in the same directory? | no! |
| Can you have two files named memo.txt and Memo.txt in the same directory? | yes. the filenames are different because Unix is case sensitive |
| Does Unix recognize filename extensions? | no |
| What directory are you in when you first log in to a Unix machine? | your home directory |
| In what directory is YOUR home directory located? | /home |
| What do you call a text file containing Unix commands that are run just before the shell gives you a prompt? | a startup file |
| Where are the files mentioned above located? | in your home directory |
| If you entered the following at the command line, where would you be? cd ~ | your home directory |
| If you entered the following at the command line, where would you be? cd ~ghoffman | in the home directory of ghoffman |
| What does the . (dot) in your current directory mean? | your current directory |
| What does the .. (dot dot) in your current directory mean? | the parent directory of your current directory |
| What do you call the list of directories you must go through to get from one directory to another? | a path |
| What directory is the starting point for EVERY absolute path? | the root directory |
| What directory is the starting point for a relative path? | the current directory |
| What character is used to separate directory and filenames in a path? | / |
| What would you type at the command line if you wanted to see the value of the variable SHELL? | echo $SHELL |
| If you started typing the name of a file on the command line and wanted Unix to supply the rest, what would you do? | hit the tab key |
| What would you type at the command line if you wanted to find all lines in the file results.txt that contained the word "homework"? | grep homework results.txt |
| What would you type at the command line if you wanted to find all lines in the file results.txt that DID NOT contain the word "homework"? | grep -v homework results.txt |
| What would you type at the command line if you wanted to see all the lines in numbers.txt sorted in REVERSE NUMERIC order? | sort -nr numbers.txt |
| If you saw the following prompt, what is your CURRENT DIRECTORY? it244gh@vm75:/courses/it244/s19/ghoffman$ | /courses/it244/s19/ghoffman |
| What would you type at the command line if your wanted to find all lines in the file red_sox.txt that had the word "Win", but NOT the word "Rays"? | grep Win red_sox.txt | grep -v Rays |
| What would you type at the command line if your wanted to find all lines in the file red_sox.txt that had the word "Win", but NOT the word "Rays", and have the lines sorted alphabetically? | grep Win red_sox.txt | grep -v Rays | sort |
| What program would you use to find where the program file for tar is located? | which or whereis |
| What command would you use to find out all the users currently logged on to the machine you are using? | finger or who |
| By default, which account is the owner of a file or directory? | the account that created it |
| Name the three types of access permissions. | read, write, and execute |
| Name the three categories of accounts which are used in assigning access permissions. | owner, group, and everyone else |
| Who can change the access permissions on a file or directory? | only the owner |
| What would you enter on the command line if you wanted to see the access permissions of entries in your current directory? | ls -l |
| What is the name of the command you would use to change the access permissions for a file or directory? | chmod |
| Three numbers can be used to specify access permissions when using the command above. Each of these numbers can only be in a certain range. What is the maximum and minimum for each of these three numbers? | 0 to 7 |
| If the file work.sh has the permissions given below, what could the owner of the file do? -rwxr-x--x 1 ghoffman grad 0 Sep 27 11:08 work.sh | read, write, and execute |
| For this file, what could the group do? -rwxr-x--x 1 ghoffman grad 0 Sep 27 11:08 work.sh | read and execute |
| For this file, what could every "other" account do? -rwxr-x--x 1 ghoffman grad 0 Sep 27 11:08 work.sh | only execute |
| What chmod command gives Owner, Group, and Everyone read/write permissions to notes.txt? | chmod 666 notes.txt |
| What chmod command gives Owner read/write and Group/Everyone read permissions to work/notes.txt? | chmod 644 work/notes.txt |
| What chmod command gives Owner read/write, Group read, and Everyone no permissions to it244/work/notes.txt? | chmod 640 it244/work/notes.txt |
| What chmod command gives Owner read/write/execute, Group read/execute, and Everyone read/execute permissions to work/label_now.sh? | chmod 755 work/label_now.sh |
| What chmod command gives Owner all permissions, Group read/execute, and Everyone no permissions to it244/work/label_now.sh? | chmod 750 it244/work/label_now.sh |
| What chmod command gives Owner write/execute, Group execute, and Everyone execute permissions to work/label? | chmod 311 work/label |
| What chmod command gives Owner all permissions, Group execute, and Everyone execute permissions to it244/work/label? | chmod 711 it244/work/label |
| What chmod command gives Owner read/execute, Group execute, and Everyone no permissions to ~ghoffman/it244/work/label? | chmod 510 ~ghoffman/it244/work/label |
| What chmod command gives Owner, Group, and Everyone all permissions to dir1? | chmod 777 dir1 |
| What chmod command gives Owner ls/create/delete/cd permissions, Group ls/cd permissions, and Everyone ls permissions to dir1/dir2? | chmod 754 dir1/dir2 |
| What chmod command gives Owner ls/cd permissions, Group ls/cd permissions, and Everyone no permissions to ~ghoffman/dir3? | chmod 550 ~ghoffman/dir3 |
| What chmod command gives Owner ls/cd permissions, Group cd permissions, and Everyone ls permissions to dir5? | chmod 514 dir5 |
| What does the PATH shell variable contain? | the list of directories the shell must search to find the file to run a command |
| In a for ... in loop, where does the loop variable get its values? | from the list of values following the keyword in |
| In a simple for loop, where does the loop variable get its values? | from the command line arguments |
| Should the loop variable in a for loop have a $ in front of it? | no |
| In a three statement for loop, what does the first statement do? | sets the initial value of a loop variable |
| In a three statement for loop, what does the second statement do? | it's a logical expression and the loop will continue as long as its value is true |
| In a three statement for loop, what does the third statement do? | changes the value of the loop variable after each pass through the loop |
| Why are the three statements in a three statement for loop surrounded by two parentheses? | so the values of all variables will be treated as numbers |
| When does a while loop stop running? | when the command following while returns an exit status that is not 0 |
| what does the continue command in a loop do? | stops that pass through the loop and returns to the top of the loop |
| What does the break command in a loop do? | jumps completely out of the loop |