Command Management Process and Thread in UBUNTU

talim

ta-lim

Posted on March 17, 2023

Command Management Process and Thread in UBUNTU

Managing service

service <service_name> <action>

Example:
service sshd status
Enter fullscreen mode Exit fullscreen mode

Image description

service sshd start
Enter fullscreen mode Exit fullscreen mode

Image description

service sshd stop
Enter fullscreen mode Exit fullscreen mode

Image description

Where is the name of the system service you want to manage, and is the action you want to perform on the service (such as start, stop, restart, enable, or disable).

In addition to the basic syntax, the service command also supports several attributes or options that can be used to customize its behavior. Some of the most commonly used attributes include:

  • status-all: This attribute displays the status of all system services, whether they are currently running or not.
  • reload: This attribute reloads the configuration file for a service without actually stopping and restarting the service.
  • full-restart: This attribute performs a full restart of a service, which involves stopping and then starting the service again.
  • list: This attribute lists all available system services that can be managed with the service command.

Running Init

/etc/init.d/[servie] [command]
the /etc/init.d command in Linux is a directory containing scripts used to start, stop, and restart system services on the system. These scripts can be run directly using specific arguments, or using the service command, which provides a simpler interface for managing system services.

Example:
/etc/init.d/ssh start
/etc/init.d/ssh stop
/etc/init.d/ssh restart
/etc/init.d/ssh status
Enter fullscreen mode Exit fullscreen mode

Image description

Top

top
The purpose of the top command is to provide an easy-to-use interface for monitoring and managing running processes on a Linux system. It can be used to identify resource-intensive processes, find out which processes are consuming the most system resources, and terminate or suspend processes as needed.

Image description

description of each column in the table output:

  • PID: The process ID of the task.
  • USER: The user who started the process.
  • PR: The priority of the process.
  • NI: The "nice" value of the process, which determines its priority in the scheduling queue.
  • VIRT: The total amount of virtual memory used by the process.
  • RES: The amount of physical memory used by the process.
  • SHR: The amount of shared memory used by the process.
  • S: The process state. It can be R (running), S (sleeping), D (disk sleep), Z (zombie), or T (stopped).
  • %CPU: The percentage of CPU time used by the process since the last update.
  • %MEM: The percentage of physical memory used by the process.
  • TIME+: The total CPU time used by the process since it started.
  • COMMAND: The command that started the process.

Some of the key attributes of the top command include:

  1. Process List: The main display of the top command is a list of all the processes running on the system, along with detailed information about each process, such as the process ID (PID), user, CPU usage, memory usage, and more.

  2. Resource Consumption: The top command provides real-time information about the system's resource usage, including CPU usage, memory usage, and system uptime. This information is displayed both as overall statistics for the entire system and as individual statistics for each process.

  3. Sorting Options: The top command allows users to sort the process list based on a variety of criteria, such as CPU usage, memory usage, process ID, and more. This makes it easy to identify resource-intensive processes and take action as needed.

  4. Interactive Features: The top command is an interactive tool that allows users to manipulate the process list in real-time. For example, users can suspend or resume processes, change the priority of running processes, and more.

💖 💪 🙅 🚩
talim
ta-lim

Posted on March 17, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related