
times Command in Linux
The times command in Linux displays the accumulated user and system time used by the current shell and all processes run from it. It is a shell built-in, usually in Bash, and is useful for checking CPU time usage for all commands executed in a session.
Table of Contents
Here is a comprehensive guide to the options available with the times command −
Syntax of imes Command
The syntax of the times command in Linux is as follows −
times
The command does not take any options or arguments.
Examples of times Command in Linux
This section discusses how to use the times command in Linux with examples −
Displaying User and System Time used by Current Shell
To display the CPU time, execute the following command −
times

The above command prints two lines −
- First line − CPU time used by the shell process itself.
- Second line − CPU time used by child processes (commands run from the shell).
The above output image shows that the shell used 0.04 seconds of user time and 0.01 seconds of system time. Since no child processes were running, the child processes used 0.00 seconds of user time and 0.00 seconds of system time.
The following example executes several commands to illustrate how CPU time accumulates −

In the above output, the shell time, 0.04 seconds in user mode and 0.07 seconds in system mode, reflects the time spent running the shell and performing simple internal tasks. The child process time, 0.03 seconds in user mode and 0.08 seconds in system mode, accounts for the time consumed by external commands such as sleep, echo, sudo, and mkdir. Most of the CPU time was used by sudo mkdir, which involves system-level operations.
Note − The times command reports cumulative CPU time used since the shell session began.
Conclusion
The times command in Linux shows how much CPU time the shell and its child processes have used. It is a built-in feature of the shell, often found in Bash, and helps monitor how long processes have run.
With no options or arguments, the times command simply prints the user and system time for both the shell and any commands executed during the session.