Buntch of commands Flashcards

(14 cards)

1
Q

Q: What does the mkdir command do, and what type of arguments does it take?

A

A: Creates directories using absolute or relative pathnames.

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

Q: What does the mv command do, and what arguments does it require?

A

A: Moves or renames files and directories; requires at least a source and a destination.
Example:
mv /etc/sample1 /root

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

Q: How do you move multiple files to a directory using the mv command?

A

A: List all source files, then the target directory as the last argument.
Example:
mv /etc/sample1 /etc/sample2 /root

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

Q: Can mv use wildcards to move multiple files?

A

A: Yes, wildcards can be used to match multiple source files.
Example:
mv /etc/sample* /root

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

Q: What does mv do if the target is a directory?

A

A: Moves the source file(s) into the target directory.

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

Q: What does mv do if the target is an existing filename and one source file is specified?

A

A: Overwrites the target file with the source file.

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

Q: What does mv do if the target is a nonexistent filename in a directory?

A

A: Creates a new file with that name and moves the source file to it.

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

Q: How is the mv command used to rename a file?

A

A: By moving the file to the same directory with a different filename.

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

Q: Can the mv command be used to rename directories?

A

A: Yes, mv renames a directory by moving it to a new directory name.

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

Q: What command should you use if you want to copy a file or directory without deleting the source?

A

A: The cp (copy) command.

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

Q: What arguments does the cp command require?

A

A: At least two: the source file/directory and the target file/directory.

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

Q: How do you copy multiple files to a directory using cp?

A

A: List all source files as arguments followed by the target directory as the last argument.

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

Q: What is the difference between mv and cp when working with directories?

A

A: mv renames or moves a directory; cp creates a new copy of the directory and its contents.

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

Q: How do you copy a directory and all its contents in Linux using cp?

A

A: Use the -r (recursive) option with cp to copy directories and their subdirectories.

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