Linux Commands and Process Management
24 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the command used to print the content of a file?

  • echo
  • printf()
  • print
  • console.log()
  • cat (correct)
  • The top command is used to manage and view process information in Linux.

    True (A)

    What does the ps -ef command do?

    The ps -ef command lists all processes on the system, with extended information and full process IDs.

    The pipeline mechanism allows for the __________ of output from one command to the input of another command.

    <p>cooperation</p> Signup and view all the answers

    Match the command with its corresponding function:

    <p><code>cat</code> = Execute an interactive process viewer <code>top</code> = Display the content of a file <code>ps -ef</code> = List all processes with extended information <code>echo</code> = Print text to the terminal</p> Signup and view all the answers

    Which command is NOT used to manage or view processes in Linux?

    <p>cat (C)</p> Signup and view all the answers

    Pipelines in Linux allow for parallel execution of commands.

    <p>False (B)</p> Signup and view all the answers

    What is the purpose of using | in a command line?

    <p>The <code>|</code> symbol creates a pipeline, connecting the output of the previous command to the input of the next command.</p> Signup and view all the answers

    The command ______ is used to display the manual page of a command.

    <p>man</p> Signup and view all the answers

    Which of the following commands is used to create a new file?

    <p>touch (B)</p> Signup and view all the answers

    The & symbol at the end of a command runs the program in the foreground.

    <p>False (B)</p> Signup and view all the answers

    What is the command to display all running processes for the user "john"?

    <p>ps -u john</p> Signup and view all the answers

    Match the regular expression patterns with their descriptions:

    <p>^ = Start of line $ = End of line</p> <ul> <li>= Zero or more occurrences [] = Any character in brackets [^] = Any character not in brackets</li> </ul> Signup and view all the answers

    Environmental variables are limited to the shell or script where they are defined.

    <p>False (B)</p> Signup and view all the answers

    The file cache helps improve performance by reducing the number of ______ operations.

    <p>disk I/O</p> Signup and view all the answers

    How can you bring a background process to the foreground?

    <p>fg</p> Signup and view all the answers

    Which of the following is considered an internal financial resource?

    <p>Retained earnings (A), Accrued liabilities (C)</p> Signup and view all the answers

    Pricing strategies can include achieving cooperative relationships with competitors.

    <p>True (A)</p> Signup and view all the answers

    What command is used to navigate to the 'data' subdirectory in Unix?

    <p>cd data</p> Signup and view all the answers

    To remove a directory in Unix that is not empty, you would use the command '______'.

    <p>rm -r old_logs</p> Signup and view all the answers

    Match the command with its function in Unix:

    <p>cd = Change directory ls -l = List directory contents rm -r = Remove directory and contents cat = Display file contents</p> Signup and view all the answers

    Which of the following objectives of pricing strategy is considered inappropriate or unreasonable?

    <p>Achieving cooperative relationship with competitors (A)</p> Signup and view all the answers

    Accrued liabilities are classified as an internal financial resource.

    <p>True (A)</p> Signup and view all the answers

    What is the command to list the contents of a directory in Unix?

    <p>ls</p> Signup and view all the answers

    Flashcards

    Background Process Command

    Run a program in the background using ./program &

    Foreground Process Command

    Bring a background program to the foreground with fg

    Regular Expression - Start

    ^ represents the start of a line in regex patterns

    Regular Expression - End

    $ symbolizes the end of a line in regex patterns

    Signup and view all the flashcards

    File Cache

    A storage for recently accessed data to improve performance

    Signup and view all the flashcards

    Environmental Variable

    A variable accessible to child processes, set using export NAME=value

    Signup and view all the flashcards

    Local Variable

    A variable limited to the shell or script where defined

    Signup and view all the flashcards

    Command to List Files with m or c

    Use ls [mc] to list files containing 'm' or 'c'

    Signup and view all the flashcards

    Unfair Pricing

    Pricing that is generally prohibited by law, often based on discriminatory practices.

    Signup and view all the flashcards

    Internal Financial Resources

    Sources of capital within a company, including retained earnings and sale of shares.

    Signup and view all the flashcards

    Pricing Strategy Objectives

    Goals for setting prices, such as enhancing brand image or expanding market share.

    Signup and view all the flashcards

    Retained Earnings

    Profits that a company retains for reinvestment rather than distributing as dividends.

    Signup and view all the flashcards

    Sale of Shares

    The process of selling ownership stakes in a company to raise funds.

    Signup and view all the flashcards

    Accrued Liabilities

    Expenses recognized on the balance sheet before actual cash payment.

    Signup and view all the flashcards

    Command to Change Directory

    The command 'cd' is used to navigate to a different folder in Unix.

    Signup and view all the flashcards

    Remove Directory Command

    The command 'rm -r' deletes a directory and its contents in Unix.

    Signup and view all the flashcards

    cat command

    A command in Unix/Linux to display the contents of a file.

    Signup and view all the flashcards

    touch command

    A command in Unix/Linux to create an empty file or update the timestamp of an existing file.

    Signup and view all the flashcards

    top command

    An interactive system-monitor that shows a list of processes running on the system.

    Signup and view all the flashcards

    pipeline

    A method to connect the output of one program to the input of another in a sequence.

    Signup and view all the flashcards

    process-viewer

    A tool that allows users to see the running processes on the system.

    Signup and view all the flashcards

    ps command

    A command used to display current active processes.

    Signup and view all the flashcards

    serialization in processes

    A method where one program starts only after the previous one has finished.

    Signup and view all the flashcards

    cooperation in processes

    A method where the output of one program feeds into the input of another.

    Signup and view all the flashcards

    Study Notes

    Question 38: UNIX commands

    • pwd is used to print the current directory path.
    • cd is used to change the current directory .
    • touch is used to create a file, if it doesn't exist.

    Question 39: UNIX commands

    • grep is used for text pattern matching.
    • chmod is used for changing access permissions related to files or folders.

    Question 40: UNIX commands

    • man command gives documentation describing the functions of a command.
    • grep searches the content of files.

    Question 41: UNIX commands

    • echo displays output to a terminal.
    • export is a command that declares an environment variable.

    Question 42: UNIX commands

    • true will be printed if the command was successful. false will be printed if the command was not successful

    Question 43: UNIX commands

    • chmod is used to set file permissions for files and directories.

    Question 44: UNIX commands

    • touch is used to create files.
    • /bin located in the directory hierarchy.
    • man gives documentation describing functions related to commands.

    Question 45: UNIX commands

    • echo $PATH returns the value of the PATH variable.
    • mkdir is used to create folders
    • touch is used to create files .

    Question 46: UNIX commands

    • ls list all of the contents of a folder or directory .
    • grep searches for a pattern (i.e. a sequence of characters etc) in a file or file contents.
    • wc is used to count lines, words, and characters in a file or on the standard input

    Question 47: UNIX commands

    • touch this is used to create a file.

    Question 48: UNIX commands

    • rm --directory (or just rm -r) deletes a folder, if it is empty.
    • rm removes a file.
    • ls -l to view detailed information about files and directories.

    Question 49: UNIX commands

    • prog1 2>&1 > log redirects the standard output and error output of program prog1 to a log file

    Question 50: UNIX commands

    • grep is used to search for strings (patterns) in files.
    • grep ^\d data.txt will print all lines from data.txt that begin with a digit

    Question 51: UNIX commands

    • ls -l details each entry in a directory.
    • -l lists all of the details of the folders

    Question 52: UNIX commands

    • cat x | grep is used to display lines that contain a specific pattern in a file.
    • $HISTSIZE returns the number of lines that the shell stores in its history.

    Question 53: Mounting file systems

    Mounting a file system makes it accessible to the system. /etc/fstab  contains information about disk partitions and ways users interact with them.

    Question 54: Fork() process count

    • fork() creates child processes in Unix.

    Question 55: File content analysis

    • rm removes files.
    • [a-z] signifies lowercase characters.
    • [[:lower:]] is a special meta-character that matches any lowercase letters.

    Question 56: Grep command usage

    • grep retrieves lines that contain certain patterns.

    Question 57: User and Group IDs

    • UID and GID identify users and groups.
    • Effective UID and GID override the original UID/GID to represent a process.

    Question 58: Unix commands for file information:

    • ls displays the list of files and folders in a directory.

    Question 59: Shell Commands used for file operations;

    • echo outputs a string/line to the standard output stream.

    Question 60: Process scheduling priority

    • The OS scheduler decides the order of execution and selects which process gets resource utilization according to assigned priority. Processes with a higher priority execute first with lower priority for later execution.

    Question 61: Fork system call

    • The fork() system call duplicates the process and produces its child in Unix.
    • A hard link is a directory entry that references an existing file or folder and is only available in the local file system.
    • Soft link is a symbolic reference to a file and can point to the same file system or different file systems.

    Question 63: HISTSIZE variable

    • HISTSIZE determines how many lines of history the shell keeps track of and how many lines of history to save.

    Question 64: chmod commands use for setting permission

    • The chmod command alters permissions associated with files/directories.

    Question 65: Number of blocked processes

    • The fork() system call effectively duplicates a process.
    • The pause() instruction in the code suspends the process.

    Question 66: UNIX File content analysis

    • grep prints lines which match specified patterns.
    • [[:lower:]] represents lowercase letters a..z.

    Question 67: UNIX commands

    • grep extracts lines containing a matching string.
    • wc counts words, lines, and characters..

    Question 68: UNIX commands

    • ls returns information related to a directory or file.
    • ls -llists file or directory details, including permissions.
    • grep finds patterns (sequences of characters) in file contents.

    Question 69: UNIX scripting

    • Shell scripting is a method of programming using commands and is not translated but interpreted.

    Question 70: UNIX commands (user, groups, permissions)

    • chmod modifies file permissions
    • the ls -l command lists detailed information about files and directories that exist in the same location

    Question 71: UNIX commands (file/directoriy manipulations)

    • grep extracts lines matching criteria.
    • head and tail display the first and last portions of a file, respectively.
    • cat displays the entire content of a file in the terminal.

    Question 72: UNIX commands (variables)

    • The command echo $HOME displays the HOME variable, in Unix.
    • The commandecho $? accesses special value that contains the exit status of the last process( 0=successful)

    Question 73: File permissions and their types

    • Individual Owner (user): Access rights (r, w, x) , specifically related to the user who created the file or the directory.
    • Group Owner: Access rights are related to a group, to which the user belongs (r, w, x).
    • Other: Access rights for users not explicitly assigned (r, w, x) in the context of the specific file or directory.

    Question 74: Processes and states

    • fork makes a copy of a process.
    • pause suspends the process temporarily.
    • Processes with pause() calls are considered "blocked" until the pause call is released.

    Question 75: I-node function and information

    • i-node identifies the file's metadata, like type, access permissions, and owner information.

    Question 76: Escape characters in shells and their purpose

    • \(backslash) is used to deactivate special meaning of the following character.

    Question 77: Pipes and command execution

    • Pipes create an output stream that is directed to an input stream from another command.
    • Using pipes can achieve a complex output from a chain of commands.

    Question 78: Process table information

    • Process ID (PID)
    • Process state (e.g., running, blocked)
    • Associated signals.
    • I-node is a structure that stores the metadata information about a file-system or directory files in Unix or Linux.
    • Files metadata (information) about file type, permissions, ownership (owner and group), timestamps (time of last modification etc).

    Question 80: File Path and File Name

    • File path provides locations of the file in the file system.
    • File name is a sequence of characters that identify a specific file.

    Question 81: Unix Operating System commands

    • kill terminates a process based on its process ID (PID).

    Question 82: Unix Operating System questions

    • Processes with higher priority execute first on Unix operating systems.
    • Processes execute according to a scheduling algorithm that chooses next executable process.

    Question 83: Correctly assign Unix commands and functionality

    • mv is a command that renames and/or moves files/directories.

    Question 84: Filtering files containing certain characters or numbers by using Unix utilities

    • ls is a command used to list the names of files and directories in a specific location on a file system
    • /bin in the directory hierarchy is used to list out files with matching patterns (character/number), which may be used with grep.

    Question 85: Command for finding processes

    • ps -e lists all the currently running processes.
    • Combining this with grep for the "sshd" process identifies the running sshd processes.
    • Combining ps (shows process info) with grep (finds a pattern) will retrieve the specific process(es) based on your search criteria.

    Question 86: Obtaining PID or process identification number;

    • ps (shows current processes) and grep (search for process name) are two commands you can use together to get the PID of a specific process. This allows to retrieve the PID of a process running on a system, given the name.

    Question 87: Correctly assign Unix commands

    • ps – list currently running processes .
    • grep – filters the content of a file using specific patterns/search conditions.

    Question 88: UNIX commands for file operations (printing output)

    • The cat command displays the content for a file (or another input) in the terminal.

    Question 89: Pipeline operations

    • Output from one command is piped (connected) to input for a second command.

    Question 90: C program (compiling)

    • Using a compiler (like cc or gcc) translates a source code program into an executable file.

    Question 91: UNIX commands for file and directory manipulation

    • ls lists files and directories within a specific directory or on a path.
    • grep is used to search for specific patterns within file contents.
    • awk filters for specific column locations

    Question 92: UNIX processes

    • ps displays the PID (Process ID) of running processes.
    • grep is used for searching and matching strings within files.

    Question 93: UNIX shell scripting command usage

    • grep identifies and extracts lines containing a specific pattern/criteria from a file.
    • ps list processes and other identifying criteria (often in conjunction with grep.)

    Question 94: UNIX commands-file manipulations

    • grep is used to search for files/patterns within the data in a file, such as to find out which lines (in the contents) start with a digit.
    • wc is used to count the number of lines or words in a file.

    Question 95: How to use ls -l

    • ls -l displays file/directory details (attributes), including permissions (read, write, execute), file owner, group owner, number of hardlinks or symbolic links..

    Question 96: UNIX commands

    • head command will retrieve the first N lines of a file.
    • The tail command will retrieve the last N lines of a file.

    Question 97: Using environment variables in bash scripts

    • A shell variable is a user defined name that holds/contains information, making it easy to use in a bash (or other similar shell) script or command line.

    Question 98: UNIX scripting

    • Bash (or other similar shell) scripting is a method of programming using commands.

    Question 99: Identifying processes

    • Using ps (process status) command in combination with other elements such as grep for specific strings.

    Question 100: Compiling C programs and handling execution permissions

    • "Compiled programs" are pre-processed, translated and otherwise amended/formatted by an interpreter (such as a C compiler) to become an executable file.
    • The chmod command is employed to modify directory entries (permissions), to specify access control.

    Question 101: Signals and termination from running processes

    • CTRL+C sends a SIGINT signal, which terminates most programs.
    • kill is used to send any signal to a process of your choice.

    Question 102: Script execution and background processes

    • ./your_script_name & executes the script and continues to run the command-line.

    Question 103: Signals, I/O, etc.

    • Signals are used for sending asynchronous notifications.
    • Signals are used to communicate asynchronous events in UNIX/LINUX.
    • I/O refers to Input/Output.
    • The 'kill' command, with a given PID, terminates a running process.

    Question 104: Blocked processes count after executing code

    • fork creates multiple processes, some will be "blocked."
    • A pause instruction in the code suspends the process temporarily..

    Question 105: File path, file names, & data displays

    • Commands like ls/grep help locate/show file names & paths.

    Question 106: Process states and their interconnections

    • The processes are in states such as 'running', 'ready', or 'blocked'.

    Question 107: Script process counting

    • The script generates child processes using fork.
    • The pause directive pauses the child processes.

    Question 108: Shell variables

    • Local variables are specific to the current shell instance. They do not affect other processes or programs.
    • Environment variables affect all processes running in the same operating system.

    Question 109: Unix System Call/functions

    • Executing a program/command using /bin/bash or ./ will execute the script. A program/script is a type of file containing one or more shell commands.
    • fork() creates new processes.
    • pause() delays process execution.

    Question 110: File and directory manipulation and permissions

    • Using rm with specifying search parameters will remove specific files or directories, such as removing all files that begin with a specific series of characters/numbers within a given directory.
    • Modifying permission and/or ownership of files or directories occurs by the use of the chmod command.

    Question 111: Finding processes based on user or group ownership

    • A command like ps used with optional parameters (such as -u <user_name>) can output a list that identifies processes started by a user.

    Question 112: UNIX shell and internal/external commands

    • Internal commands (e.g., cdpwd, echo) are part of the shell itself.
    • External commands (e.g., ls, grep, wc) are separate executable programs that the shell runs as requested

    Question 113: UNIX signal details

    • Signals are immediate notifications sent to processes, which trigger functions or other actions when received.

    Question 114: Fork and pause operations; process counts

    • The fork() system call creates a copy of a process.
    • pause() suspends the process temporarily. The number of active or blocked processes is dependent on the specific running process, instruction, and/or parameters..

    Question 115: UNIX file actions (removal)

    • using rm with matching patterns will delete files whose names adhere to those patterns on the command line.

    Question 116: Shell and regular expressions

    • Standard output display of a file from a grep command will print lines that contain specified criteria.

    Question 117: Process state listing

    • Using ps -aux lists (many details on) processes.
    • Combining ps with grep searches processes relevant to the user or the criteria.

    Question 118: Running a C program and handling output

    • Compiling the C program will convert the source code into an executable file
    • Running the executable will execute the compiled code.

    Question 119: Summary of OS function for Unix/Linux

    • Manage and control hardware and software resources on the OS.
    • Schedules processes (executing/managing tasks) and directs resource utilization (this differs depending on the system architecture)

    Question 120: Shell scripting

    • It's important that the first line of a shell script begins with #!/bin/bash.

    Question 121: Executing a C program and counting the output lines

    1. Counting and displaying the lines from a given file.
    2. Using a pipe connected to other commands for more complex operations.

    Question 122: Creating and modifying file/directory permissions in UNIX (file operations)

    • In Unix, commands like chmod adjust access permissions (read, write, execute) for files.
    • File permissions dictate how various users can interact with a particular file using rwx and numbers.

    Question 123: Shell variable types and usage

    • Locating and displaying variables from shell prompts by using the echo command in combination with the variable name.

    Question 124: UNIX file manipulation commands

    • The question asks for extracting output lines (grep) containing patterns (using delimiters/characters) from a given file.

    Question 125: C program, execution output, and process count

    • fork() instruction duplicates a process in a C-code program, creating an additional instance of a process.
    • pause() instructs (waits) a process to temporarily halt until a signal or another external action occurs.

    Question 126: Retrieving file size

    • Using the ls -l command, to identify or acquire (extract relevant details) of a specified (particular) file.

    Question 127: Directory and script creation

    • Creating a directory and file
    • Modifying the permissions using chmod.
    • A symbolic link (symlink) is a special kind of file that references a file or directory from a different location.

    Question 129: Running a scripting program in the background

    • Use& to execute the script in the background. Execute the command and then view the current process IDs (PIDs). This gives the running PID.

    Question 130: Terminating a running process

    • The process ID (PID) identifies which process needs to be terminated.

    Question 131: Shell history

    • The history command outputs a listing (or log) of previously inputted commands in shell scripting.

    Question 132: I-node description and its functionality for Linux or Unix-like systems

    • An i-node is a table (index) in a file system that contains metadata/data about files.

    Question 133: Process states and their transitions

    • The state of a process can transition due to various factors/events, such as process completion or system resources being limited.

    Question 134: Regular expressions

    • Regular expressions can match patterns or strings inside text files.

    Question 135: File permissions ( s bit)

    • The 's-bit' changes a process's effective user ID
    • The S-bits help to identify file/user/group permissions.

    Question 136: Processes in UNIX systems (how a process is started/copied using fork/pause)

    • fork() call copies an existing process into a new process in Unix/Linux.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Unix Test Prep 1 PDF

    Description

    Test your knowledge on essential Linux commands and process management techniques. This quiz covers commands for viewing processes, using pipelines, and manipulating files in the Linux environment. Challenge yourself to match commands with their functions and understand how to effectively manage processes.

    Use Quizgecko on...
    Browser
    Browser