From d15b3d3b7c2d00f767e94c6d7833d1ae5ef3a179 Mon Sep 17 00:00:00 2001 From: exu Date: Sat, 29 Jul 2023 15:12:57 +0200 Subject: [PATCH] Add command to modify timestamp of files --- pages/04.other/useful-commands/default.en.md | 56 ++++++++++++++++---- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/pages/04.other/useful-commands/default.en.md b/pages/04.other/useful-commands/default.en.md index c1cbce6..5a2173f 100644 --- a/pages/04.other/useful-commands/default.en.md +++ b/pages/04.other/useful-commands/default.en.md @@ -31,6 +31,32 @@ find (directory) -type f -exec chmod 744 {} + Replacing `-type f` with `-type d` would execute the `chmod` for directories instead. +## Arch Linux + +### Detect AUR package rebuilds + +Install the package `extra/rebuild-detector` +It will create a `pacman` hook to check which packages need to be rebuild, but can also be executed with the following command. + +[shuser] + +```sh +checkrebuild +``` + +[/shuser] + +The packages might be rebuilt automatically a lot of the time, but sometimes it is necessary to for a rebuild using the AUR helper. +This is an example using `paru` + +[shuser] + +```sh +paru -S --rebuild=yes +``` + +[/shuser] + ## Various ### Overwrite disk with pseudorandom data @@ -91,28 +117,38 @@ lsusb -d 0781:55a3 -v | grep bcdUSB [/shuser] -## Arch Linux +### Change file modify time -### Detect AUR package rebuilds +Using `touch` it is possible to change the timestamps on a file. +_Note: The file has to be owned by the user executing the command_ -Install the package `extra/rebuild-detector` -It will create a `pacman` hook to check which packages need to be rebuild, but can also be executed with the following command. +Example changing the access and modify timestamps: [shuser] -```sh -checkrebuild +``` +touch -a -m -t 202307291506.07 ``` [/shuser] -The packages might be rebuilt automatically a lot of the time, but sometimes it is necessary to for a rebuild using the AUR helper. -This is an example using `paru` +``` +-a: accessed time +-m: modified time +-t: timestamp - [[CC]YY]MMDDhhmm[.ss] time format +``` + +Alternatively to `-t` it is also possible to use `-d` for a looser format. +[ISO8061](https://en.wikipedia.org/wiki/ISO_8601) obviously works as well. [shuser] -```sh -paru -S --rebuild=yes +``` +touch -a -m -d "2 hours ago" +touch -a -m -d "2023-07-29T00:23" ``` [/shuser] + +> [Linux - modify file modify/access/change time](https://stackoverflow.com/questions/40630695/linux-modify-file-modify-access-change-time) +> [How can I change the date modified/created of a file?](https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file)