Added a bunch.
This commit is contained in:
parent
58bc65b2e1
commit
579f8f190c
57
README.md
57
README.md
|
@ -1,14 +1,16 @@
|
||||||
# Random Linux Tips (WIP)
|
# Random Linux Tips (WIP)
|
||||||
|
|
||||||
|
*This is a random collection of useful thing I came across by simply using Linux.
|
||||||
|
It's mostly distro-agnostic and sometimes specific for Arch- and/or pacman-based distros.*
|
||||||
|
|
||||||
### 0. *Short example template.*
|
### 0. *Short example template.*
|
||||||
- Description: *What is this good for.*
|
- Description: *What is this good for.*
|
||||||
- Requires: *Do you need any particular software (provide a link)?*
|
- Requires: *Do you need any particular software (provide a link)?*
|
||||||
- How-to: *Straight forward description and maybe a code example.*
|
- How-to: *Straight forward description and maybe a code example.*
|
||||||
- *Detailled description if necessary.*
|
- *Detailled description if necessary.*
|
||||||
- `sudo this is the actual code lol`
|
- `# this is the actual code lol`
|
||||||
- Aditionally: *Anything else that might be important like additional ressources.*
|
- Aditionally: *Anything else that might be important like additional ressources.*
|
||||||
|
|
||||||
|
|
||||||
### 1. Automatically clear cache.
|
### 1. Automatically clear cache.
|
||||||
- Description: Move files older than a specific amount of time from your user's ~/.cache directory to the trash.
|
- Description: Move files older than a specific amount of time from your user's ~/.cache directory to the trash.
|
||||||
- Requires: [rmtrash](https://github.com/PhrozenByte/rmtrash).
|
- Requires: [rmtrash](https://github.com/PhrozenByte/rmtrash).
|
||||||
|
@ -20,33 +22,62 @@
|
||||||
### 2. Limit Systemd journal size.
|
### 2. Limit Systemd journal size.
|
||||||
- Description: Limit the Systemd journal to a specific size.
|
- Description: Limit the Systemd journal to a specific size.
|
||||||
- Requires: Specific to systems using [Systemd](https://systemd.io/).
|
- Requires: Specific to systems using [Systemd](https://systemd.io/).
|
||||||
- How-to:
|
- How-to: Edit `/etc/systemd/journald.conf` and change `SystemMaxUse=50M`.
|
||||||
- Edit `/etc/systemd/journald.conf` and change `SystemMaxUse=50M`.
|
|
||||||
- Additionally: [ArchWiki: Systemd](https://wiki.archlinux.org/title/Systemd/Journal#Journal_size_limit).
|
- Additionally: [ArchWiki: Systemd](https://wiki.archlinux.org/title/Systemd/Journal#Journal_size_limit).
|
||||||
- Additionally: This can also be achieved using `journalctl` and be [limited by time](https://wiki.archlinux.org/title/Systemd/Journal#Clean_journal_files_manually).
|
- Additionally: This can also be achieved using `journalctl` and be [limited by time](https://wiki.archlinux.org/title/Systemd/Journal#Clean_journal_files_manually).
|
||||||
|
|
||||||
### 3. Syntax highlight for nano
|
### 3. Syntax highlight for nano
|
||||||
- Description: Enable syntax highlighting for nano.
|
- Description: Enable syntax highlighting for nano.
|
||||||
- Requires:
|
- Requires: The [nano](https://www.nano-editor.org/) editor.
|
||||||
- How-to: Edit `~/.config/nano/nanorc` or to `/etc/nanorc` and add the following.
|
- How-to: Edit `~/.config/nano/nanorc` or to `/etc/nanorc` and add the following.
|
||||||
- `include "/usr/share/nano/*.nanorc"`.
|
- `include "/usr/share/nano/*.nanorc"`.
|
||||||
- Additionally: [ArchWiki: Nano](https://wiki.archlinux.org/title/Nano#Syntax_highlighting).
|
- Additionally: [ArchWiki: Nano](https://wiki.archlinux.org/title/Nano#Syntax_highlighting).
|
||||||
|
|
||||||
### 4. Repeat a command using watch.
|
### 4. Repeat a command using watch.
|
||||||
|
- Description: Repeat and watch a command in a custom interval.
|
||||||
|
- Requires: The [procfs](https://gitlab.com/procps-ng/procps) package.
|
||||||
|
- How-to: Use `watch` followed by your command.
|
||||||
|
- Example: `# watch -n 1.0 "du -h -s ./$folder`
|
||||||
|
- This prints the summarized size of $folder in human-readable format every second.
|
||||||
|
- Additionally: ---
|
||||||
|
|
||||||
### 5. Use sudo !!.
|
### 5. Use sudo !!.
|
||||||
|
- Description: Repeat the last command using sudo.
|
||||||
|
- Requires: The [sudo](https://www.sudo.ws/) package.
|
||||||
|
- How-to: Just type `sudo !!` and the last command will be repeated using `sudo`.
|
||||||
|
- Additionally: ---
|
||||||
|
|
||||||
### 6. Prevent overwriting files.
|
### 6. Prevent overwriting files.
|
||||||
- Description: Use alias for *rm*, *cp* and *mv*.
|
- Description: Use alias for *rm*, *cp* and *mv*.
|
||||||
- How-to: Add the following alias into your ~/.bashrc.
|
- How-to: Add the following alias into your ~/.bashrc.
|
||||||
- Use *-interactive* option to get asked before overwriting files.
|
- Use *-interactive* option to get asked before overwriting files.
|
||||||
- `alias mv="mv -i"`
|
- `alias mv="mv -i"`
|
||||||
- Additionally: Further reading in the Arch wiki.
|
- Additionally: [ArchWiki: Core utilities](https://wiki.archlinux.org/title/Core_utilities#Preventing_data_loss).
|
||||||
|
|
||||||
### 7. Paccache timer
|
### 7. Auto-clean package cache.
|
||||||
- Requires: A pacman-based distro and the pacman-contrib package.
|
- Description: Automatically clean the pacman package cache using paccache.
|
||||||
|
- Requires: A [pacman-based distro](https://en.wikipedia.org/wiki/List_of_Linux_distributions#Pacman-based) and the [pacman-contrib](https://github.com/archlinux/pacman-contrib) package.
|
||||||
|
- How-to: Enable the paccache.timer.
|
||||||
|
- # systemctl enable paccache.timer
|
||||||
|
- Additionally: Edit the paccache.service in /usr/lib/systemd/system/ and change the command to e.g. keep the latest installed version and no uninstalled version of all packages: `ExecStart=/usr/bin/paccache -rk1 && /usr/bin/paccache -ruk0`
|
||||||
|
|
||||||
### 8. Passwordless SSH
|
### 8. Passwordless SSH
|
||||||
|
- Description: Connect to a device using SSH without a password.
|
||||||
### 9. Automatically clean orphaned packages.
|
- Requires:
|
||||||
`0 20 * * * /usr/bin/pacman -Qtdq | /usr/bin/pacman -Rns -`
|
- How-to:
|
||||||
|
-
|
||||||
|
- Additionally:
|
||||||
|
|
||||||
|
### 9. Automatically 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
|
||||||
|
|
||||||
|
### 10. Automatic retrieve latest mirrors.
|
||||||
|
- Description: Automatically retrieve the latest Arch Linux mirrors and write them to the mirrorlist.
|
||||||
|
- Requires: An Arch-based distro and [reflector](https://xyne.dev/projects/reflector/).
|
||||||
|
- How-to: Install reflector and enable the reflector.timer.
|
||||||
|
- `# systemctl enable reflector.timer`
|
||||||
|
- Additionally: [ArchWiki](https://wiki.archlinux.org/title/Reflector#systemd_timer).
|
||||||
|
|
Loading…
Reference in New Issue