Linux-Tech-Tips/README.md

39 lines
1.7 KiB
Markdown
Raw Normal View History

2022-02-05 13:40:34 +01:00
# Random Linux Tips (WIP)
2022-02-05 15:12:25 +01:00
2022-02-05 13:49:26 +01:00
### 0. *Short example template.*
- Description: *What is this good for.*
- Requires: *Do you need any particular software (provide a link)?*
- How-to: *Straight forward description and maybe a code example.*
- *Detailled description if necessary.*
2022-02-05 15:12:25 +01:00
- $ sudo this is the actual code lol
- Aditionally: *Anything else that might be important like additional ressources.*
[[_TOC_]]
2022-02-05 13:40:34 +01:00
### 1. Automatically clear cache.
2022-02-05 13:18:32 +01:00
- Description: Move files older than a specific amount of time from your user's ~/.cache directory to the trash.
2022-02-05 15:13:56 +01:00
- Requires: [rmtrash](https://github.com/PhrozenByte/rmtrash).
2022-02-05 13:49:26 +01:00
- How-to:
2022-02-05 13:32:34 +01:00
- Add the following line to your crontab using the command "crontab -e" (or EDITOR=$editor crontab -e):
2022-02-05 15:12:25 +01:00
- $ 0 17 * * * /usr/bin/find ~/.cache/* -mtime +7 -exec /usr/bin/rmtrash -rf {} \;
2022-02-05 13:32:34 +01:00
- This command looks at files in ~/.cache every day at 5 p.m. and moves files older than 7 days to the trash.
- Additionally: This can also be done using regular "rm" instead of "rmtrash".
2022-02-05 13:40:34 +01:00
### 2. Clean systemd journal.
https://wiki.archlinux.org/title/Systemd/Journal#Journal_size_limit
https://wiki.archlinux.org/title/Systemd/Journal#Clean_journal_files_manually
### 3. Syntax highlight for nano
https://wiki.archlinux.org/title/Nano#Syntax_highlighting
### 4. Repeat a command using watch.
### 5. Use sudo !!.
2022-02-05 15:12:25 +01:00
### 6. Prevent overwriting files.
- Description: Use alias for *rm*, *cp* and *mv*.
- How-to: Add the following alias into your ~/.bashrc.
- Use *-interactive* option to get asked before overwriting files.
- $ alias mv="mv -i"
- Additionally: Further reading in the Arch wiki.