Midterm Questions Flashcards

1
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
2
Q

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

A

tail log.txt

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

What is the name of the directory at the top of the Unix filesystem?

A

root

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

What symbol is used to represent the top of the Unix filesystem?

A

/

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

What is the parent directory?

A

the directory directly above your current directory

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

Can you have two files with the same name in the same directory?

A

no

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

What directory are you in when you first log in to a Unix machine?

A

your own home directory

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

What does the .. (dot dot) in your current directory mean?

A

the parent directory of your current directory

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

What directory is the starting point for an absolute path?

A

the root directory

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

What directory is the starting point for a relative path?

A

the current directory

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

By default, which account is the owner of a file or directory?

A

the account that created it

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

Name the three types of access permissions.

A

read, write and execute

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

Name the three categories of accounts which are used in assigning access permissions.

A

owner, group, everyone else

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

What does the PATH shell variable contain?

A

the list of directories the shell must search to find the file to run a command

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

If you wanted the program do_something to take input from the file data.txt what would you write at the command line?

A

do_something < data.txt

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

Look at the diagram on the last page. Assuming that you are in the directory named it, write the absolute pathname you would use to reference the directory named hw inside the it117 directory. You do not have to write a Unix command, I only want the pathname.

A

/courses/it/it117/hw

17
Q

Look at the diagram on the last page. Assuming that you are in the directory named it, write the relative pathname you would use to reference the directory named hw1 under the it244 directory. You do not have to write a Unix command, I only want the pathname.

A

it244/hw/hw1

18
Q

Look at the diagram on the last page. Assuming that you are in the directory named it, write the relative pathname you would use to reference the root directory. You do not have to write a Unix command, I only want the pathname.

A

../..

19
Q

Look at the diagram on the last page. z Assuming that you are in the directory named it, write the relative pathname you would use to reference the bill directory. You do not have to write a Unix command, I only want the pathname.

A

../../home/bill

20
Q

Look at the diagram on the last page. Assuming that you are in the directory bill, write the command to create a soft link to the hw2 directory. You may use either an absolute or relative pathname.

A

ln -s /courses/it/hw/hw2

21
Q

Write the single command you would use to change the permissions on the file memo.txt so that the owner could read and write it, the group could only read it and all other users had no permissions whatsoever.

A

chmod 640 memo.txt

22
Q

Write the single command you would use to change the permissions on the file backup so the owner had all permissions, the group could read and execute the file and all other users cold only execute the file.

A

chmod 751 backup

23
Q

Write the single command you would use to change the permissions on the directory work so that the owner could do anything, the group could run ls and cd on the directory and all other users could only run ls on the directory.

A

chmod 754 work

24
Q

Write a single command to create a copy of the file memo.txt in the parent directory into the current directory.

A

cp ../memo.txt .

25
Q

Using a pipe, write the command line to find all Red Sox games from the file redsox.txt where the Sox lost to a team that was not the Orioles. Entries in the file look like this

2011-07-02 Red Sox @ Astros Win 7-5

2011-07-03 Red Sox @ Astros Win 2-1

2011-07-04 Red Sox vs Blue Jays Loss 7-9

2011-07-05 Red Sox vs Blue Jays Win 3-2

A

grep Loss redsox.txt | grep -v Orioles