Finished v1.
This commit is contained in:
parent
579f8f190c
commit
0961d74725
43
README.md
43
README.md
|
@ -1,7 +1,7 @@
|
||||||
# Random Linux Tips (WIP)
|
# Linux Tech Tips
|
||||||
|
|
||||||
*This is a random collection of useful thing I came across by simply using Linux.
|
*This is a random collection of useful things I came across.
|
||||||
It's mostly distro-agnostic and sometimes specific for Arch- and/or pacman-based distros.*
|
It's mostly distro-agnostic but sometimes specific for [pacman-based distros](https://en.wikipedia.org/wiki/List_of_Linux_distributions#Pacman-based).*
|
||||||
|
|
||||||
### 0. *Short example template.*
|
### 0. *Short example template.*
|
||||||
- Description: *What is this good for.*
|
- Description: *What is this good for.*
|
||||||
|
@ -12,24 +12,24 @@ It's mostly distro-agnostic and sometimes specific for Arch- and/or pacman-based
|
||||||
- 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: 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).
|
- 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 {} \;`
|
- `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.
|
- 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`.
|
- Additionally: This can also be done using regular `rm` instead of `rmtrash`.
|
||||||
|
|
||||||
### 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: Edit `/etc/systemd/journald.conf` and change `SystemMaxUse=50M`.
|
- How-to: 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: The [nano](https://www.nano-editor.org/) editor.
|
- 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).
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ It's mostly distro-agnostic and sometimes specific for Arch- and/or pacman-based
|
||||||
- Additionally: ---
|
- 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: [ArchWiki: Core utilities](https://wiki.archlinux.org/title/Core_utilities#Preventing_data_loss).
|
- Additionally: [ArchWiki: Core utilities](https://wiki.archlinux.org/title/Core_utilities#Preventing_data_loss).
|
||||||
|
@ -58,15 +58,18 @@ It's mostly distro-agnostic and sometimes specific for Arch- and/or pacman-based
|
||||||
- Description: Automatically clean the pacman package cache using paccache.
|
- 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.
|
- 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.
|
- How-to: Enable the paccache.timer.
|
||||||
- # systemctl enable paccache.timer
|
- `# systemctl enable paccache.time`
|
||||||
- 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`
|
- 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.
|
- Description: Connect to a remote maschine using SSH without a password.
|
||||||
- Requires:
|
- Requires: A SSH implementation like [TinySSH](https://tinyssh.org/).
|
||||||
- How-to:
|
- How-to: Generate a keypair and send the public key to the remote maschine's authorized keys.
|
||||||
-
|
- Generate a keypair: `ssh-keygen -t rsa`
|
||||||
- Additionally:
|
- Send the key: `ssh-copy-id $remote-username@$remote-ip-address`
|
||||||
|
- Fill in the username and IP address of your remote maschine.
|
||||||
|
- For example: `ssh-copy-id foo@192.168.178.123`
|
||||||
|
- Additionally: Here's a more detailed [tutorial](https://www.hostinger.com/tutorials/how-to-setup-passwordless-ssh/).
|
||||||
|
|
||||||
### 9. Automatically clean orphaned packages.
|
### 9. Automatically clean orphaned packages.
|
||||||
- Description: Automatically remove orphaned packages.
|
- Description: Automatically remove orphaned packages.
|
||||||
|
@ -80,4 +83,4 @@ It's mostly distro-agnostic and sometimes specific for Arch- and/or pacman-based
|
||||||
- Requires: An Arch-based distro and [reflector](https://xyne.dev/projects/reflector/).
|
- Requires: An Arch-based distro and [reflector](https://xyne.dev/projects/reflector/).
|
||||||
- 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](https://wiki.archlinux.org/title/Reflector#systemd_timer).
|
- Additionally: [ArchWiki: Reflector](https://wiki.archlinux.org/title/Reflector#systemd_timer).
|
||||||
|
|
Loading…
Reference in New Issue