CH9: Working with file Flashcards

1
Q

all files are case sensitive (T/F)

A

True

winter.txt !== Winter.txt

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

everything is a file (T/F)

A

True

A directory is a special kind of file, but it is still a (case sensitive!) file.

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

Define DIrectory

A

A directory is a special kind of file, but it is still a (case sensitive!) file.

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

file

A

The file utility determines the file type. Linux does not use extensions to determine the file type

~$ file pic33.png
pic33.png: PNG image data, 3840 x 1200, 8-bit/color RGBA, non-interlaced

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

how linux recognize file types ?

A

The file command uses a magic file that contains patterns to recognise file types. The magic file is located in /usr/share/file/magic

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

file -s

A

for special files
like:
/ prod
/ dev

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

touch

A

create an empty file

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

touch -t

A

set some properties while creating empty files

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

rm

A

remove forever

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

Linux have a trash bin to recover removed files (T/F)

A

the command line in general does not have a waste bin or trash can to recover files

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

rm -i

A

o prevent yourself from accidentally removing a file

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

rm -rf

A

O will not remove none empty directories

O The rm -rf statement is famous because it will erase anything

You can literally erase your entire file system by accident.

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

cp

A

To copy a file, use cp with a source and a target argument.

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

how to copy file

A

cp file42 file42.copy

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

Copy file to another directory

A

paul@debian7:~$ mkdir dir42 paul@debian7:~$ cp SinkoDeMayo dir42

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

cp -i

A

To prevent cp from overwriting existing files

aul@debian7:~$ cp -i SinkoDeMayo file42 cp: overwrite `file42’? n paul@debian7:~$

17
Q

mv

A

to rename a file or to move the file to another directory

Rename files
ls
file33

mv file33 file34

ls
file34

also can used to rename directories

18
Q

mv -i

A

to prevent for accidently rename file

19
Q

mv is more popular than rename

A

use mv whenever you need to rename only a couple of files.

the rename command on linux use regular expressions

20
Q

rename ‘s/.txt/.png/’ *.txt

what this code do

A

switches all occurrences of txt to png for all file names ending in .txt.

21
Q

$ rename ‘s/file/document/’ *.png

A

switches all (first) occurrences of file into document for all file names ending in .png.

22
Q

RHEL short for

A

Red Hat Enterprise Linux