Linux: Viewing and controlling processes

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which of the following is NOT a characteristic of a process, according to the provided information?

  • It can start another process.
  • It can only be created by another process.
  • It can be started from the GUI.
  • It can be directly terminated by any user. (correct)

Which command provides a real-time, dynamic view of running processes?

  • ps
  • bg
  • jobs
  • top (correct)

A process is in 'D' state. What does this indicate?

  • The process is waiting for I/O, such as disk drive access. (correct)
  • The process is running.
  • The process has been traced or stopped.
  • The process is sleeping.

A process is marked with a 'Z' state. Why?

<p>The process is a zombie process, terminated but not cleaned up by its parent. (D)</p>
Signup and view all the answers

In the ps command output, what does the '<' character indicate about a process?

<p>The process has high priority. (A)</p>
Signup and view all the answers

In the output of ps aux, what does the %CPU header represent?

<p>The process's CPU usage in percentage. (D)</p>
Signup and view all the answers

You want to run a command in the background. Which command should you use after initiating the process?

<p>bg (D)</p>
Signup and view all the answers

Which command lists only active jobs?

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

What does the START field in the top command output indicate?

<p>The time when the process started. (C)</p>
Signup and view all the answers

In the context of the top command, what does the 'ni' value under %Cpu(s) represent?

<p>The percentage of CPU time used by 'nice' (low priority) processes. (B)</p>
Signup and view all the answers

In networking, which device operates by broadcasting messages to all devices in the subnet?

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

Which networking device forwards messages based on MAC addresses within a subnetwork?

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

Which layer of the TCP/IP model is responsible for the fragmentation and reassembly of packets?

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

Which protocol is primarily used for transferring files that make up web pages?

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

Which protocol is used for remote terminal access to network hosts?

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

Which protocol resolves a hostname to an IP address?

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

What is the primary function of the ping command?

<p>To test network connectivity to a host. (A)</p>
Signup and view all the answers

Which command is used to display network connections, routing tables, and interface statistics?

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

What is the purpose of the traceroute command?

<p>To trace the route packets take to a network host. (D)</p>
Signup and view all the answers

Which command is used to download files from the internet in a non-interactive manner?

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

Flashcards

ps command

Reports a snapshot of current processes.

top command

Displays tasks.

jobs command

Lists active jobs.

bg command

Places a job in the background.

Signup and view all the flashcards

fg command

Places a job in the foreground.

Signup and view all the flashcards

Process State: R

Process is running.

Signup and view all the flashcards

Process State: S

Process is sleeping.

Signup and view all the flashcards

Process State: D

Process is waiting for I/O.

Signup and view all the flashcards

Process State: T

Process is traced or stopped.

Signup and view all the flashcards

Process State: Z

Defunct/Zombie process, terminated but not cleaned by parent.

Signup and view all the flashcards

Process Character: <

A high priority process.

Signup and view all the flashcards

Process Character: N

A low priority process.

Signup and view all the flashcards

Process Character: L

Pages locked into memory.

Signup and view all the flashcards

Process Character: S

A session leader.

Signup and view all the flashcards

Process Character: |

Multi-threaded.

Signup and view all the flashcards

Process Character: +

In the foreground process group.

Signup and view all the flashcards

Header: %CPU

CPU usage in percent.

Signup and view all the flashcards

Header:%MEM

Memory usage in percent.

Signup and view all the flashcards

Header: VSZ

Virtual Memory Size.

Signup and view all the flashcards

KlB Mem

Amount of RAM being used in kilobytes

Signup and view all the flashcards

Study Notes

  • A process can be started from the GUI or the command line.
  • A process can start another process.
  • A process can only be created by another process.

Commands for Viewing and Controlling Processes

  • ps reports a snapshot of current processes.
  • top displays tasks.
  • jobs lists active jobs.
  • bg places a job in the background.
  • fg places a job in the foreground.

Viewing Processes

  • The ps command shows: PID (Process ID), TTY (Teletypewriter, controlling terminal), TIME (cumulative CPU time), and CMD (command name).
  • Process states include: Running (R), Sleeping (S), Waiting for an event (S), Uninterruptible sleep (D), Waiting for I/O (D), Traced or stopped (T), and Defunct or zombie (Z).
  • A zombie process is a terminated child process not cleaned up by its parent.
  • Characters used with process states: < is high priority, N is low priority, L has pages locked into memory, S is for real-time and custom I/O, l is a session leader, + is in the foreground process group, and | is multi-threaded.
  • The ps command with the aux option shows: USER (owner's user ID), %CPU (CPU usage percentage), %MEM (memory usage percentage), and VSZ (Virtual Memory Size).
  • RSS (Resident Set Size) is the physical memory amount (in kilobytes) a process uses.
  • START is the process start time; a date is used for values over 24 hours.

The top Program

  • The top program displays real-time system information, including uptime, user count, load averages, task summaries, and CPU/memory usage.
  • Load average indicates processes waiting to run, with values for the last 1, 5, and 15 minutes.
  • The field descriptions from the top program include:
  • %Cpu(s): CPU usage statistics.
  • us: CPU time used by user processes.
  • sy: CPU time used by kernel processes.
  • ni: CPU time used by "nice" (low priority) processes.
  • id: CPU time idle.
  • wa: CPU time waiting for I/O.
  • hi: CPU time servicing hardware interrupts.
  • si: CPU time servicing software interrupts.
  • st: CPU time stolen by the hypervisor.
  • KiB Mem: RAM used in kilobytes.
  • KiB Swap: Swap space used in kilobytes.
  • PID: Process ID.
  • USER: Username of the process owner.
  • PR: Priority of the process.
  • NI: Niceness value.
  • VIRT: Total virtual memory used by the process.
  • RES: Resident size (non-swapped physical memory) in kilobytes.
  • SHR: Shared memory size in kilobytes.
  • S: Process status.
  • %CPU: CPU time percentage used since the last update.
  • %MEM: Memory percentage used since the last update.
  • TIME+: Cumulative CPU time used by the process and its children.
  • COMMAND: Process name or command used to start the process.
  • Interrupt a process with Ctrl + C.
  • Putting a process in the background: type top &.
  • Use the jobs command to see stopped jobs.
  • Return a process to the foreground: type fg %1.
  • Move a process to the background: type bg %1.

Networking

  • A computer network facilitates communication between resources through connected computers and computing resources.
  • To establish network access: have a network interface, run network services, and have access to a network-broadcast device.
  • A network interface connects to the network.
  • Network services include firewall, interface device, network authentication, and network file systems.
  • Network-broadcast devices:
  • A Hub broadcasts messages to all subnet devices.
  • A Switch broadcasts messages to a single subnetwork device using MAC addresses.
  • A Router directs messages to the appropriate network or subnetwork based on IP addresses.
  • A Gateway connects different local area networks.
  • TCP/IP has four layers: Network Interface, Internet, Transport, and Application.
  • The Network Interface Layer places/receives TCP/IP packets on/off the network medium.
  • The Internet Layer handles addressing, packaging, and routing with core protocols like IP, ARP, ICMP, and IGMP.
  • IP (Internet Protocol) does IP addressing, routing, fragmentation, and packet reassembly.
  • ARP (Address Resolution Protocol) resolves Internet layer addresses to the Network Interface layer (hardware) address.
  • ICMP (Internet Control Message Protocol) provides diagnostic functions and reports IP packet delivery errors.
  • IGMP (Internet Group Management Protocol) manages IP multicast groups.
  • The Transport Layer provides session and datagram communication services via TCP and UDP.
  • TCP (Transmission Control Protocol) establishes TCP connections, sequences packets, acknowledges sent packets, and recovers lost packets.
  • UDP (User Datagram Protocol) is used for small data transfers, avoiding TCP overhead, or when upper layers ensure reliable delivery.
  • The Application Layer allows applications to access services and defines protocols for data exchange.
  • Common Application Layer protocols: HTTP, FTP, SMTP, and Telnet.
  • HTTP (Hypertext Transfer Protocol) transfers web page files.
  • FTP (File Transfer Protocol) is for interactive file transfer.
  • SMTP (Simple Mail Transfer Protocol) transfers email messages and attachments.
  • Telnet is a terminal emulation protocol for remote host login.
  • Protocols facilitating TCP/IP network use and management include: DNS, RIP, and SNMP.
  • DNS (Domain Name System) resolves hostnames to IP addresses.
  • RIP (Routing Information Protocol) exchanges routing information between routers on IP internetworks.
  • SNMP (Simple Network Management Protocol) collects and exchanges network management information between a console and devices.

Networking Commands

  • ping sends ICMP ECHO_REQUEST packets to network hosts.
  • traceroute/tracepath prints the route taken by packets to a network host.
  • ip shows/manipulates routing, devices, policy routing, and tunnels.
  • netstat prints network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
  • ftp is an Internet file transfer program.
  • wget is a non-interactive network downloader.
  • ssh is an OpenSSH SSH client (remote login program).

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser