The times
command is a Linux utility that displays the cumulative system and user time of a process and its children. It is used to measure the amount of time a process took to execute.
Overview
The times
command is used to display the following information:
- User time: The amount of CPU time spent in user mode.
- System time: The amount of CPU time spent in kernel mode.
- Children user time: The amount of CPU time spent in user mode by all child processes.
- Children system time: The amount of CPU time spent in kernel mode by all child processes.
To use the times
command, simply type times
in the terminal and press Enter. The output will display the CPU time used by the current shell and its children. Here’s an example output:
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 624maxresident)k
0inputs+0outputs (0major+63minor)pagefaults 0swaps
The output is divided into several columns:
- User time: The amount of CPU time spent in user mode.
- System time: The amount of CPU time spent in kernel mode.
- Elapsed time: The amount of real time that has passed since the process started.
- CPU usage: The percentage of CPU time used by the process.
- Memory usage: The amount of memory used by the process.
- Page faults: The number of page faults that occurred during the process.
- Swaps: The number of times the process was swapped out of memory.
Options
The times
command does not have any options.
Troubleshooting tips
If you’re not seeing any output from the times
command, it’s possible that the process has already completed. This command only displays the CPU time used by a process while it’s running.
Notes
- The
times
command is a built-in command in most Linux shells, including Bash, Zsh, and Ksh. - The
times
command does not display the CPU time used by other processes running on the system. To view the CPU usage of all processes, use thetop
command instead.