Skip to content

How to Check Execution Time of a Process in Linux?

Updated 1 min read

Updated: 28 September 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9

These tools measure how long a command or process runs. They work on Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.

time: measure a command

time tar czf backup.tar.gz /var/www
  • real: wall-clock time from start to end.
  • user: CPU time spent in the program.
  • sys: CPU time spent in the kernel for the program.

If real is much larger than user + sys, the program was waiting (for disk, network or locks).

/usr/bin/time -v: more details

dnf install time    # or: apt install time
/usr/bin/time -v php script.php

Shows the maximum memory used, page faults, context switches and the exit status as well.

How long has a process been running?

ps -o pid,etime,cmd -p 1234        # elapsed time as [[dd-]hh:]mm:ss
ps -eo pid,etimes,cmd --sort=-etimes | head   # longest-running processes (seconds)

Boot and service start times

systemd-analyze                  # total boot time
systemd-analyze blame | head     # slowest services

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket