How to List All Services Ubuntu [4 Best Methods]

Written by

Reviewed by

Last updated: May 15, 2024

Expert verified

SVG Image

TL;DR

To list all services Ubuntu, you can try these methods:

  1. Systemctl Command: Use systemctl list-units --type=service in the terminal to display a detailed table of all services in Ubuntu, including their load status, active state, and description, with options to filter by state (active, inactive, or failed).
  2. Service Command: Enter service --status-all in the command window to list all Ubuntu services and their statuses, indicated by [ + ] for running and [ – ] for stopped, and use service service-name status to check the status of a specific service.

Continue reading the article below to learn different methods to list all services in Ubuntu and common errors with possible solutions.

Ever wondered what keeps a Linux system running smoothly in the background? Services, or daemons, are key players that manage everything from your system operations to application functions. In this post, you’ll learn about different types of services in Linux and how to list all services Ubuntu using simple commands. Whether you’re a system administrator or just curious, this article will show you practical ways to manage these services effectively. By the end, you’ll know exactly how to keep your system running efficiently using tools like systemctl and service.

What are Services in Linux?

In Linux, a service (often referred to as a daemon) is a program that runs in the background outside of the direct control of the user. Services are designed to offer various types of functionality that the system processes can utilize without requiring constant user interaction. Here’s a more detailed breakdown of what services are in the Linux environment:

Types of Linux Services

  • System Services: These are essential for the operation of the system itself, such as systemd, syslog, and network services.
  • Application Services: These include services provided by applications installed on the system, like web servers (Apache, Nginx), database servers (MySQL, PostgreSQL), and file sharing services (Samba, NFS).

Managing Services

Linux services are managed through service management systems, which allow for starting, stopping, and restarting these services, among other controls. The most common management systems include:

  • Systemd: The modern standard for newer distributions like Fedora, CentOS, and Ubuntu. It uses the systemctl command to manage services.
  • SysVinit: The traditional system used by older Linux distributions. It utilizes scripts located in /etc/init.d/ to manage services.
  • Upstart: An alternative to SysVinit, used by older versions of Ubuntu and other distributions. It was designed to handle the asynchronous starting of services.

How to List All Services Ubuntu?

To list all services in Ubuntu, you can use the systemctl command, which interacts with the systemd system and service manager. Simply open your terminal and type systemctl list-unit-files, then press Enter. This command will display a list of all service units installed on your system, showing their respective states, such as enabled, disabled, or masked. For a more focused list that shows only active services, you can enter systemctl --type=service --state=active. This approach provides a clear and concise view of all currently running services on your Ubuntu system.

Here is a detailed step-by-step guide to four different methods for Ubuntu list services:

1. Systemctl Command

The systemctl command is a powerful tool for managing services in Ubuntu. It provides a straightforward and efficient way to list services, their status, and other details. Follow these steps:

  1. Open a Terminal in Ubuntu.
opening terminal 22
  1. Type the following command to list services ubuntu:
systemctl list-units --type=service

This command will show the Ubuntu service list in a tabular format, including their status, unit name, and description.

    listing system services
    1. To filter services based on their status, you can use flags like –state=active, --state=inactive, or –state=failed.
    listing inactive system services

    When you run this command, you’ll see a table with several columns. Here’s what each column means:

    • UNIT: Shows the name of the service.
    • LOAD: Tells you if the system was able to load the service settings.
    • ACTIVE: Indicates the current state of the service (active, inactive, or failed).
    • SUB: Provides more details about the active state, like “running” or “exited.”
    • DESCRIPTION: Gives a brief description of what the service does.

    2. Service Command

    Another method to list services in Ubuntu is by using the service command. Although systemctl is preferred, the service command can still be useful in certain situations. It offers a simpler way to list services and their statuses in Ubuntu. Here’s how you can do it:

    1. Access the command window and type the following command:
    service --status-all

    This command provides a Ubuntu services list along with their status, denoted by [ + ] for running services and [ – ] for stopped services.

      listing all running and stopped services
      1. To list the details of a specific service, use the following command:
      service service-name status

      Replace service-name with the name of the service you want to check.

      viewing details of a specific service

      3. Init.d Directory

      The init.d directory contains script files responsible for managing services in Ubuntu. By examining this directory, you can list services and gain insights into their configuration. Follow these steps to Ubuntu show all services:

      1. Launch your Terminal window.
      2. Navigate to the init.d directory by typing the following command and use the ls command to list all the files in the directory.:
      cd /etc/init.d

      Each file in the init.d directory corresponds to a service. You can view the details of a particular service by opening its respective file.

        listing files containing details of services

        4. Using the ls System Directory

        Another method to list all services in Ubuntu is by exploring the /etc/systemd/system directory. This directory contains systemd service unit files that define and configure various services on your system. Here’s how you can use this method to show all service list Ubuntu:

        1. Open your command prompt and navigate to the systemd system directory by typing the following command:
        cd /etc/systemd/system
        1. Use the ls command to list all the service unit files in the directory.
        listing systemd service unit files

        Each service unit file represents a specific service. You can examine the contents of a particular unit file to gain insights into its configuration and dependencies. The files and directories listed are the systemd service unit files and related files in the /etc/systemd/system directory.

          Ubuntu List Running Services: How to Do It?

          1. ps Command

          The ps command is a quick utility to snapshot the current processes. It’s commonly used to get information about the processes running on your system. The command is flexible with several options that can display every process running on the system. Follow these steps to use this command:

          1. Open the Terminal.
          2. Type the following command into your Terminal and press Enter:
          ps aux
          • The a option tells ps to display processes from all users.
          • The u option provides detailed information about each process.
          • The x option includes processes not attached to a terminal.

          The command outputs a list of all running processes, showing details like user, PID, CPU and memory usage, start time, and the command that initiated each process.

          lisitng all running services using aux command

          2. top Command

          The top command is useful for a dynamic view of system processes. It provides a real-time overview of process activity and system resource usage. It’s especially handy for monitoring the system’s health and finding processes that are consuming excessive resources. Here is the step-by-step guide to use this command to list running services:

          1. Access your Terminal through your desktop environment.
          2. Run the top Command:
          top

          This command will display a live, updating list of all running processes.

          run top command to view details about processes
          1. The display includes real-time information on CPU, memory usage, process IDs, and more. You can press q to quit the top interface.
          viewing live details of processes

          Common Errors in Listing Services in Linux

          When working with Linux systems and managing services, it is not uncommon to encounter errors while attempting to list all services in Ubuntu. Understanding these common errors and knowing how to troubleshoot them is crucial for smooth system administration. Here are three common errors that users may face when listing services in Linux:

          🚫 Service Command Not Found: When attempting to list services using the service command, you may encounter the error “command not found.” This error typically occurs if the system you are using does not have the service command installed or if the command is not accessible due to incorrect user privileges.

          Ensure you are running the command as a privileged user and check if the service command is available on your system. If not, consider using alternative methods such as systemctl or exploring the init.d directory.

          Incomplete or Missing Service Information: Sometimes, when listing services, you may come across incomplete or missing service information. This can happen for various reasons, such as improperly configured service files, corrupted data, or system issues.

          When faced with this error, checking the service configuration files and verifying their integrity is advisable. Restarting the relevant services or rebooting the system may help resolve any temporary glitches causing incomplete or missing information.

          🔍 Incorrect Service Names or Syntax: Another common error is entering incorrect service names or using incorrect syntax when listing services. It is essential to ensure you accurately type the service name or use the correct command syntax.

          Check for any typographical errors, ensure proper capitalization, and follow the specific syntax requirements for the command or method you are using. Consulting the official documentation or relevant online resources can help you identify the correct service names and syntax for accurately listing services in Linux.

            Ubuntu List All Services: Final Insights

            This article has provided you with different methods to list all services in Ubuntu. In this comprehensive guide, you will also learn the common errors that can occur during the process.

            To further enhance your Ubuntu system administration skills, consider exploring topics such as service monitoring, optimization, and troubleshooting common service-related issues. Additionally, delve into advanced concepts like systemd units, service dependencies, and automating service management to deepen your understanding. By expanding your knowledge, you’ll be better equipped to optimize your system’s performance and ensure its smooth operation.

            Frequently Asked Questions

            How can I filter and list only active services?

            To list only active services in Linux, you can utilize the systemctl command with specific options. By executing the following command in the Terminal systemctl list-units --type=service --state=active, you can filter and display only the active services on your system. This command will provide a list of active services, including their status, unit name, and description. Filtering services based on their status enables you to focus on the running services and quickly identify the active components of your Linux system.

            Can I list services based on their dependencies?

            Absolutely! With the systemctl command, you have the ability to list services based on their dependencies. Using the --reverse flag, you can display services in reverse order, highlighting their dependencies. For example, running the command systemctl list-dependencies --reverse service-name, where service-name is the name of the service you want to check, will provide you with a hierarchical view of the services, starting from the specified service and following its dependencies.

            Is it possible to list services by their startup order?

            Certainly! To list services by their startup order in Linux, you can utilize the systemctl command with the --reverse flag. By running the following command systemctl list-units --type=service --all --reverse, you can obtain a list of services in reverse startup order. This means that services that start earlier during the boot process will appear toward the end of the list, while services starting later will be displayed towards the beginning.

            Ojash

            Author

            Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.

            Akshat

            Reviewer

            Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

            Share this article
            Shareable URL
            Prev Post

            4 Easy Methods to List Only Directories in Linux 

            Next Post

            How to Use the Linux Shutdown Command [9 Best Ways]

            Leave a Reply

            Your email address will not be published. Required fields are marked *

            Read next