various deletions
This commit is contained in:
parent
4cdfe209f5
commit
125bacf71c
@ -1,14 +1,10 @@
|
||||
# Automatic Backups with `find`
|
||||
|
||||
> find /home/"$(whoami)" -type f -size -2M | xargs zip -u backup
|
||||
|
||||
# Tar Archives
|
||||
|
||||
Create ze files:
|
||||
*C*reate *z*e *f*iles!
|
||||
|
||||
> tar czf file.tar.gz file1 file2
|
||||
|
||||
Extract ze files:
|
||||
E*x*tract *z*e *f*iles:
|
||||
|
||||
> 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.
|
||||
|
||||
- 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.
|
||||
|
||||
- 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
|
||||
> tar cfj super-compressed.tar.bz2 file1 file2
|
||||
|
||||
# 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
|
||||
|
||||
# img.xz
|
||||
# `xz`
|
||||
|
||||
Install `xz`.
|
||||
|
||||
@ -58,3 +36,23 @@ This then deletes the .xz file. To keep it:
|
||||
|
||||
> 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
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
`at` must be installed with:
|
||||
|
||||
> sudo apt-get install at
|
||||
|
||||
Then jobs can be specified with absolute time, such as:
|
||||
|
||||
> at 16:20
|
||||
@ -30,5 +26,4 @@ This will print all pending IDs. Remove a job by the ID with:
|
||||
|
||||
> atrm 2
|
||||
|
||||
Check /var/spool/cron/
|
||||
|
||||
Check /var/spool/atd/
|
||||
|
@ -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 *
|
||||
|
||||
# REGEX
|
||||
|
||||
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.
|
||||
|
||||
# Environmental Variables
|
||||
|
||||
PWD, USER, PATH
|
||||
|
||||
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.
|
||||
|
||||
# Measurement
|
||||
|
||||
Measure how long a script takes for super-autism powers.
|
||||
|
||||
> time [bash script]
|
||||
|
@ -32,18 +32,6 @@ Ctrl+c at boot then add in
|
||||
|
||||
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
|
||||
|
||||
'File System Tab' under /etc/fstab keeps track of the partitions and boot order.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Basics
|
||||
# `date`
|
||||
|
||||
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"
|
||||
|
||||
## 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
|
||||
|
||||
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.
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
On Debian, a file might gain DNS services by adding the following to /etc/network/interfaces:
|
||||
|
||||
----------------
|
||||
```
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 10.0.0.23
|
||||
@ -11,7 +12,7 @@ iface eth0 inet static
|
||||
dns-nameservers 208.67.222.222 208.67.220.220
|
||||
dns-search example.com
|
||||
|
||||
----------------
|
||||
```
|
||||
|
||||
# URL Aliases
|
||||
|
||||
|
@ -49,7 +49,3 @@ Copy to and from with:
|
||||
or
|
||||
|
||||
> rclone copyto foo google:test
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user