Added # 11.
This commit is contained in:
parent
7736e26522
commit
5f7a24bc76
28
README.md
28
README.md
|
@ -13,10 +13,10 @@ It's mostly distro-agnostic but sometimes specific for [pacman-based distros](ht
|
||||||
|
|
||||||
### 1. Automatic clear cache.
|
### 1. Automatic clear cache.
|
||||||
- Description: Automatically move files older than a specific amount of time from your user's `~/.cache` directory to the trash.
|
- 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.
|
- 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 your crontab using the command "crontab -e" (or EDITOR=$editor crontab -e).
|
- How-to: Add the following line to `/etc/cron.daily/cache`.
|
||||||
- `0 17 * * * /usr/bin/find ~/.cache/* -mtime +7 -exec /usr/bin/rmtrash -rf {} \;`
|
- `find ~/.cache/* -mtime +7 -exec 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.
|
- 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`.
|
- Additionally: This can also be done using regular `rm` instead of `rmtrash`.
|
||||||
|
|
||||||
### 2. Limit systemd journal size.
|
### 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.
|
### 9. Automatic clean orphaned packages.
|
||||||
- Description: Automatically remove orphaned packages.
|
- Description: Automatically remove orphaned packages.
|
||||||
- Requires: A pacman-based distribution.
|
- Requires: A pacman-based distribution and anacron.
|
||||||
- How-to: Add the following line to your crontab.
|
- How-to: Add the following line to `/etc/cron.daily/orph`.
|
||||||
- `0 20 * * * /usr/bin/pacman -Qtdq | /usr/bin/pacman -Rns -`
|
- `pacman -Qtdq | pacman -Rns -`
|
||||||
- Additionally: This example removes orphans everyday at 8 p. m. but the
|
- Additionally:
|
||||||
|
|
||||||
### 10. Automatic retrieve latest mirrors.
|
### 10. Automatic retrieve latest mirrors.
|
||||||
- Description: Automatically retrieve the latest Arch Linux mirrors and write them to the mirrorlist.
|
- 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.
|
- How-to: Install reflector and enable the reflector.timer.
|
||||||
- `# systemctl enable reflector.timer`
|
- `# systemctl enable reflector.timer`
|
||||||
- Additionally: [ArchWiki: Reflector](https://wiki.archlinux.org/title/Reflector#systemd_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.
|
||||||
|
|
Loading…
Reference in New Issue