MODULE 8- Managing files and directories Flashcards

(48 cards)

1
Q

Which character standard does Linux use that is based on ASCII?

A

Linux uses the UTF-8 character standard, which is based on ASCII.

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

What man command can you use to learn more about ASCII in Linux?

A

man -s 7 ascii

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

What are glob characters in Linux commonly referred to as?

A

They are commonly referred to as wild cards.

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

Which glob character represents zero or more of any character in a filename?

A

The asterisk * character.

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

What pattern would match any file in /etc that starts with t?

A

/etc/t*

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

What pattern matches any file in /etc that ends with .d?

A

/etc/*.d

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

How are the * and ? characters different in globbing?

A
  • matches zero or more characters; ? matches exactly one character.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the pattern /etc/r*.conf match?

A

Files in /etc that begin with r and end with .conf.

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

Which glob character matches exactly one character in a filename?

A

The question mark ?.

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

What does the pattern /etc/t??????? match?

A

Files in /etc that start with t followed by exactly seven characters.

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

What does the glob pattern /etc/[gu]* match?

A

Any file in /etc that starts with g or u, followed by zero or more characters

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

What pattern matches any filename in /etc that begins with any letter from a to d?

A

/etc/[a-d]*

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

Which globbing symbol allows you to match one character from a specific set of characters?

A

The bracket characters [].

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

According to the ASCII table, what must be true about character ranges in brackets?

A

The range must be in ascending ASCII order (e.g., a-z, not z-a).

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

What does the pattern /etc/[!DP]* match?

A

Files in /etc that do not start with D or P.

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

Which glob character is used with brackets to exclude certain characters from matching?

A

The exclamation point ! inside []

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

What does the pattern /etc/[!a-t]* match?

A

Files in /etc that do not begin with any lowercase letter from a to t

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

What does the -i option do when used with the cp command?

A

It prompts the user before overwriting any existing files.

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

Which command moves a file named hosts to the Videos directory?

A

mv hosts Videos

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

What does the -v option do when used with mv?

A

It shows the result of the move or rename operation (verbose output).

3
Q

Which option combination prevents overwriting and avoids all interactive prompts while copying hidden files from /etc/skel/?

A

cp -n /etc/skel/.* ~

3
Q

Which cp option automatically refuses to overwrite files without prompting?

A

The -n option (no clobber).

4
Q

Which option allows the cp command to copy directories recursively?

A

The -r option

4
Q

Which command removes directories and their contents?

4
What does the command cp -r source_directory destination_directory do?
It copies the entire source directory, including its contents and structure, to the destination.
4
What is the general syntax for the mv command?
mv source destination
4
What determines whether mv renames a file or moves it to a different directory?
If the destination is a directory, it moves the file; if the destination is a filename, it renames the file.
4
Which command is used to rename files in Linux?
The mv command.
4
What does the command mv example.txt Videos/newexample.txt do?
It moves example.txt to the Videos directory and renames it to newexample.txt
4
Which option with mv prompts before overwriting an existing file?
-i (interactive)
4
Which command is used to delete files in Linux?
rm
4
Which mv option prevents overwriting an existing file without asking?
-n (no clobber)
4
Which command deletes a directory only if it is empty?
rmdir
4
What does the command rm -i *.txt do?
Prompts the user before deleting each file ending with .txt.
4
Does the mv command need a -r option to move directories?
No, it moves directories by default without needing -r.
4
Which command creates an empty file that can be filled with data later?
touch
4
Is there a trash or undo feature available after using the rm command?
No, files deleted with rm are permanently removed with no recovery option
4
Which rm option should be used along with -r to prompt for confirmation before deleting each file?
-i
4
Which copy option allows you to preserve file attributes?
-p
4
Which command is used to create a new directory?
mkdir
4
What is a safe approach when deleting directories with rm to avoid accidental deletion?
Use rm -ri to delete recursively and prompt for each file.
4
Which command will display file names that are at least six characters long and end in the letter s?
echo ?????*s
4
What Linux command can you use to view the ASCII character table?
ascii
4
Which cp option causes the command to print what it's doing for each file it copies?
The -v (verbose) option.
4
What is the general structure of the cp command?
cp source destination
4
Which command would correctly list only the directories matching /etc/ap*, without showing their contents?
ls -d /etc/ap*
4
Which command copies the /etc/hosts file into the user’s home directory?
cp /etc/hosts ~
4
How do you copy a file and give the new file a different name?
Specify the new name as part of the destination path (e.g., cp /etc/hosts ~/hosts.copy).