various deletions

This commit is contained in:
Malin Freeborn 2020-01-10 05:19:29 +01:00
parent 4cdfe209f5
commit 125bacf71c
8 changed files with 46 additions and 53 deletions

View File

@ -1,14 +1,10 @@
# Automatic Backups with `find`
> find /home/"$(whoami)" -type f -size -2M | xargs zip -u backup
# Tar Archives # Tar Archives
Create ze files: *C*reate *z*e *f*iles!
> tar czf file.tar.gz file1 file2 > tar czf file.tar.gz file1 file2
Extract ze files: E*x*tract *z*e *f*iles:
> tar xzf file.tar.gz > tar xzf file.tar.gz
@ -16,29 +12,11 @@ The .tar extension means two or more files are bundled together into a single fi
Tarballs come with a number of arguments. Tarballs come with a number of arguments.
- c means 'create'. ## More Compression
- v means 'verbose'. Extremely compressed files take longer to compress, but take up less disk space.
- f means 'this is the file' and must always be the ultimate argument. > tar cfj super-compressed.tar.bz2 file1 file2
- z means compression.
So we can compress file1 and file2 into a single tar called 'archive' with:
> tar czvf archive.tar.gz file1 file2
Extraction uses 'x' instead of 'c'.
> tar xzvf archive.tar.gz
Create a very compressed file:
> tar cfj super-compressed.tar.gz file1 file2
# Example - Compressing all Latex Files in /home/
> sudo find ~ -maxdepth 4 -name "*.txt" | xargs tar cvf latex-bundle.tar.gz
# ssh backup # ssh backup
@ -46,7 +24,7 @@ Back up an unmounted partition with ssh:
> sudo dd if=/dev/sda1 | ssh -C ghost@192.168.0.10 "dd of=/home/ghost/backup.img" status=progress > sudo dd if=/dev/sda1 | ssh -C ghost@192.168.0.10 "dd of=/home/ghost/backup.img" status=progress
# img.xz # `xz`
Install `xz`. Install `xz`.
@ -58,3 +36,23 @@ This then deletes the .xz file. To keep it:
> unxz --keep void.img.xz > unxz --keep void.img.xz
# `zip`
Zip file1-3, and make a zip file called 'newsip.zip'.
> zip newsip file1 file2 file3
# Automatic Backups with `find`
## `tar`
Compressing all Latex Files in /home/.
> sudo find ~ -maxdepth 4 -name "*.txt" | xargs tar cvf latex-bundle.tar.gz
## `zip
Install `zip`.
> find /home/"$(whoami)" -type f -size -2M | xargs zip -u backup

View File

@ -1,7 +1,3 @@
`at` must be installed with:
> sudo apt-get install at
Then jobs can be specified with absolute time, such as: Then jobs can be specified with absolute time, such as:
> at 16:20 > at 16:20
@ -30,5 +26,4 @@ This will print all pending IDs. Remove a job by the ID with:
> atrm 2 > atrm 2
Check /var/spool/cron/ Check /var/spool/atd/

View File

@ -15,6 +15,7 @@ A double pipe will try one, and do the other if that fails.
> cp -r ~/Archive ~/Backup || tar czf Archive.tar.gz * > cp -r ~/Archive ~/Backup || tar czf Archive.tar.gz *
# REGEX # REGEX
Regular expression characters include: Regular expression characters include:
\\ ^ $ . | ? * + () [] {} \\ ^ $ . | ? * + () [] {}
@ -26,6 +27,7 @@ As a result, grep cannot read these characters as literal characters unless they
... will search the string 'wtf?' in the file log.txt. Another version is egrep (now used with 'grep -e') which uses more characters as special characters, or fgrep, which treats all characters as literal strings. ... will search the string 'wtf?' in the file log.txt. Another version is egrep (now used with 'grep -e') which uses more characters as special characters, or fgrep, which treats all characters as literal strings.
# Environmental Variables # Environmental Variables
PWD, USER, PATH PWD, USER, PATH
To display all environmental (but not local) variables, use To display all environmental (but not local) variables, use
@ -79,6 +81,7 @@ The sort function arranges lines alphabetically. Use -r to reverse and -n to so
Edit all examples of hey to hoi in greetings and print that to the file. Edit all examples of hey to hoi in greetings and print that to the file.
# Measurement # Measurement
Measure how long a script takes for super-autism powers. Measure how long a script takes for super-autism powers.
> time [bash script] > time [bash script]

View File

@ -32,18 +32,6 @@ Ctrl+c at boot then add in
None of this is used by humans anymore - it's all systemd. None of this is used by humans anymore - it's all systemd.
# Systemd
See what's running with ....
> systemctl list-units
Stop, start, whatever with:
systemctl enable|stop|start httpd
This starts httpd (Fedora's word for Apache2).
# Boot Records # Boot Records
'File System Tab' under /etc/fstab keeps track of the partitions and boot order. 'File System Tab' under /etc/fstab keeps track of the partitions and boot order.

View File

@ -1,4 +1,4 @@
# Basics # `date`
Show system time: Show system time:
@ -20,6 +20,18 @@ Manually set the hardware time to a specified date:
> sudo hwclock --set --date="8/25/19 13:30:00" > sudo hwclock --set --date="8/25/19 13:30:00"
## Normal Date
> date +%d/%m/%y
# Unix Time
Computers started counting time on January 1st, 1970, and added one second-per-second. If your clock shows you're in the 70's, it's reset to the start.
Track the time in Unix-time:
> date +%s
# Network Time Providers # Network Time Providers
Servers which take their time from an observatory we call Stratum 1 servers. Servers which takes their time from Stratum n servers are Stratum n+1 servers. Servers which take their time from an observatory we call Stratum 1 servers. Servers which takes their time from Stratum n servers are Stratum n+1 servers.

View File

@ -2,7 +2,8 @@
On Debian, a file might gain DNS services by adding the following to /etc/network/interfaces: On Debian, a file might gain DNS services by adding the following to /etc/network/interfaces:
---------------- ```
auto eth0 auto eth0
iface eth0 inet static iface eth0 inet static
address 10.0.0.23 address 10.0.0.23
@ -11,7 +12,7 @@ iface eth0 inet static
dns-nameservers 208.67.222.222 208.67.220.220 dns-nameservers 208.67.222.222 208.67.220.220
dns-search example.com dns-search example.com
---------------- ```
# URL Aliases # URL Aliases

View File

@ -49,7 +49,3 @@ Copy to and from with:
or or
> rclone copyto foo google:test > rclone copyto foo google:test