Linux Time, Tools and Desktop Tweaks
- Description: Grab-bag of useful Linux odds and ends — what wall/CPU/user/system time actually mean and how
timereports them, brief notes onjqandffmpeg, a pointer toperffor profiling, and GNOME / Ubuntu desktop tweaks (gsettingskeys, NautilusCtrl+L, multi-monitor workspaces). - My Notion Note ID: K2B-3-5
- Created: 2020-06-03
- Updated: 2026-05-19
- License: Reuse is very welcome. Please credit Yu Zhang and link back to the original on yuzhang.io
Table of Contents
- 1. Wall, CPU, User, and System Time
- 2. The
timeCommand - 3.
perf— Linux Profiler (Pointer) - 4.
jq— JSON on the Command Line - 5.
ffmpeg— Quick Re-Encode Recipe - 6. GNOME / Ubuntu Desktop Tweaks
- 7. References
1. Wall, CPU, User, and System Time
Three different clocks. Easy to confuse — they answer different questions.
| Term | What it measures | Affected by other load? |
|---|---|---|
| Wall time (elapsed, real time) | actual seconds on the wall clock from start to end | yes — sleep, IO wait, scheduling delays all count |
| CPU time (process time) | CPU cycles consumed by the process, summed across all cores | no — only counts when the process is running |
| User CPU time | CPU cycles spent executing user-space code (your program, libc, …) | no |
| System CPU time | CPU cycles spent in the kernel on this process's behalf (syscalls, page faults) | no |
- Identity:
CPU time = user time + system time. - A multi-threaded program can have
CPU time > wall timebecause cycles are summed across cores. Example: 4 threads fully busy for 1 wall-second → ~4 CPU-seconds. - A program that sleeps or waits on IO has
wall time » CPU time. If your job is "slow" buttopshows low CPU, you're IO- or lock-bound, not compute-bound. - A program that uses lots of syscalls (many small reads, lots of
mmap, frequent context switches) shows non-trivial system time.
2. The time Command
Two flavors — the shell builtin and the GNU /usr/bin/time binary.
- Shell builtin (
time cmd) — prints three lines, format varies by shell:real 0m1.234s user 0m0.987s sys 0m0.123sreal= wall time,user= user CPU,sys= system CPU.
- GNU
time(/usr/bin/time -v cmd) — much richer, including:- Maximum resident set size (
Maximum resident set size (kbytes)) - Voluntary/involuntary context switches
- Page faults (major / minor)
- File system inputs / outputs
- Maximum resident set size (
- Disambiguate with
command time -v ...or\time -v ...— otherwise the shell builtin wins.
3. perf — Linux Profiler (Pointer)
perf is the kernel-integrated sampling profiler. Worth its own note one day; here are entry points:
- Install:
apt install linux-tools-common linux-tools-$(uname -r)on Debian/Ubuntu. perf stat <cmd>— quick CPU counters (instructions, cycles, IPC, cache misses, branch mispredicts) for one run of a command.perf record -g <cmd>thenperf report— sampling profiler with call graphs.perf top— top-style live view of what the kernel is currently spending time on.- Flamegraphs — pipe
perf scriptinto Brendan Gregg'sstackcollapse-perf.plandflamegraph.plfor the familiar SVG view.
4. jq — JSON on the Command Line
jqis to JSON whatawkis to columns — a stream processor with a small expression language.- Install:
apt install jq(or your package manager equivalent). - Common one-liners:
jq . file.json # pretty-print jq -r '.items[].name' file.json # extract field, raw (no quotes) jq 'select(.status == "open")' file.json curl -s URL | jq '.results | length' jq -c '.data[]' file.json # compact one-per-line output -r(raw) strips JSON quoting from string output.-c(compact) is one object per line — perfect for piping intoxargsor for line-oriented tools.- Sister tools:
yq(YAML),dasel(multi-format).
5. ffmpeg — Quick Re-Encode Recipe
Generic transcode recipe from the original [Y] note, lightly annotated:
ffmpeg -i input.mp4 \
-c:v libx264 -crf 18 -preset slow \
-c:a copy \
-ss 00:00:01 -t 00:00:30 \
output.mp4
| Flag | Meaning |
|---|---|
-i input.mp4 |
input file |
-c:v libx264 |
re-encode video with x264 |
-crf 18 |
constant rate factor; lower = higher quality, 18 ≈ visually lossless |
-preset slow |
encoder preset, trades CPU for compression efficiency |
-c:a copy |
passthrough audio (no re-encode) |
-ss 00:00:01 |
start at 1s in |
-t 00:00:30 |
take 30s of output |
-ssplacement matters: before-iis fast (seek by demuxer, keyframe-accurate after re-encode); after-iis slow but exact.- For lossless cut (no re-encode at all):
ffmpeg -ss T1 -to T2 -i in.mp4 -c copy out.mp4. Cuts on keyframe boundaries only.
6. GNOME / Ubuntu Desktop Tweaks
Small gsettings and shortcut tweaks that don't have GUI toggles.
6.1 Nautilus path bar — type a path
By default Nautilus shows breadcrumbs. Two ways to type a path:
- Per-window: press
Ctrl-Lto flip the location bar into editable form.Escto flip back. - Permanent (always editable):
Set togsettings set org.gnome.nautilus.preferences always-use-location-entry truefalseto restore breadcrumbs.
6.2 Move workspaces across all monitors together
Default GNOME treats only the primary display as having workspaces — the secondary monitors stay static when you switch workspaces. To make every display participate:
gsettings set org.gnome.mutter workspaces-only-on-primary false
Useful on multi-monitor dev setups where the secondary screen also has work that should follow.
6.3 Inspect or revert any gsettings key
gsettings get org.gnome.nautilus.preferences always-use-location-entry
gsettings reset org.gnome.nautilus.preferences always-use-location-entry
gsettings list-recursively org.gnome.mutter | grep workspace
dconf-editor provides a GUI tree view of every key if you'd rather click around.
7. References
- Wall vs CPU time — https://stackoverflow.com/questions/7335920/what-specifically-are-wall-clock-time-user-cpu-time-and-system-cpu-time-in-uni
- Wall vs user vs CPU time — https://serverfault.com/questions/48455/what-are-the-differences-between-wall-clock-time-user-time-and-cpu-time
man time,man 1 time,info timeperfwiki — https://perf.wiki.kernel.org/, plus 南霄's notes at https://nanxiao.me/category/技术/perf笔记/jqmanual — https://jqlang.github.io/jq/manual/ffmpegre-encode reference — https://superuser.com/questions/1056599/ffmpeg-re-encode-a-video-keeping-settings-similar- Nautilus always-use-location-entry — https://ubuntuhandbook.org/index.php/2020/05/textual-path-ubuntu-20-04-files/
- 经典 Linux 软件汇总 — https://kongll.github.io/2015/06/23/Linux下的经典软件-史上最全/