4. Files and Directories Management in Linux Flashcards

1
Q

What is the representation of the root directory?

A

/

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

How is represented the home directory of a user?

A

~

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

What is the command to know in which directory we’re currently in?

A

pwd (Print Working Directory)

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

What does an absolute path start with in linux?

A

a “/”

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

What is the command to change directory?

A

cd (Change Directory)

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

How do I get directly back to my home directory?

A

With just the command “cd”

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

What are the two types of paths in linux?

A

absolute and relative.

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

What does the . (dot) represent with the cd command?

A

The current directory

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

what does the .. (two dots) represent with the cd command?

A

The parent directory

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

What is the keyboard shortcut to autocomplete path and see all possible files with cd command ?

A

Taping twice the tab key.

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

What is the shorcut to complete the path with cd command?

A

Taping once the tab key.

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

What is the command to list all file inside the current folder?

A

ls

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

What is the command to list files with details?

A

ls -l

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

What is the command to see file size in human notation ?

A

ls -lh

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

What is the command to list files with types?

A

ls -F

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

What is the command to see hidden files?

A

ls -a

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

What is the meaning of the colour of a file?

A

no colour = file
blue = directory
cyan = link

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

How are the directories displayed with the command ls -l ?

A

Permissions - number of links - user - group - size (Bytes) - date of creation / modification - name

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

In permissions, what is the meaning of the first character?

A

Nothing = file
d = directory
l = link

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

What is the meaning of the three parts of permissions?

A

1 -> User
2 -> Group
3 -> all other users

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

What are the different permissions?

A

r (read) - Can list files in the directory.
w (write) - Can rename, create, and delete files in the directory.
x (execute) - Can “cd” into the directory and grant access files.

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

What is the meaning of the last character with the command “ls -F” ?

A

/ -> directory
@ -> link
nothing -> file

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

How do you recognize a hidden file?

A

it always starts with a . (dot)

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

Is it a good thing to create files and folders in the root directory? Yes or no ?
if no, where should you create them ?

A

No. we should create them in the home directory.

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

What is the * character used for?

A

It is a wild card.

26
Q

What is the directory “etc” used for?

A

It contains different configuration files.

27
Q

What is the shortcut to move to the beginning or ending of the command?

A

ctrl+a and ctrl+e

28
Q

Why is a file coloured in green?

A

Because it is executable.

29
Q

What is the command to create a folder?

A

mkdir

30
Q

What does the command “mkdir -p” do?

A

Create the parent directory if non existing.

31
Q

What does the command “rm -r” do?

A

It removes a directory, and its content recursively.

32
Q

What is the command to create an empty file?

A

touch

33
Q

What is the main use of the touch command?

A

Update the modification of a file to the current time.

34
Q

What are the two main text editors?

A

Vim and nano

35
Q

What is the vim command to close it?

A

:q

36
Q

How do I close nano?

A

ctrl+x

37
Q

How do I start editing in vim?

A

Shift + i

38
Q

How to exit a mode in Vim?

A

Press the escape key.

39
Q

What is the command to save changes and close vim editor?

A

:wq

40
Q

How to cut text in nano?

A

ctrl + k

41
Q

How to get help in the nano editor?

A

ctrl + G

42
Q

How do I search text in nano ?

A

ctrl + w

43
Q

How do I replace text in nano?

A

ctrl + \

44
Q

How do I write change in nano?

A

ctrl + o

45
Q

What is the command to copy a file?

A

cp

46
Q

What is the command to copy a folder recursively?

A

cp -r

47
Q

What is the command to see the history of commands?

A

history

48
Q

How to represent all files in directory?

A

*

49
Q

How to move and / or rename a file?

A

mv

50
Q

What is the command to read the first 10 lines of a file?

A

head

51
Q

What is the command to read the last 10 lines of a file?

A

tail

52
Q

What is the command to specifically have the number of lines I want to read from a specific file at the beginning or the end?

A

head / tail -n

53
Q

What is the key to scroll through text with the command “more”?

A

it is the space key

54
Q

What is the command to see the data of a file updating in real time?

A

tail -f

55
Q

What is the command to filter a STDIN by piping?

A

grep

56
Q

What is the character that allows to look for line that starts with a specific character?

A

^ (caret)

57
Q

What is the character that allows to look for line that ends with a specific character?

A

$

58
Q

How do i escape a character?

A

\

59
Q

What is a soft link?

A

It is a pointer to a specific file.

60
Q

What is a hard link?

A

It’s when one or more files have the same inode.

61
Q

What is the command to create a soft link?

A

ln -s

62
Q

What is the command to create hard link?

A

ln