CIS 132 Linux 1, Chapter 3 Review Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A user typed the command pwd and saw the output: /home/jim/sales/pending. How could that user navigate to the /home/jim directory?

cd ../.. The command pwd shows that the user is currently in /home/jim/sales/pending. To move to /home/jim, the user needs to go up two levels in the directory structure:cd .. moves one level up (to /home/jim/sales).cd ../.. moves two levels up (to /home/jim).

If "resume" is the name of a file in the home directory off the root of the filesystem and your present working directory is home, what is the relative name for the file named resume?

resume: A relative pathname is based on the current working directory. Since your present working directory is home, you can refer to the file simply as resume instead of using the full path. The other options include absolute paths (e.g., /home/resume), which are not relative.

What will typing q! at the : prompt in command mode do when using the vi editor?

Quit as no changes were made: In vi editor, q! is used in command mode to quit without saving any changes. The q command alone (:q) quits but only if no changes were made. The ! (exclamation mark) forces the quit, even if changes were made, without saving.

Linux has only one root directory per directory tree.

True: In Linux, there is only one root directory (/) per directory tree. The root directory is the topmost directory in the filesystem hierarchy, and all other directories and files branch from it. Even though Linux supports multiple storage devices (like different hard drives or partitions), they are mounted into the single directory tree under /, rather than having separate root directories like in Windows (e.g., C:\, D:\).

The tac command _____.

displays the contents of a file in reverse order, last line first and first line last: The tac command in Linux is the reverse of the cat command. It displays the contents of a file starting from the last line and ending with the first line, preserving the order of words within each line.

What will the following wildcard expression return: file[a-c]?

filea, fileb, filec: The wildcard expression [a-c] matches any single character in the range a to c. This means it will match filea, fileb, and filec if they exist in the directory. It will not match fileabc because [a-c] represents only one character, not a sequence.

The vi editor can function in which two of the following modes? (Choose both that apply.)

Command (used for navigating, editing, and executing commands./Insert (Used for typing and modifying text.)

After typing the ls -F command, you notice a filename that ends with an * (asterisk) character. What does this mean?

It is an executable file: When you run the ls -F command in Linux and see a filename ending with an asterisk (*), it means the file is an executable (a script or program).

Using a regular expression, how can you indicate a character that is not an a or b or c or d?

[^abcd] :In regular expressions, [^...] is used to negate a character class, meaning it will match any character except those listed inside the brackets. [^abcd] means any character that is NOT 'a', 'b', 'c', or 'd'.

A user types the command head /poems/mary. What will be displayed on the terminal screen?

head: The head command, by default, displays the first 10 lines of a file. Since the user specified /poems/mary, it will attempt to show the first 10 lines of the file mary located in the /poems/ directory.

The less command offers less functionality than the more command.

False: less allows both forward and backward navigation, while more only allows forward navigation. less lets you search for text within the file using /search_term. less does not load the entire file into memory at once, making it faster and more efficient for large files.

After typing the ls -a command, you notice a file whose filename begins with a period ( . ). What does this mean?

It is a hidden file: In Linux and Unix-based systems, files and directories that begin with a period (.) are hidden files. These files do not appear in the normal ls listing but can be viewed using the ls -a command, which shows all files, including hidden ones.

How can you specify a text pattern that must be at the beginning of a line of text using a regular expression?

Precede the string with a ^. :In regular expressions, the caret symbol (^) is used to match a pattern at the beginning of a line. For example: ^Hello will match lines that start with "Hello". ^# will match lines that start with a # (often used for comments in scripts).

How can a user switch from insert mode to command mode when using the vi editor?

Press the Esc key.

Which command searches for and displays any text contents of a binary file?

Strings


Ensembles d'études connexes

Chapter 22 Nursing Care of the Child With an Alteration in Mobility/Neuromuscular or Musculoskeletal Disorder

View Set

Peds - Chapter 25: Nursing Care of the Child With a Hematologic Disorder SCA

View Set

Levantamientos Especiales Topografía Subterranea

View Set

unit 3 networks and the internet:

View Set

BLY-213 Microbiology Chapter 5 assignment

View Set

Chapter 14 Practice Quizzes: BA 370

View Set