Created
June 23, 2022 10:06
-
-
Save yuchdev/ef0627f8f02fa8be57c66340b884c426 to your computer and use it in GitHub Desktop.
Bash Code Snippets
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
#!/bin/sh | |
# Backup Partititon | |
dd if=/dev/sda of=/mnt/backup/sda.img conv=noerror | |
fdisk -l /dev/sda > /mnt/backup/sda.info | |
dd if=/dev/sdb of=/mnt/backup/sdb.img conv=noerror | |
fdisk -l /dev/sdb > /mnt/backup/sdb.info | |
# execute "git pull" in every dir | |
for dir in ~/projects/git/* | |
do | |
(cd $dir && git pull) | |
done | |
# find text 'text-to-find-here' in all files | |
find / -type f -exec grep -H 'text-to-find-here' {} \; | |
# Mount FTP as dir | |
mount -t nfs ftpback-rbx3-473.ovh.net:/export/ftpbackup/ns6663170.ip-151-80-105.eu /mnt/backup | |
mount -t cifs -o sec=ntlm,uid=root,gid=100,dir_mode=0700,username=root,password=fVnb79C4rG //ftpback-rbx3-473.ovh.net/ns6663170.ip-151-80-105.eu /mnt/backup | |
# add to *.tar only hidden directories | |
find -regex './\..*' | tar cvf ./test.tar -T - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment