File Ops Flashcards

1
Q

What is the ‘diff’ tool used for?

A

Comparing files line by line

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

What is the ‘cmp’ tool used for?

A

Comparing files byte by byte

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

What syntax do ‘diff’ & ‘cmp’ use to compare files?

A

[diff | cmp] filename1 filename2

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

What is the ‘tar’ command used for?

A

Bundling multiple files into a single file called a ‘tarball’ without compression

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

What is the ‘gzip’ command used for?

A

Creating compressed archives of multiple files

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

How can archives compressed with ‘gzip’ be unzipped?

A

‘gzip -d’ or by using ‘gunzip’

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

How can ‘tar’ and ‘gzip’ be effectively used together?

A

‘tar’ file bundles can be compressed using ‘gzip’ to make sending large file archives more efficient

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

What command creates a tarball?

A

tar cvf archive.tar /path/to/files

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

How do you extract files from a tarball?

A

tar xvf archive.tar

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

How do you ‘gzip’ a tarball?

A

gzip archive.tar

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

How do you unzip a gzipped tarball?

A

gzip -d archive.tar.gz

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

What is the ‘truncate’ tool used for?

A

To shrink or extend the size of a file

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

Can ‘truncate’ be used for compression?

A

No, truncate is destructive so shrinking a file will cause data loss

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

How can ‘truncate’ be used to shrink or extend a file?

A

truncate -s num_bytes filename (num_bytes can be smaller than the file to shrink it or greater than the file to extend it)

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

What is the ‘cat’ command used for?

A

Sending the contents of a file to an output stream and concatenating multiples files together

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

How can multiple files be concatenated into a new file using ‘cat’?

A

cat file1 file2 file3 > file4

17
Q

What is the ‘split’ command used for?

A

Splitting the contents of a large file into multiple smaller files

18
Q

How can a single file be split into multiple smaller files using ‘split’?

A

split -l num_lines filename split_file_prefix

19
Q

How does naming work when using ‘split’?

A

A file name prefix is provided when splitting the files. Split files are then named prefix + {aa..az} then {ba..bz} then {ca..cz} etc