Section2 Filesystem commands Flashcards

(25 cards)

1
Q

What is the primary goal of the Managing Files and Directories lab?

A

To reinforce the commands for creating, copying, moving and deleting files and folders.

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

Which command is used to create an empty file?

A

The touch command
example touch file.txt

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

What is the function of the mkdir command with -p flag? example mkdir -p

A

It creates parent directories as needed in the specificed path.

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

What redirection operator overwrites the entire content of a file or creates the file if it doesn’t exist?

A

The standard output redirection operator >

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

The echo ‘Hello’ > file.txt command will __ any previous data in the file.txt

A

overwrite

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

Which redirection operator adds new data to the end of a file while preserving its existing content?

A

The append redirection operator»_space;
example echo “Hi”»_space; file.txt

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

The echo “World”»_space; file.txt
command will add “World” to the __ of the file.

A

to the end of the file

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

What command is used to copy a file?

A

The cp command
example cp file.txt new_location

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

Which single command is used for both moving and renaming files in linux?

A

The mv command.

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

how would you rename the file old.txt to new.txt using the mv command?

A

mv old.txt new.txt

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

In Linux renaming a file is conceptually the same as __ it to the same location with a different name.

A

moving

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

Why would the command rmdir FolderName fail?

A

It fails if the folder is not empty.

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

What command is used to delete a directory and all of its contents including subdirectories?

A

The rm - r command
ex: rm -r directory

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

What does the -r flag in the rm -r FolderName
command signify?

A

It signifies a recursive deletion processing the directory and all its contents.

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

What is a critical safety consideration when using the rm -r command?

A

The deletion is permanent and cannot be easily undone.

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

What command is used to navigate into a specific directory?

A

The cd command
ex: cd Project_Alpha

17
Q

From within a subdirectory. What command navigates you back to the parent directory?

A

The cd command

18
Q

What command is used to verify the text contents of a file directly in the terminal?

A

The cat command
ex: cat data_raw.txt

19
Q

What command is used to list the files and directories in the current location?

A

The ls command
ex: ls directory_name

20
Q

In the labs P2.2 step which command writes Initial Setup Complete to data_raw.txt?

A

echo “Inital Setup Complete” > data_raw.txt

21
Q

In the lab P2.3 step. Which command appends File Version 1.0 to data_raw.txt?

A

echo “File Version 1.0”»_space; data_raw.txt

22
Q

What command is used in step P2.4 to copy data_raw.txt into the Source folder with the new name data_v1.txt

A

cp data_raw.txt Source/data_v1.txt

23
Q

In the labs P2.5 step, what command moves the config.ini file into the Source subfolder?

A

mv config.ini Source/

24
Q

What is the purpose of the step P2.6 which uses the command mv data_raw.txt archive.txt?

A

To rename the file data_raw.txt to archive.txt

25
What command completes the labs final cleanup step of removing the entire project directory?
rm -r Project_Alpha