Linux File Commands Flashcards

1
Q

Compare files

A

diff file1 file2

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

Force delete of

A

rm -rf

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

Overite/delete file

A

shred -f -u

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

Matches ref_file timestamp

A

touch -r

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

Set file timestap

A

touch -t YYYMMDDHHSS

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

List connected drives

A

sudo fdisk -l

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

Mount USB key

A

mount /dev/sda# /mnt/usbkey

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

Compute md5 hash

A

md5sum -t file

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

Generate md5 hash

A

echo -n “str” | md5sum

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

SHA1 hash of file

A

sha1sum file

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

Sort/show unique lines

A

sort -u

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

Count lines w/ “str”

A

grep -c “str” file

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

Create .tar from file

A

tar cf file.tar files

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

Extract .tar

A

tar xf file.tar

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

Create .tar.gz

A

tar czf file.tar.gz files

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

Extract .tar.gz

A

tar xzf file.tar.gz

17
Q

Create .tar.bz2

A

tar cjf file.tar.bz2 files

18
Q

Extract .tar.bz2

A

tar xjf file.tar.bz2

19
Q

Compress/rename file

20
Q

Decompress file.gz

A

gzip -d file.gz

21
Q

UPX packs orig.exe

A

upx -9 -o out.exe orig.exe

22
Q

Create zip

A

zip -r \Directory*

23
Q

Cut block 1K-3K from file

A

dd skip=1000 count=2000 bs=8 if=file of=file

24
Q

Split file into 9K chunks

A

split -b 9K \

25
Win compatible txt file
awk 'sub("$"."\r")' unix.txt > win.txt
26
Find PDF files
find -i -name -type *.pdf
27
Search for setuid files
find / -perm -4000 -o -perm -2000 -exec ls -ldb {} \;
28
Convert to *nix format
dos2unix
29
Determine file type/info
file
30
Set/Unset immutable bit
chattr (+/-)i