Files
bare-operating-system/packages/bare-os-coreutils/man/pages/touch.json
T
2026-04-03 22:34:08 -04:00

20 lines
1.3 KiB
JSON

{
"name": "touch",
"section": 1,
"title": "change file timestamps or create files",
"synopsis": ["touch [OPTION]... FILE..."],
"description": "Creates missing files (empty) or updates timestamps via **`vfs.writeFile`** with explicit **`mtimeMs`** / **`ctimeMs`** in metadata. Bare has no separate atime; **`-a`** updates **ctime** only and leaves **mtime** unchanged unless a time is given; **`-m`** updates **mtime** only and leaves **ctime** unchanged unless a time is given. Default (neither **`-a`** nor **`-m`**) updates both to the chosen time or now.",
"options": [
{ "flag": "-a", "meaning": "Change access time only (approximated: **ctime** only; **mtime** unchanged)." },
{ "flag": "-m", "meaning": "Change modification time only (**mtime**; **ctime** unchanged unless a time is given)." },
{ "flag": "-d, --date", "meaning": "Use parsed time (**`Date.parse`**; **`@seconds`** for Unix seconds)." },
{ "flag": "-r, --reference", "meaning": "Use **mtime** of **FILE** (last **`-d`** / **`-r`** wins)." }
],
"keywords": ["touch", "bare-os", "coreutils"],
"examples": [
{ "caption": "create empty", "code": "touch newfile" },
{ "caption": "set time", "code": "touch -d '@315532800' old.txt" },
{ "caption": "match another file", "code": "touch -r template.txt copy.txt" }
]
}