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 time reports them, brief notes on jq and ffmpeg, a pointer to perf for profiling, and GNOME / Ubuntu desktop tweaks (gsettings keys, Nautilus Ctrl+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

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 time because 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" but top shows 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.123s
    
    • real = 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
  • 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> then perf report — sampling profiler with call graphs.
  • perf top — top-style live view of what the kernel is currently spending time on.
  • Flamegraphs — pipe perf script into Brendan Gregg's stackcollapse-perf.pl and flamegraph.pl for the familiar SVG view.

4. jq — JSON on the Command Line

  • jq is to JSON what awk is 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 into xargs or 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
  • -ss placement matters: before -i is fast (seek by demuxer, keyframe-accurate after re-encode); after -i is 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-L to flip the location bar into editable form. Esc to flip back.
  • Permanent (always editable):
    gsettings set org.gnome.nautilus.preferences always-use-location-entry true
    
    Set to false to 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