linux

How to disable a service in Linux

In the past it was easy, just remove the file from init.d directory … but that was then when all the Linux distros where SysV.

These days most of the systems are using systemd and is still easy. (I will post separately about sysv, upstart and systemd).

BTW, by “disable” I mean stop a service starting at boot time.

But how do you know your distro is systemd ? Easy run this in your console :

# stat /proc/1/exe
  File: /proc/1/exe -> /lib/systemd/systemd

So how do you do it in systemd ?

  • Typing simply : systemctl will print information for all services

to see the status of a specific service do this :

sudo systemctl status service-name

to start and stop a service :

sudo systemctl start service-name
sudo systemctl stop service-name

and finally to disable it :

sudo systemctl disable service-name

Linux tops

With this post I’m starting a series on general and sysadmin tools for Linux.

top

top is original process viewer/monitoring tool. Provides information about system resources.

As you can see from the screenshot below it provides :

  • PR : process priority
  • %CPU usage
  • %MEM : memory usage (RES)
  • SHR : shared
  • RES : resident memory
  • VIRT : virtual memory
  • TIME : Total CPU time the task has used since it started.
  • COMMAND

Also in the header it display summary information.

atop

The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network.

The big difference with top is that atop collects accounting info even for processes that have already finished, you can debug not only immediate resource usage for short and long lives processes.

htop

htop is similar to top but is more interactive. You can scroll, search, explore and kill processes if needed.