Workbook 5 Flashcards

1
Q

What are the three structures associated with every Linux file?

A

Dentry, Inode, Data. [5/6]

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

What pieces of metadata are found in an inode?

A

The files metadata. [5/5]

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

What is a dentry?

A

The filename. [5/5]

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

What character abbreviation does the ls command use to identify (i) a regular file, (ii) a symbolic link, (iii) a directory, (iv) a block device node, (v) a character device node?

A
Regular Files: - (dash)
Symbolic Link: l (lowercase L)
Directory: d (lowercase D)
Block Device Node: b (lowercase B)
Character Device Node: c (lowercase C) [5/6]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What three timestamps are stored in an inode?

A

atime: Updates whenever the file’s data is read.
ctime: Updates whenever the file’s inode information changes.
mtime: Updates whenever the file’s data changes. [5/8]

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

When does a file’s atime change?

A

Updates whenever the file’s data is read. [5/8]

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

What is the difference between a file’s ctime and mtime?

A

ctime updates whenever the file’s data is read.

mtime updates whenever the file’s data changes. [5/8]

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

Where is a file’s creation time stored in Linux?

A

Linux doesn’t store an initial point of creation time for files. [5/8]

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

What is the difference between a file’s size and its length?

A

Length is how large the file is in bytes.

Size is the amount of disk space the file consumes. [5/8]

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

What two commands display the metadata stored in an inode?

A

ls and stat [5/9]

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

What is the difference between the –r and the –R options of the ls command?

A
  • r (lower case): Reverses the sorting order.

- R (upper case): Lists the subdirectories as well. [5/10]

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

Write a command line that outputs /etc’s contents in order of modification time.

A

ls /etc -t [5/10]

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

What does the ls command’s –h and –F options do?

A
  • h: “Human Readable” mode uses abbreviations when reporting file lengths.
  • F: Decorates filenames with symbols to indicate file type. [5/10]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Using an ls command option, give a command line that outputs the inode of /etc’s files.

A

ls /etc -i [5/10]

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

What is a hard link and why would you create one?

A

Multiple Dentries are assigned to a single inode as you can exist in two places or have two names. [5/17]

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

What is a soft (a.k.a. symbolic) link?

A

Distinct inodes that refer to other files. [5/17]

17
Q

What does a soft link contain?

A

A reference to another file to link to.[5/20]

18
Q

What happens if you only provide 1 argument to the ln command?

A

the ln command will effectively assume

a last argument of “.”. [5/21]

19
Q

How can you create a recursive link?

A

Having two or more links, that all link to each other. [5/22]

20
Q

When is a hard link appropriate and when is a soft link appropriate?

A

Soft links can refer to directories while Hard links cannot. More reasons on [5/23]

21
Q

How do the locate and find commands operate differently?

A

The locate command uses a database to quickly locate files on the system by filename.
The find command performs a real time, recursive search of the filesystem. [5/55]

22
Q

Using the locate command, give a command line that lists all .gif files on the system that have fish in their name.

A

locate “fish.gif” [5/56]

23
Q

What does the following command line do? find /etc/sysconfig/networking

A

Prints out all files that have /etc/sysconfig/networking in their path. [5/56]

24
Q

Give a command line to find all .conf files in /etc

A

locate /etc/”*.conf” [5/56]

25
Q

Give a command line to find all files in /etc owned by group cist

A

find /etc/ -group cist [5/57]

26
Q

Give a command line to find all files in /etc last modified 3 days ago

A

find /etc/ -mtime 3 [5/57]

27
Q

Give a command line to find all files in /etc modified less than 3 days ago

A

find /etc/ -mtime -3 [5/57]

28
Q

Give a command line to find all files in /etc that are more than 300K in size

A

find /etc/ -size +300 [5/57]

29
Q

Give a command line to find all files in /etc owned by user george

A

find /etc/ -name george [5/57]

30
Q

Give a command line to find all files in /etc that are symbolic links

A

find /etc/ -type l [5/57]

31
Q

Using find and find actions, give a command line that finds all files in /etc that are greater than 200K in size and copies them to /tmp/big/

A

find /etc -size +200k -exec cp {} /tmp/big \; [5/58]

32
Q

What option must you almost always use with the tar command?

A

-f which specifies which archive file is being created, extracted, or listed. [5/69]

33
Q

Using tar, give the command line that archives a directory named report and that names the archive report.tar

A

tar cf report.tar report [5/69]

34
Q

Give a command line that lists the contents of the archive named report.tar

A

tar tf report.tar [5/69]

35
Q

Give a command line that extracts the contents of the archive named report.tar

A

tar xf report.tar [5/69]

36
Q

What does the tar command’s –v option do?

A

Activates verbose mode, listing each and every file it’s currently interacting with [5/71]

37
Q

Do you have to precede the tar command’s options with a dash?

A

No. [5/73]

38
Q

What does it mean if a file has a .tar.gz extension?

A

The archive was compressed using the gzip compression format [5/73]