touch
1 名前の由来
2 よく使う形
$ touch newfile.txt && ls newfile.txt$ touch -d '2020-01-01' dated.txt && date -r dated.txt +%Y$ touch existing && touch existing && echo no-error3 主な選択肢
-d, --date=STRINGtouch -d yesterday old.txt-t STAMPtouch -t 202001010000 old.txt-atouch -a f.txt-mtouch -m f.txt4 落とし穴
「ファイルを作るコマンド」だと思われがちだが、本来の主目的は既存ファイルの更新日時を変えること——新規作成はファイルが無いときの副作用にすぎない。 -aと-mを両方省略すると、アクセス日時・更新日時の両方が変わる。片方だけ変えたいときは明示する必要がある。
5 環境差
GNU / Linux
BSD / macOS