Final (Unix) Flashcards

1
Q

Using the cd command, write a command to go up one level from the current directory, then into a directory there called DestinationDirectory

A

cd ../DestinationDirectory

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

What does the -i option of the mv command do?

A

Prompt before overwriting

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

What does the -u option of the mv command do?

A

Move only if the source file is newer than the destination file

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

Explain what the -r, -i, and -f options do in the rm command

A

-r: Recursively removes directories and their contents

-i: Prompt before removing each file or directory

-f: Forcefully remove files without prompting

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

The chmod command has which three user groups for the syntax: <usergroup>+x, -x, +r, -r, +w, -w, etc.?</usergroup>

A

User (u), Group (g), Others (o)

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

In chmod octal notation, what is the value of Read(r)?

A

4

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

In chmod octal notation, what is the value of Write(w)?

A

2

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

In chmod octal notation, what is the value of Execute(x)?

A

1

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

If you want to give a particular group permissions in chmod octal notation, how do you determine the correct number to use?

A

Add the numbers of the octal representation of those permissions up.

For example, read is 4, write is 2, and execute is 1, so if you wanted to give a group read and write permission, that group would get a 6.

The order is ugo in the notation, so to give r, w, x to user, rw to group, and r to others, it would be: 764

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

What do the / and ? keys do when reading a file with the less command?

A

Search forward (/) or backward (?)

(You can also use spacebar to scroll down and b to scroll up)

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

What do the :n and :p commands do when looking at files with the less command?

A

:n - Next file
:p - Previous file

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

-w option in the cal command

A

Displays the week number (in terms of the entire year) at the beginning of each week in the calendar display. So..
cal -w 8 4 1983
Displays the calendar for april 1983 showing that the first week is the 14th week of the year (and so on).

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

-j option in the cal command

A

Shows the number of days since january 1st of the calendar year being displayed (instead of the day of the month).

For example, cal -j 2 4 1975 would display a calendar of April 1975 in which the first day of the month is 91, and the last day is 120.

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

-n option in the cal command

A

The number of months to display (starting with the current month).

If it’s May 2024, cal -n 5 would display a calendar for May, June, July, August, and September of 2024

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

What’s the difference between a Shell and a Machine?

A

A shell is a program that provides the command-line interface to interact with the Unix operating system

A machine is physical hardware – a machine can be used to execute commands through the shell

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

How do pipes (|) work, generally?

A

The command or operation on the left of the pipe becomes input for the command on the right of the pipe. Multiple such combinations can be chained together and occur in order from left to right.

17
Q

What is an absolute path?

A

Complete location of a file or directory from the root directory of the file system.

Always begins with a forward slash /

18
Q

What is a relative path?

A

The location of a file or directory relative to the current working directory. Doesn’t start from the root directory, and does not begin with a forward slash /

If we’re in /home/user and user contains the directory /documents with the file file.txt, the relative path of file.txt from the current directory is: documents/file.txt

19
Q

What is a foreground process?

A

A running process which the user is currently directly interacting with. When a process runs and need some type of interaction from the user, it’s in the foreground.

20
Q

What is a background process?

A

A process that runs independently of the terminal or shell from which it was started. Typically does not need the user’s interaction or input after initialization.