linux files and directories Flashcards

1
Q

how to view the content of the root directory in linux in long format

A

ls -l /

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

subdirectory Contains user executable programs.

A

/bin

for eg, the ls program is located in /bin

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

subdirectory Contains system executable programs used by the root user and the system

A

/sbin

for eg, the clock program is located in /sbin

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

subdirectory Contains shared library files used by /bin and /sbin

A

/lib

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

subdirectory Contains special file system entries for devices attached to the system

A

/dev

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

subdirectory Contains the Linux kernel and bootloader programs.

A

/boot

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

The Linux kernel program is
typically known as

A

vmlinuz

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

subdirectory Contains system configuration files

A

/etc

for eg user account information

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

subdirectory Contains special files pertaining to the state of the running Linux system. These files
are virtual files

A

/proc

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

subdirectory Contains temporarily mounted file systems.

A

/mnt

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

subdirectory Contains programs that can be run any users of the system

A

/usr

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

subdirectory Contains variable data files pertaining to the on-going system status such as log files
of system activities

A

/var

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

Contains sub-directories of user accounts to store personal data files.

A

/home

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

subdirectory Contains temporary files

A

/tmp

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

what is the home directory of the root user

A

/root

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

subdirectory which Contains software packages for installation

A

/opt

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

what does ls /bin return

A

commands that you can run on linux

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

what does ls -l do

A

displays the content of the file directory in long format

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

how to create new files

A

use touch command

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

how to display all files starting with chart and report

A

ls -l chart* report*

21
Q

how to create multiple files with different names using touch command

A

touch {report,chart}_{jan,feb,march}

it will create four files with the names “report_jan”, “report_feb”, “report_march” and “chart_jan”, “chart_feb”, “chart_march”

22
Q

return all the files that start with chart

A

ls -l chart*

23
Q

return all the files that end with jan

A

ls -l *jan

24
Q

what is absolute path

A

filepath starts from the root and begins with a slash

25
Q

what is relative path

A

filepath reference the current directory and path does not begin with a slash

26
Q

absolute path example

A

/home/user/documents/files/report.txt

27
Q

relative path example

A

‘documents/files/report.txt’

28
Q

what is a hidden file

A

file name begins with a dot

29
Q

how to list all the hidden files

A

ls -a

lists ALL the files including hidden files

30
Q

what does ls -d .* do

A

will list all the files and directories in the current working directory that starts with a “.”

-d option shows the directories themselves, not the contents of the directories, this command will not show the contents of subdirectories that matched with the regular expression

31
Q

how to make 2 directories using one cmd

A

mkdir sales clothes

32
Q

how to change into the home directory

A

cd ~

33
Q

how to change into the root directory

A

cd /

34
Q

how to go to the previous working directory

A

cd -

35
Q

what is cd ../.. do

A

if the current working directory is ‘/home/user/documents/files’, the command cd ../.. would change the current working directory to ‘/home/user/’.

36
Q

How does the cp command work in Linux?

A

The basic syntax for the cp command is: cp source destination.

  • The source argument is the file or directory that you want to copy.
  • The destination argument is the location where you want to copy the file or directory.
37
Q

how to list all files including the ones in the subdirectory

A

ls -Rl

38
Q

How does the mv command work in Linux?

A

The mv command in Linux is used to move or rename files and directories from one location to another. The basic syntax for the mv command is: mv source destination.

The source argument is the file or directory that you want to move.
The destination argument is the location where you want to move the file or directory.

39
Q

how to remove all the folder and files inside a directory

A

rm -R /tmp/temp_folder

deletes the folder temp_folder and all of its contents located in the /tmp directory.

40
Q

how to display the file permissions for that directory

A

ls -ld

41
Q

what are the different types of users

A

user
group
others

42
Q

what is the number for read

A

4

43
Q

what is the number for write

A

2

44
Q

what is the number for execute

A

1

45
Q

how to d to create a symbolic link “pear.txt”

A

ln -s apple.txt pear.txt

46
Q

how to create a hard link to apple.txt

A

Run the “ln apple.txt orange.txt” command to create a hard link “orange.txt” that points to “apple.txt”.

47
Q

What differences between hard links and symbolic links can you discover from the ls
command output?

A

Unlike hard links, the link count for symbolic links is one.
The name of the file in which the symbolic links is pointing to is displayed.
Symbolic links can point to a file that does not exist.

48
Q

what does chmod g+w do ?

A

chmod g+w hello command, the group owner of the file hello will be given write permissions, allowing them to modify the file.

+w means write permission is added

49
Q

what does chmod u-x, g = r, o = r hello do ?

A

The u-x option is used to remove execute permissions for the owner, g = r option is used to set read permissions for the group and o = r option is used to set read permissions for others. The hello argument is the file or directory that you want to modify the permissions for.