Mid Term Flashcards

(96 cards)

1
Q

What command would you use to keep a record of every command you type and the output of those commands?

A

script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What key would you press to get the last command you typed?

A

up arrow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you abort a running program?

A

Control C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What would you type at the command line to get the man page for the ls command?

A

man ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you get the next screenfull when using man?

A

hit the Space bar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you exit the man program?

A

hit q

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the other program, besides man, that you can use to get help?

A

info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name the three whitespace characters.

A

Space, Tab and newline (Enter or Return)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If you wanted to use one of the characters that have special meaning to Unix in a filename, what TWO things could you do?

A

put a backslash in front of it or quote it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What would you type on the command line if you wanted to go to the directory /courses?

A

cd /courses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What would you type at the command line to see what directory you are currently in?

A

pwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What would you type at the command line to see ALL the files in the directory named /home/ghoffman?

A

ls -a /home/ghoffman

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What would you type at the command line to print to the screen the contents of the file named memo.txt?

A

cat memo.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What would you type at the command line to delete the file named memo.txt?

A

rm memo.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What would you type at the command line to create a directory named work?

A

mkdir work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What would you type at the command line to copy the file named memo.txt to memo.bak?

A

cp memo.txt memo.bak

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What would you type at the command line to move the file named memo.txt into the directory named work?

A

mv memo.txt work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What would you type at the command line if you wanted to see the value of the variable SHELL?

A

echo $SHELL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What would you type at the command line if you wanted to know the network name of the Unix computer you were using?

A

hostname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Name one of the two pager programs that allow you to read a long file one screenful at a time.

A

more or less

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

If you started typing the name of a file on the command line and wanted Unix to supply the rest, what would you do?

A

hit the Tab key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

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”?

A

grep homework results.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

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”?

A

grep -v homework results.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What would you type at the command line if you wanted to see the FIRST 10 lines of the file log.txt?

A

head log.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
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
26
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
27
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
28
If you saw the following prompt, what USER was logged into the machine? it244gh@vm75:/courses/it244/s19/ghoffman$
it244gh
29
If you saw the following prompt, what was the HOSTNAME of the machine? it244gh@vm75:/courses/it244/s19/ghoffman$
vm75
30
If you saw the following prompt, what is your CURRENT DIRECTORY? it244gh@vm75:/courses/it244/s19/ghoffman$
/courses/it244/s19/ghoffman
31
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
32
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
33
What command would you use to find the date and time?
date
34
What program would you use to find where the program file for tar is located?
which or whereis
35
What would you type at the command line if you wanted to find all files with "link" as part of their name?
locate link
36
What command would you use to find out all the users currently logged on to the machine you are using?
finger or who
37
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
38
What is the name of the directory at the top of the Unix filesystem?
root
39
What symbol is used to represent the top of the Unix filesystem?
/
40
What do you call the directory directly above your current directory?
the parent directory
41
What do you call a directory inside your current directory?
a child directory
42
What would you type at the terminal to go to the top of the hierarchical file system?
cd /
43
Can you have two files with the same name in the same directory?
no
44
Can you have two files named memo.txt and Memo.txt in the same directory?
yes. the filename are different because Unix is case sensitive
45
Does Unix recognize filename extensions?
no
46
What directory are you in when you first log in to a Unix machine?
your own home directory
47
In what directory is YOUR home directory located?
/home
48
What do you call a text file containing Unix commands that are run just before the shell gives you a prompt?
a startup file
49
Where are the files mentioned above located?
in your home directory
50
If you entered the following at the command line, where would you be? cd ~
your home directory
51
If you entered the following at the command line, where would you be? cd ~ghoffman
in the home directory of ghoffman
52
What does the . (dot) in your current directory mean?
your current directory
53
What does the .. (dot dot) in your current directory mean?
the parent directory of your current directory
54
What do you call the list of directories you must go through to get from one directory to another?
a path
55
What directory is the starting point for EVERY absolute path?
the root directory
56
What directory is the starting point for a relative path?
the current directory
57
What character is used to separate directory and filenames in a path?
/
58
By default, which account is the owner of a file or directory?
the account that created it
59
Name the three types of access permissions.
read, write and execute
60
Name the three categories of accounts which are used in assigning access permissions.
owner, group, everyone else
61
Who can change the access permissions on a file or directory?
only the owner
62
What would you enter on the command line if you wanted to see the access permissions of entries in your current directory?
ls -l
63
What is the name of the command you would use to change the access permissions for a file or directory?
chmod
64
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
65
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
66
For the same file, what could the group do?
read and execute
67
For the same file, what could every other account do?
only execute
68
What is the name of the account that can do ANYTHING on a Unix or Linux system?
root
69
If you have read permission on a directory, what can you do in it?
run ls on the directory to list its contents
70
If you have read permission on a directory, can you read the files in that directory?
no, you need read permission on each file
71
What permission on a directory allows you to create, delete or rename anything in that directory?
write permission
72
If you have write permission on a directory do you have write permission on the files it contains?
no, you need write permission on each file
73
If you have execute permission on a directory what can you do?
cd into that directory
74
What does Unix call a file that points to another file or directory?
a link
75
What are the two kinds of links?
hard links and soft links
76
What kind of link is used most often?
soft links
77
What command would you use to create a soft link named "home" in your current directory to YOUR home directory?
ln -s ~ home
78
What symbols come before an option on the command line?
- or --
79
What is the program the collects the characters you type at the command line?
tty device driver
80
When does this program send what you have typed at the command line to the shell?
when you hit Enter on a PC or Return on a Mac
81
What does the PATH shell variable contain?
the list of directories the shell must search to find the file to run a command
82
Does the shell check that a program gets the arguments or options it needs?
no, that is the responsibility of the program itself
83
If you wanted to run the executable script work.sh in your current directory without using bash, what would you type at the command line?
./work.sh
84
What is a process?
a running program
85
What does the shell do after it runs the program the user entered at the command line?
it goes into an inactive state called sleep
86
What does a program do JUST BEFORE it stops running?
it sends an exit status to the shell
87
What does an exit status of 0 mean?
it means that the program encountered no errors
88
By default, where does Standard Input come from?
the keyboard
89
By default, where does Standard Output go?
to the screen
90
If you wanted to send the output of ls to the file dir_listing.txt, what would you enter at the command line?
ls > dir_listing.txt
91
If you wanted the program do_something to take input from the file data.txt what would you write at the command line?
do_something < data.txt
92
If you wanted to run the program do_something but have no output appear on the screen, or be sent to a file, what would you type at the command line?
do_something > /dev/null
93
If you wanted to add the output of who to the file logged_on.txt what would you type at the command line?
who >> logged_on.txt
94
If a program does not specify where its input comes from, where would it come from?
from Standard Input
95
If a program does not specify where its output goes to, where would it go?
to Standard Output
96
Where does a program send its error messages?
to Standard Error