Created
October 22, 2024 02:24
-
-
Save CorentinGC/6e9f5f19177103813e66550e4309180a to your computer and use it in GitHub Desktop.
Useful commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 7z archive | |
7z -mx=0 a /home/user/archive.7z /folder/to/zip | |
# 7z archive in 1g parts | |
7z -mx=0 -v1g a /home/user/archive.7z /folder/to/zip | |
# Copy / rsync | |
sudo rsync -ah --progress SOURCE DEST | |
# rsync ssh | |
─ rsync -av -e "ssh -i /home/user/.ssh/key" --info=progress2 ./ user@remote:/folder/on/remote | |
## Replace data in file | |
Test: sed -e "s/{{ENV_VAR}}/$ENV_VAR/g" /FILE/PATH | |
Apply: sed -i.bak "s/{{ENV_VAR}}/$ENV_VAR/g" /FILE/PATH | |
# Create file with timestamp | |
touch backup_$(date +%F)_$(date +%T).log | |
# Count file older than 1 day | |
find /FatServer/home/backup_mc/ -type f -name 'hrt_craft-*.7z' -mtime 1 | wc -l | |
# Swap | |
In a nutshell swap is a piece of storage (used from your harddisk) which can be used as additional RAM. If you want to change the size of your swap file (which is 1GB by default on Ploi) just follow the following steps. | |
Turn off all running swap processes: swapoff -a | |
Resize swap fallocate -l 1G /swapfile (change 1G to the gigabyte size you want it to be) | |
CHMOD swap: chmod 600 /swapfile | |
Make file usable as swap mkswap /swapfile | |
Active the swap file swapon /swapfile | |
Thats it! Some commands may take some time to be executed, just wait patiently for the commands to finish. | |
To verify your swap size run the following command and you will see the swap size: free -m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment