Workbook 2 Flashcards

1
Q

Is a directory a file?

A

Yes. [2/5]

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

What is the name of the graphical tool that you can use to explore the directory tree?

A

Tree [2/6]

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

In terms of directories, explain what happens when a process is started.

A

It is assigned a current working directory. [2/9]

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

What does bash stand for?

A

Bourne Again Shell [2/9]

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

What command outputs your current working directory?

A

pwd [2/9]

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

What does the following command line do? cd –

A

The Previous working directory - not to be confused with the parent (..) [2/10]

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

Give two command lines that change your current working directory to your home directory.

A

cd

cd ~ [2/10]

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

True or false? For user bob, his home directory is always /home/bob

A

True [2/15]

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

What is the superuser’s home directory?

A

/root/ [2/15]

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

What is the purpose of the /tmp directory?

A

A temporary folder that anybody can use for tasks that don’t need permanent file access. [2/16]

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

How are virtually all aspects of a Linux system configured?

A

By editing a configuration file. [2/16]

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

True or false? Ordinary users cannot read any files in the /etc directory.

A

False. Ordinary users can read files, but not write to them. [2/16]

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

What is the difference between the /bin and /usr/bin directories?

A

/bin holds core applications like ls, mv, and rm.

/usr/bin holds supplementary applications like your web browser. [2/16]

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

What is the difference between the /sbin and /usr/sbin directories?

A

Similar to /bin and /usr/bin but for the Superuser. [2/17]

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

What is the significance of the following command line’s output? which cp

A

The which command shows the full path of the program you provide, in this case it would be /bin/cp [2/18]

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

What does the following command line do? touch me

A

Creates a file called “me” in the present working directory. [2/19]

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

Is the following a valid command line? If so, what does it do? pwd > results.txt

A

Saves your present working directory in results.txt [2/22]

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

Give a command line that appends the phrase I love Linux to the contents of the file named greetings.txt

A

echo “I love Linux”&raquo_space; greetings.txt [2/23]

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

How would you copy the file britney.midi and names the copy backup.midi

A

cp britney.midi backup.midi [2/24]

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

How would you copy the file /etc/passwd to your current working directory with the same name?

A

cp /etc/passwd ~/ [2/24]

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

If you specify more than two arguments to the cp command, what must the last argument be?

A

A folder for the files to be copied to, cannot be a file. [2/24]

22
Q

How would you rename the file britney.midi to junk.midi

A

mv britney.midi junk.midi [2/24]

23
Q

True or false? When moving a file, the mv command always moves the file’s data.

A

False. mv only changes the FQN for the file. [2/24]

24
Q

Give a command line that moves ~/britney.midi to the songs directory in your home folder.

A

mv ~/britney.midi ~/songs/ [2/24]

25
Q

Give a command line that renames the cisco directory to ccna

A

mv cisco ccna [2/25]

26
Q

True or false? The command ‘rm ~/Stuff/’ would work and delete the non-empty stuff directory?

A

False. rm will not delete directories without the -r switch. [2/25]

27
Q

How would your remove the files ~/britney.midi and junk.midi?

A

rm ~/britney.midi ~/junk.midi [2/26]

28
Q

True or false? For all users, cp clobbers files without confirmation.

A

False, as the root user could destroy system critical files accidentally. [2/26]

29
Q

How would you move the files song1.mp3 and song2.mp3 to the music folder?

A

mv song1.mp3 song2.mp3 songs/ [2/28]

30
Q

How would you enable the noclobber option for bash?

A

set -o noclobber [2/30]

31
Q

How would you disable the noclobber option for bash?

A

set +o noclobber [2/30]

32
Q

Give a command line that creates a directory named work

A

mkdir work [2/33]

33
Q

Give a command line that creates two directories whose names are work and play

A

mkdir work play [2/33]

34
Q

Give a command line that creates the directory homework/linux, assuming that the homework directory did not exist.

A

mkdir -p homework/linux [2/33]

35
Q

True or false? The following command line recursively lists a directory’s contents. ls -r

A

True [2/34]

36
Q

True or false? The following command line will always remove that directory. rmdir somedir

A

False. It will only remove it if the folder is empty. Otherwise you must use the rm -r command [2/34]

37
Q

What command outputs an ASCII directory tree?

A

tree [2/38]

38
Q

What is the maximum length of a Linux filename, exclusive of any directory components?

A

255 Characters [2/45]

39
Q

What is the only character not allowed in a Linux filename?

A

/ (forward slash) As its used to differentiate between folders. [2/45]

40
Q

What are the safe filename characters?

A

A-Z a-z 0-9 . _ - + ~ [2/47]

41
Q

What is the first character in the name of all hidden files?

A

. (period) [2/47]

42
Q

Give a command line that creates a hidden directory named secret

A

mkdir .secret [2/47]

43
Q

If you wanted to find all .html files, which file globbing pattern would you use?

A

*.html [2/48]

44
Q

If you wanted to find files that start with the letters P or S, which globbing pattern would you use?

A

[psPS]* [2/48]

45
Q

If you wanted to find files that end with the letters A or Q, which globbing pattern would you use?

A

*[aqAQ] [2/48]

46
Q

What command tells you a file’s type?

A

file [2/56]

47
Q

Using the cat command, how can you output all characters, including control characters?

A

The -a switch outputs all characters, including control characters. [2/57]

48
Q

What navigation command in less and more moves you back one full screen?

A

b [2/57]

49
Q

How many lines do the head and tail command output by default?

A

10 lines. [2/58]

50
Q

What is the name of the graphical text editor available on all X-window environments?

A

Gedit. [2/68]