diff --git a/README.md b/README.md index 55dfb9b..4153237 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@ It's mostly distro-agnostic but sometimes specific for [pacman-based distros](ht ### 1. Automatic clear cache. - Description: Automatically move files older than a specific amount of time from your user's `~/.cache` directory to the trash. -- Requires: The [rmtrash](https://github.com/PhrozenByte/rmtrash) package. -- How-to: Add the following line to your crontab using the command "crontab -e" (or EDITOR=$editor crontab -e). - - `0 17 * * * /usr/bin/find ~/.cache/* -mtime +7 -exec /usr/bin/rmtrash -rf {} \;` - - This command looks at files in `~/.cache` every day at 5 p.m. and moves files older than 7 days to the trash. +- Requires: The [rmtrash](https://github.com/PhrozenByte/rmtrash) package and [anacron](https://www.youtube.com/watch?v=41Lay6ZPtRQ). +- How-to: Add the following line to `/etc/cron.daily/cache`. + - `find ~/.cache/* -mtime +7 -exec rmtrash -rf {} \;` + - This will move files older than 7 days in `~/.cache` to the trash every day. - Additionally: This can also be done using regular `rm` instead of `rmtrash`. ### 2. Limit systemd journal size. @@ -73,10 +73,10 @@ It's mostly distro-agnostic but sometimes specific for [pacman-based distros](ht ### 9. Automatic clean orphaned packages. - Description: Automatically remove orphaned packages. -- Requires: A pacman-based distribution. -- How-to: Add the following line to your crontab. - - `0 20 * * * /usr/bin/pacman -Qtdq | /usr/bin/pacman -Rns -` -- Additionally: This example removes orphans everyday at 8 p. m. but the +- Requires: A pacman-based distribution and anacron. +- How-to: Add the following line to `/etc/cron.daily/orph`. + - `pacman -Qtdq | pacman -Rns -` +- Additionally: ### 10. Automatic retrieve latest mirrors. - Description: Automatically retrieve the latest Arch Linux mirrors and write them to the mirrorlist. @@ -84,3 +84,15 @@ It's mostly distro-agnostic but sometimes specific for [pacman-based distros](ht - How-to: Install reflector and enable the reflector.timer. - `# systemctl enable reflector.timer` - Additionally: [ArchWiki: Reflector](https://wiki.archlinux.org/title/Reflector#systemd_timer). + +### 11. Extract text containing keywords from any file. +- Description: This command will filter and sort text based on keyword from any file(s). +- Requires: [GNU Coreutils](https://www.gnu.org/software/coreutils/), [GNU grep](https://www.gnu.org/software/grep/) +- How-to: + - `cat ./*/files* | grep -e keyword1 -e keyword2 | sort -u | nl > file` + - `cat` will take any file(s), multiple files in multiple subdirectories can be specified. + - `grep -e` will look for any and/or all specified keywords. + - `sort -u` will sort the results alphabetically and remove duplicates. + - `nl` will add a number in front of every result (optionally). + - `>` will write everything in a specified file. +- Additionally: This is simply an example of how useful the coreutils can be, especially when used together.