File Handling And Bash Flashcards
dd
Copies & converts files, often for arbitrary size. if= of= bs: block size count:amount of block size
tar
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
find
- name
- ctime
- atime
- empty
- exec []{}|;
- type
- newer
zcat
View gzip compressed.
Similar bzcat and xzcat
nl
#of lines without blanks. -b: include blank lines
wc
Word count: line count (all), words in file, byte count, name
- c: for bytes
- l : for line numbers
- w: words only
od
Octal dump.
Col. 1 byte offset, next octal info.
-a: ASCII
-c: char format
Checksums
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.
sort
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
uniq
Condenses repeated lines to identify unique. Only directly adjacent default
-c: counts of merges displayed
-u: count
—group: grouping
tr
Translate/swap chars to another in output. Strongly quoted
-d: delete given char
cut
Extract col./data fields from file
- d: delimiter. Strong quotes
- f: field in , form
paste
Similar to cat, but in parallel default delimiter tab.
- d <strong>: specified delimiter to add.</strong>
- s: serial paste<strong></strong></strong>
sed
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
split
Breaks file into pieces. Normally 1000 lines per piece
-b: byte number
—verbose
-n: number of individual files