Process Management Essentials with CLI Commands Quiz

This quiz explores key aspects of process management in CLI environments, focusing on commands and concepts crucial for controlling and monitoring system processes. Gain insight into managing running tasks, terminating processes, and viewing process details using practical command-line tools.

  1. Identifying Process IDs

    Which CLI command is commonly used to display the process IDs (PIDs) of all currently running processes on a Unix-like system?

    1. ps
    2. pwd
    3. prt
    4. psc

    Explanation: The 'ps' command is widely used on Unix-like systems to display information about active processes, including their process IDs. 'pwd' shows the current directory path, not processes. 'prt' is not a recognized standard command for this purpose. 'psc' is also not a valid or conventional process management command. Using 'ps', users can effectively list and identify processes by their PIDs.

  2. Terminating Processes Safely

    If you want to gently request a process with PID 2022 to terminate, which CLI command and signal would you use?

    1. kill -15 2022
    2. killall 2022
    3. stop 2022
    4. kill -9 2022

    Explanation: 'kill -15' sends a SIGTERM signal, requesting the process to terminate gracefully, which allows it to clean up before exiting. 'killall 2022' is incorrect since 'killall' targets process names, not PIDs. 'stop' is not a standard command for terminating processes. 'kill -9' issues a SIGKILL, which forcefully terminates a process without cleanup and should be used as a last resort.

  3. Monitoring Real-Time Process Activity

    Which command provides a dynamic, real-time overview of system processes, including CPU and memory usage, regularly updating the display?

    1. top
    2. ls
    3. tree
    4. seek

    Explanation: 'top' is designed to display and update information about system processes in real time, showing CPU, memory usage, and process details. 'ls' lists directory contents, not processes. 'tree' displays the directory structure graphically, unrelated to process management. 'seek' is not a standard command for process monitoring. Hence, 'top' is the correct choice for dynamic process overview.

  4. Running a Command in the Background

    What symbol is added at the end of a CLI command to execute it in the background, allowing continued use of the terminal?

    1. &
    2. #
    3. %
    4. *

    Explanation: Adding an ampersand '&' at the end of a command runs it in the background, freeing up the terminal for other tasks. The hash '#' indicates a comment, not background execution. The percent '%' and asterisk '*' symbols do not execute commands in the background. Only '&' achieves the intended effect in most shell environments.

  5. Viewing a Tree of Running Processes

    Which command is used in many Unix-like environments to display running processes in a hierarchical, tree-like structure?

    1. pstree
    2. pqueue
    3. psbranch
    4. pview

    Explanation: 'pstree' presents the active processes as a tree, displaying parent-child relationships clearly. 'pqueue' is a misleading term and not a standard process visualization command. 'psbranch' and 'pview' are also not standard commands for process trees. Therefore, 'pstree' is the correct option for viewing processes in a hierarchical layout.