Chapter 4 - Managing Files Flashcards

1
Q

A few characters have special meaning and should never be used in filename. There are 5 of them:

4-179

A
Asterisk
Question mark
Forward slash
Backslash
Quotation mark
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the limit on filename length?

4-179

A

255 characters (255 bytes)

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

Talking about dots and directories. If your current directory is /home/jerry, what does “.” And “..” refer to?

4-179

A
. = /home/jerry (current directory)
.. = /home (parent directory)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a wildcard?

4-180

A

Symbol or set of symbols that stands in for other characters

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

What are the 3 classes of wildcards?

4-180

A

Question mark – single character
Asterisk – matches any character, set of characters, no character
Bracketed values – these characters match any characters in the set

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

When you are understanding file commands, there are 5 everyday commands that are CRITICAL. Tell me what they are:

4-180

A
List
Copy
Move
Rename
Delete
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Tell me the syntax for the list command

4-180

A

ls [options] [files]

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

if you do the ls command as ls –a or ls –all, what will happen?

4-181

A

You’ll see the configuration files (begin with a .)

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

If you do the ls command as ls –r or ls –recursive, what will happen?

4-182

A

You’ll display the target directory’s files AND all of its subdirectories.

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

Tell me the syntax for the copy command.

4-183

A

cp [options] source destination

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

if you do a cp –R, what will happen?

4-184

A

You’ll copy the directory and all its subdirectories

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

What is the syntax for the move command?

4-185

A

mv [options] source destination

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

what’s the command for deleting a file? What’s the syntax for it?

4-186

A

rm

rm [options] files

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

in linux, there are 3 time stamps for every file. Tell me what they are:

4-187

A

Last file-modification time
Last inode change time
Last access time

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

What does the “make” utility do?

4-187

A

Compiles a program from source code

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

What do you use the “touch” command for?

4-187

A

Modifying the time stamps

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

There are several commands you can use for archiving files. Tell me what they are.

4-187

A

tar
cpio
dd

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

the tar utility has 7 commands you should know. What are they and what do they do?

4-188

A

Create – c – creates an archive
Concatenate – A – appends tar files to an archive
Append – r – appends non tar files to an archive
Update – u – appends files that are newer than those in an archive
Diff (or compare) – d – compares an archive to files on disk
List – t – lists an archive’s contents
Extract (or get) – x – extracts files from an archive

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

What do qualifiers do?

4-188

A

They modify what commands do.

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

What are the 6 most useful qualifiers and what do they do?

4-189

A
g – perform incremental backup
p – keep permissions
z – use gzip compression
j – use bzip2 compression
J – use xz compression
v – be verbose
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

there are 3 compression tools used with the tar command. Tell me what they are and whether they apply compression to the archive file or to the individual files of the archive file.

4-189

A

gzip
bzip2
xz

They apply compression to the whole archive file.

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

Of the 3 compression tools, which one offers the best compression? What is something that is compressed by it?

4-190

A

xz

The linux kernel

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

Tell me the syntax for tar archiving.

4-190

A

tar [options] destination/tar_file_name files-to-archive

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

if you use the tar command to archive data, what command do you use to restore data from archive file or media device?

4-191

A

cpio

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

the cpio utility has 3 modes. Tell me what they are.

4-191,192

A

Copy out mode –o, this creates an archive and copies files into it
Copy in mode –i, this extracts data from an existing archive
Copy-pass mode –p, it combines the copy-out and copy-in

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

There are options for use with cpio. They are listed below, tell me their abbreviations and what they do.

  1. Reset-access-time
  2. Append
  3. Pattern-file=filename
  4. File=filename
  5. Format=format
  6. No-absolute-file-names
  7. List
  8. Unconditional
  9. Verbose

4-192,193

A
  1. Resets the access time after reading a file so that it doesn’t appear to have been read
  2. Appends data to an existing archive
  3. Uses the contents of filename as a list of files to be extracted in copy-in mode
  4. Uses filename as the cpio archive file; if this parameter is omitted, cpio uses standard input or output
  5. Uses a specified format for the archive file (bin, crc, and tar)
  6. uses the filename specified by filename instead of standard output
  7. desplays a table of contents for the input
  8. replaces all files without first asking for verification
  9. displays filenames as they’re added to or extracted from the archive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What do you have to do in order to use cpio to archive a directory?

4-193

A

You have to pipe the standard output of the find utility into the cpio command.

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

In linux, what is a link?

4-195

A

It is a way to give a file multiple identities.

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

What are the two types of links?

4-195

A

Hard links and symbolic links. Hard links are produced by creating two directory entries that point to the same file. The only difference is that one of the filenames was created before the other.
Symbolic links are special file types, they are separate files whose contents point to the linked-to file.

30
Q

Show me the difference in creating hard and symbolic links via commands.

4-196,197

A

ln afile.txt hlink_afile

ln –s bfile.txt slink_bfile

31
Q

what does the mkdir command do?

4-198

A

Creates a directory

32
Q

What does the rmdir command do?

4-198

A

Destroys a directory

33
Q

You want to use the ls command to show ownership and permission information. How do you modify the command?

4-199

A

ls –l

34
Q

which command allows you to change a file’s owner?

4-200

A

chown

35
Q

which command allows you to change a file’s group?

4-200

A

chgrp

36
Q

for a file, there are special bits called permission bits. For example, when you do ls –l test, the first part of the returned message is –rwxr-xr-x. the first character has special meaning. What does that first character tell you?

4-201

A

The file type code

37
Q

There are 7 file type codes which are part of the access control string when the –l option is used on ls. Tell me what they are.

-
d
l
p
s
b
c

4-201

A
normal data file
directory
symbolic link
named pipe
socket
block device
character device
38
Q

how many bits does it take to represent the main linux permission options?

4-202

A

10

39
Q

Tell me the breakdown of the access control string (what are the 10 bits for?)

4-202

A

1st bit – file type code
2nd, 3rd, 4th bits – owner permissions
5th, 6th, 7th bits – group permissions
8th, 9th, 10th bits – world permissions

40
Q

The sum of bits adds up to a permission. What is read worth? What is write worth? What is execute worth?

4-203

A

Read – 4
Write – 2
Execute – 1

41
Q

What is the sticky bit used for?

4-205

A

To protect files from being deleted by those who don’t own the files

42
Q

When you change a file’s mode, what are you changing? What command allows you to do this?

4-206

A

Its permissions

chmod

43
Q

you can specify a file’s mode in two basic forms. What are they?

4-206

A

Three digital octal

Symbolic

44
Q

There are codes used in symbolic mode. These include the permission set code, the change type mode, and the permission to modify code. I’ll give you the name, you tell me what they mean.

Permission set codes: u, g, o, a
Change type codes: +, -, =
Permission to modify codes: r, w, x, X, s, t, u, g, o

4-207

A

u- owner, g- group, o- other, a- All
+- Add, – Remove, =- set equal to
r- read, w- write, x- execute, X- execute only if the file is a directory or already has execute permission, s- SUID or SGID, t- sticky bit, u- existing owner’s permissions, g- existing group permissions, o- existing other permissions

45
Q

when you are setting the default mode and group, you subtract the umask from the directory permissions and file permissions. These permissions start at some number by default, what are they?

4-210

A

File permissions – 666

Directory permissions – 777

46
Q

What are disk quotas?

4-213

A

Limits enforced by the OS on how many files or how much space a single user may consume.

47
Q

If you are the superuser, you can turn quotas on at any time. What command do you use for this? What about for turning them off?

4-214

A

quotaon, quotaoff

48
Q

Say that you wanted to edit sally’s quota. What command do you use? What about for a whole group?

4-215,216

A

edquota sally

edquota –g users

49
Q

FSSTND had limitations that were becoming more and more troublesome by 1995. What new standard replaced FSSTND? What does the acronym stand for?

4-217

A

FHS

Filesystem Hierarchy Standard

50
Q

I’m going to through some directories at you. You tell me if they are static, variable, shareable, unshareable.

/usr
/opt
/etc
/boot
/home
/var/mail
/var/ru
/var/lock

4-218

A

/usr and /opt are static and shareable
/etc and /boot are static and unshareable
/home and /var/mail are variable and shareable
/var/run and /var/lock are variable and unshareable

51
Q

What does / mean?

4-218

A

The root directory, the root filesystem.

52
Q

What does /boot have?

4-218

A

Static and unshareable files related to the computer’s initial booting.

53
Q

What does /etc have?

4-218

A

Higher level startup files and system configuration files that control the various programs and services offered on a system.

54
Q

What is /bin for?

4-219

A

This directory contains critical executable files (like ls, cp and mount).

55
Q

What is /sbin for?

4-219

A

Similar to /bin, but it contains programs that are normally run only by the system administrator.

56
Q

What is /lib for?

4-219

A

Similar to /bin and /sbin, but it contains program libraries.

57
Q

What is /usr for?

4-219

A

Hosts the bulk of a linux computer’s programs.

58
Q

What is /usr/local for?

4-219

A

Contains files that a system administrator installs locally.

59
Q

What is /usr/share/man for?

4-219

A

Stores the manual pages used by the man command.

60
Q

What is /usr/X11R6?

4-219

A

Houses files related to the X Window System.

61
Q

What is /opt for?

4-219

A

Similar to /usr/local, but intended for ready-made packages that don’t ship with the OS.

62
Q

What is /home for?

4-220

A

Contains users’ data

63
Q

What is /root for?

4-220

A

Home directory for the root user.

64
Q

What is /var for?

4-220

A

Contains transient files of various types (system log files, print spool files, mail and news files

65
Q

What is /tmp for?

4-220

A

When programs need to create temporary files, they can be found here.

66
Q

What is /mnt for?

4-220

A

Mounting removable media devices within its normal directory structure.

67
Q

What is /media for?

4-220

A

Optional part of the FHS, contains subdirectories for specific media types.

68
Q

What is /dev for?

4-220

A

Files that function as hardware interfaces

69
Q

What is /proc for?

4-221

A

Virtual filesystem that is created dynalically to provide access to certain types of hardware information that aren’t accessible via /dev.

70
Q

It is recommended to keep certain directories on their own partition. There are 7 of them. Tell me what they are.

4-221

A
/boot
/home
/opt
/tmp
/usr
/usr/local
/var
71
Q

There are directories that should NOT be on their own partition. There are 5 of them. Tell me what they are.

4-221

A
/bin
/dev
/etc
/lib
/sbin
72
Q

There are several approaches to finding files. What commands do this? There are 4 of them

4-222,223,224

A

find, locate, whereis, which