File Handling And Bash Flashcards

1
Q

dd

A
Copies & converts files, often for arbitrary size.
if=
of=
bs: block size
count:amount of block size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

tar

A

Wrap up files & folders into archive file without compression.
-c: creating archive
-f: tar file name
-j: bzip2 compression flag
Unzipped by bunzip2, also compressed with bzip2
-t: tar contents
-v: verbose
-x: xpand
-z: gzip compression & decompression flag
Gunzip and gzip
NOTE ALSO: xz and unxz

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

find

A
  • name
  • ctime
  • atime
  • empty
  • exec []{}|;
  • type
  • newer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

zcat

A

View gzip compressed.

Similar bzcat and xzcat

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

nl

A
#of lines without blanks.
-b: include blank lines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

wc

A

Word count: line count (all), words in file, byte count, name

  • c: for bytes
  • l : for line numbers
  • w: words only
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

od

A

Octal dump.
Col. 1 byte offset, next octal info.
-a: ASCII
-c: char format

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

Checksums

A

md5sum, sha256sum, sha512sum.
Redirect output to appropriate named file for test.
Ex: .md5, .sha256, .sha512
-c: check with file storing sum and file name relevant to.

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

sort

A

Sort &/or merge lines of file, defaulting to first column.

  • k: specify column to use as delimiter
  • n: detects full number
  • t: explicit delimiter char(s)
  • u: only unique lines printed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

uniq

A

Condenses repeated lines to identify unique. Only directly adjacent default
-c: counts of merges displayed
-u: count
—group: grouping

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

tr

A

Translate/swap chars to another in output. Strongly quoted

-d: delete given char

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

cut

A

Extract col./data fields from file

  • d: delimiter. Strong quotes
  • f: field in , form
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

paste

A

Similar to cat, but in parallel default delimiter tab.

  • d <strong>: specified delimiter to add.</strong>
  • s: serial paste<strong></strong></strong>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

sed

A

Stream editor. Alter text in file, search & replace words, directives in strong quotes.ex: ‘s/desktop/workstation/‘: substitutes desktop with workstation. g/ to change all.
-i: permanent

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

split

A

Breaks file into pieces. Normally 1000 lines per piece
-b: byte number
—verbose
-n: number of individual files

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

Man page numbers

A
1=executable pkgs/small cud’s
2=syscalls
3=lib calls
4=special files
5=file formats &amp; conventions
6=games
7=misc items &amp; conventions
8=sysadmin cmds 
9=nonstandard kernel routines