Linux Process Management: ps, top, kill Quiz Quiz

Explore essential Linux process management commands with this quiz focusing on ps, top, and kill. Assess your knowledge of process listing, monitoring, and termination techniques in Unix-like operating systems.

  1. Understanding ps output

    Which ps command option displays all currently running processes on the system along with detailed information such as user, PID, CPU, and memory usage?

    1. ps al
    2. ps aux
    3. ps -f
    4. ps ux

    Explanation: The 'ps aux' command lists all running processes on the system with comprehensive details, including information for all users. The 'ps ux' option omits processes from other users, limiting the output. 'ps -f' shows processes in a full-format listing but defaults to the current shell's processes only. 'ps al' provides a long format but displays limited or filtered process sets, not all processes.

  2. Monitoring with top

    In the top command interface, which key should you press to sort the displayed processes by memory usage instead of the default CPU usage?

    1. P
    2. N
    3. C
    4. M

    Explanation: Pressing 'M' in top sorts the processes by memory usage, helping users find processes consuming the most RAM. The 'C' key sorts by command line, while 'P' sorts by CPU usage, which is often the default. 'N' sorts processes by PID number. Remember, letter case matters in many Linux commands.

  3. Sending signals with kill

    To terminate a process immediately using its PID 1234, which command would you use to send the SIGKILL signal?

    1. kill -15 1234
    2. kill -l 1234
    3. kill -9 1234
    4. killall 1234

    Explanation: 'kill -9 1234' sends the SIGKILL signal, which forcefully stops the specified process. 'killall 1234' looks for processes named '1234', not the PID. 'kill -15 1234' sends a gentle SIGTERM, not an immediate forceful termination. 'kill -l 1234' lists signal names and numbers, not kill the process.

  4. Understanding process statuses

    After running ps aux, you notice a process with a status of 'Z'. What does this status indicate about the process?

    1. The process is in a stopped state
    2. The process is currently sleeping
    3. The process is a zombie process
    4. The process is running normally

    Explanation: A 'Z' in the process status column indicates a zombie process, which means the process has completed execution but still has an entry in the process table. A sleeping process would have an 'S' status, while a stopped process would be marked as 'T'. A running process is shown with an 'R' status.

  5. Using killall for process control

    Which command will terminate all processes named 'firefox' for all users on the system?

    1. top -kill firefox
    2. killall firefox
    3. kill firefox
    4. ps -kill firefox

    Explanation: 'killall firefox' sends the default termination signal to all processes named 'firefox', regardless of user. 'kill firefox' is incorrect because kill expects a PID, not a process name. 'ps -kill firefox' is not a valid option; ps is for process listing, not termination. 'top -kill firefox' is not a real command structure in Linux.