dates and timestamps
Print dates in any format, turn epoch seconds into dates and back, use other time zones.
shelltext
steps
-
date +%Ftoday as 2026-11-23
-
date '+%Y-%m-%d %H:%M:%S'date and time
-
date +%sseconds since 1970 (epoch)
-
date -d @1700000000an epoch time as a date (GNU; macOS: date -r 1700000000)
-
date -d 'yesterday' +%Fyesterday, next monday, 3 days ago… (GNU)
-
TZ=UTC datethe time in another zone
commands used
date
Each has a page in lore: lore date opens it.
read a file line by line
Go through a file's lines in a script, also split into fields, without losing spaces or backslashes.
add a folder to the path
Let the shell find programs in a folder, for good, and reload the settings without logging out.
add to the end of a file
Add lines to a file without replacing it, also to a file only root can write.
add up numbers in a file
Sum a column of numbers, from a file or a command's output.