Linux is a multitasking operating system that shares resources with different processes. Every process takes some CPU, memory, and similar resources which can be monitored with the time command. The time command also used for performance testing which is generally used to test and count the performance of the scripts and commands.
The time command is provided via shell environments where the metering is done from the shell. The Bash, Zsh provides the time command, and also the GNU project provides the time command as the binary which is located /usr/bin/time .
time Command Syntax
The time command has the following syntax where it is provided as the first word for the given command and then the command or process we want to run is provided.
- COMMAND is a command which will be run with parameters to monitor performance.
Run time Command
We will use the time command in order to get performance of downloading a file with the wget command. We will also provides the file path we want to download into the wget command.
$ time wget http://ipv4.download.thinkbroadband.com/20MB.zip
We can see that after the command execution is ccompleted the performance metrics are printed into the console which are named as real, user and sys.
- real is the duration where how much time it takes to complete given command or task. In this case, the download time is provided as real which is 12 seconds.
- user is the amount of time the CPU is used to process a given task.
- system or sys is the total amount of the kernel-mode CPU used to process a given task.