Study Quesitions #1 - Topic 1-5, Qn#1-50 Flashcards

2
Q

What are the two main kernel categories?

A

Monolithic Kernels and Microkernels

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

Explain the main differences between the two main kernel categories.

A

Monolithic Kernels  One very large program Performs every thing by itself Fast and efficient Difficult to design and maintainMicrokernels A much smaller program Performs the most basic tasks only To perform the rest of the functions, a microkernel calls upon a set of other programs (called servers) NB: servers are programs, not machines Slower and less efficient A lot easier to design and maintain

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

What is the difference between copyright and copyleft?

A

copyright law is used by the author to prohibit reproducing, adapting, or distributing copies of the work by a third party.copyleft law is the right given to third parties to reproduce, adapt, or distribute copies and any resulting copies or adaptations are bound by the same agreement.

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

When was the first Unix operating system developed?

A

In 1969

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

When was the first Linux operating system developed?

A

In 1991

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

Where did the word “Unix” come from?

A

UNiplexed Information and Computing Service (UNICS)later changed to UNIX

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

Where did the word “Linux” come from?

A

Linux originates from the name Linus

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

Who developed the first Unix operating system?

A

Ken Thomson

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

Who developed the first Linux operating system?

A

Linus Torvalds

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

Who were the first to develop the first C compiler?

A

Dennis Ritchie

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

Who were the first to re-write the Unix operating system in C?

A

Ken Thomson and Dennis Ritchie

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

What will cat foo foo foo display?

A

cat utility reads files sequentially, so it will display: foo foo foo

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

Assuming that bar is a directory, explain what the command rm -r bar does. How is the command different from rmdir bar?

A

rm -r bar removes contents before removing the directory.rmdir removes an empty directory

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

The command rmdir c.progs failed. State three possible reasons for this failure.

A

c.progs is not emptyc.progs does not existc.progs is in the wrong pathway

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

The command rmdir bar fails with a message saying that the directory is not empty. On running ls bar, no files are displayed. Why did the rmdir command fail?

A

Hidden files are present

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

Explain the difference between the commands cd ~smart and cd ~/smart.

A

cd ~smart changes directory to smart directorycd ~/smart changes directory to smart directory from home directory

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

Explain the difference between cd $HOME and pushd $HOME.

A

cd $HOME changes current directory to $HOMEpushd $HOME saves $HOME directory so it can be returned to any time.

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

Explain what the following commands do: (i) cd (ii) cd $HOME (iii) cd ~ (iv) cd cd

A

(i) changes directory(ii) changes directory to home directory(iii) changes directory to home directory(iv) changes directory to cd, if it does not exist, nothing will happen

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

List 5 different ways to change the current working directory to your home directory

A

cd $HOMEcd ~cd

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

How many characters can a Unix filename be?

A

255

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

Which character(s) can’t be used in a Unix filename?

A

/

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

Why are we discouraged from having a filename beginning with a hyphen?

A

maybe confused with other commands

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

Can the files note and Note coexist in the same directory? Why?

A

yes they can because Unix is case-sensitive

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

Explain what the following commands do: (i) rm * (ii) rm -i * (iii) rm -r * (iv) rm rm

A

(i) it will attempt remove all non-hidden files(ii) it will attempt to remove non-hidden files but will ask for verification(iii) it will attempt to remove file or directory and its contents, (iv) will remove file named rm, if it does not exist, nothing will happen

26
Q

How does the Unix shell treat the * when used as an argument to a command like echo *?

A

it will treat it as an indicator for all files and directories in the directory. echo* lists all files and directories in current directory

27
Q

. What is the difference between ls and ls * Unix commands?

A

ls will list all files in a directoryls * will list all files in a directory and it’s contents

28
Q

Does ls . match filenames that begin with a dot?

A

no, it matches filenames that contain a dot.

29
Q

How do you remove only the hidden files in your current working directory? Does rm * remove these files as well?

A

use the command rm .* (remove files with fullstop in front of their names aka hidden files)rm* will not remove these files

30
Q

Explain what the commands ls .* and ls *. display. Does it make any difference if the -d option is added?

A

ls .* displays all hidden files (files beginning with fullstops) and all non-hidden filesls * will display all files with a full stop at the end of the filenamels -d .* shows information about a symbolic link or directory of hidden filesls -d *. does the same for files ending with “.”

31
Q

Explain when mv *.bat *.bit will work without producing any error

A

If “.bat” and “.bit” match exactly two file names, then the “mv” command will rename the first file to the second one (the second file will be overridden)

32
Q

What does the command ls -d [3-h]* mean?

A

list symbolic link or directory of file or directory beginning with a “3”, “h”, or any characters lexically in between in its filename

33
Q

When will the command cd * work?

A

When there is a directory named *

34
Q

. How do you remove all ordinary files in the current directory that(i) are hidden;(ii) begin and end with *;(iii) have numerals as the first three characters;(iv) have single-character extensions?

A

(i) all hidden items begin with a “.” to delete them, simply use rm .*(ii) /**/(iii) [0-9][0-9][0-9](iv) *.?

35
Q

Match the filenames chapa, chapb, chapc, chapx, chapy, and chapz with a wild-card expression

A

chap*[a-z]

36
Q

Devise wild-card patterns to match the following filenames: (i) fool, foo2 and foo5; (ii) quit.c, quit.o and quit.h;(iii) all filenames that begin with a dot and end with swp.

A

(i) foo?(ii) quit.a-z .*swp

37
Q

Explain what these wild-card patterns match: (i) [A-z]????* ; (ii) [0-9]

A

(i) first letter either “A” or “z” or anything lexically in between(ii) files that contain numerals between the first and last letter of the filename

38
Q

A directory bar contains a number of files including one named -foo. How do you remove this -foo file?

A

rm – -foo

39
Q

You have a file named * and a directory named My Documents in the current directory. How do you remove them with a single command using (i) escaping, (ii) quotation?

A

(i) rm * rm -r My\ Documents(ii) rm ‘*’ rm -r ‘My Documents’

40
Q

What will happen when you execute the following Unix commands: (i) mkdir file name, (ii) mkdir ‘file name’ , (iii) mkdir “file name”

A

(i) creates directories ‘file’ and ‘name’(ii) creates directory ‘file name’(iii) also creates a directory ‘file name’

41
Q

What will happen when you execute the following Unix commands: (i) mkdir filename?, (ii) mkdir ‘filename?’ , (iii) mkdir “filename?”

A

(i) unable to create ‘filename?’(ii) creates directory ‘filename?’(iii) also creates directory ‘filename?’

42
Q

What difference do you notice when executing the commands echo “$SHELL” and echo ‘$SHELL’?

A

echo “$SHELL” echoes the current shellecho ‘$SHELL’ echoes the actual string $SHELL

43
Q

How do you display the inode number of a file?

A

ls -i

44
Q

If ls -i shows two filenames with the same inode number, what does that indicate?

A

they all link to the same file despite having different names

45
Q

What is the difference between executing ln file1 file2 and ln –s file1 file2 Unix commands? How will each command affect the inode of file2?

A

creates a link for file1 in file2ls file1 file2 gives them the same inodels -s file1 file2 gives them a different inode number

46
Q

When you invoke ls -l foo, the access time of foo changes. True or false? Explain your answer

A

true if you checked it, modified it, then checked it again

47
Q

Show the octal representation of these permissions: (i) rwxr-xrw- (ii) rw-r—– (iii) –x-w-r–

A

basically to calculate: r = 4 w = 2 x = 13 = 2 + 1 therefore 3 = _wx5 = 4 + 1 therefore 5 = r_x6 = 4 + 2 therefore 6 = rw_7 = 4 + 2 + 1 therefore 7 = rwx(i) 756(ii) 640(iii) 124

48
Q

What will the permissions string look like for these octal values? (i) 567 (ii) 623 (iii) 421

A

(i) r_xrw_rwx(ii) rw__w__wx(iii)r___w___x

49
Q

Use the numeric permission method to change the permission of a file in the current working directory called abc to give the owner user read and write permissions, while giving group users and others read permission only.

A

chmod 644 abc

50
Q

Use the symbolic permission method to change the permission of a file in the current working directory called abc to give the owner user read and write permissions, while giving group users and others read permission only

A

u = userg = groupo = otherchmod u=rw,go=r file1

51
Q

Explain and give example showing the difference between numeric absolute, symbolic absolute, and symbolic relative permission methods.

A

numeric absolute chmod 644symbolic absolute chmod g=r (with equals sign)symbolic relative u+rx or u-rx (adding new permissions or subtracting new permissions)

52
Q

How can you combine absolute and relative permission methods together? Give an example.

A

absolute and relative permission methods can be appended with commaschmod u=rwx,g-w,o-rwx file1

53
Q

. How do you ensure that all ordinary files that you have created have rw-rw—- as the default permissions?

A

umask 660

54
Q

What do the r, w, and x letters mean in a regular file permission string?

A

read permissionswrite permissionsexecute permissions

55
Q

What do the r, w, and x letters mean in a file directory permission string?

A

listing contentscreating filesaccessing files in the directory

56
Q

How do you assign all permissions of a file to the owner and remove all permissions from others using (i) symbolic relative assignment (ii) symbolic absolute assignment (iii) numeric absolute?

A

(i) chmod u+rwx,go-rwx file1(ii) chmod u=rwx, go= file1(iii)chmod 700 file1

57
Q

Assuming that a file’s current permission is rw-r-xr–, specify the chmod argument(s) that you should use to change the file permission to (i) rwxrwxrwx (ii) r–r—– (iii) —r–r– (iv) ———, using both relative and absolute methods of assigning permissions.

A

(i) chmod 777 file1 (numerical absolute) chmod uog=rwx file1 (symbolic absolute) chmod u+x,g+w,o+wx file1 (symbolic relative)(ii) chmod 440 file1 chmod ug=r,o= file1 chmod u-w,g-x,o-r file1(iii) chmod 000 file1 chmod uog= file1 chmod u-rw,g-rx,o-r file1

58
Q

What do you do to ensure that no one is able to see the names of your files?

A

remove read permissions for groups and others

59
Q

The command cd bar failed where bar is a directory. How can that happen?

A

reading permissions removed for bar

60
Q

How do you split a long command sequence into multiple lines?

A

semicolon ;