Linux time Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
⏱ Linux time Guide
Complete beginner-friendly guide to time on Linux, covering Arch Linux, CachyOS, and other distributions including command timing, performance measurement, and execution time.
Table of Contents
⏱ time Basics
Time Command
Basic usage:
# Time command execution
time ls
# Shows execution time
Output Format
Time output:
# Output shows:
# real - wall clock time
# user - CPU time in user mode
# sys - CPU time in kernel mode
⏰ Timing Commands
Simple Timing
Basic timing:
# Time command
time ls
# Output:
# real 0m0.001s
# user 0m0.000s
# sys 0m0.001s
Long Running
Measure duration:
# Time long command
time sleep 5
# Shows ~5 seconds real time
Detailed Timing
Verbose Output
More details:
# Verbose timing
/usr/bin/time -v ls
# -v = verbose (detailed statistics)
Resource Usage
Resource info:
# Resource usage
/usr/bin/time -v command
# Shows:
# - Memory usage
# - Page faults
# - Context switches
# etc.
Formatting
Custom Format
Format string:
# Custom format
/usr/bin/time -f "%E real, %U user, %S sys" ls
# -f = format (custom format string)
Format Specifiers
Common formats:
# %E - elapsed time
# %U - user time
# %S - system time
# %M - max memory (KB)
Troubleshooting
time Not Found
Check installation:
# time is built-in shell command
# /usr/bin/time is separate program
# Check both
which time
which /usr/bin/time
Summary
This guide covered time usage, command timing, and performance measurement for Arch Linux, CachyOS, and other distributions.
Next Steps
- Performance Tuning - Performance optimization
- System Monitoring - System monitoring
- htop Guide - Process monitoring
- time Documentation:
man time
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.