From 125bacf71c70d1a8a142966b2744098c2b9dad27 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Fri, 10 Jan 2020 05:19:29 +0100 Subject: [PATCH] various deletions --- basics/archives.md | 54 ++++++++++---------- basics/at.md | 7 +-- basics/bash.md | 3 ++ basics/boot.md | 12 ----- basics/clock.md | 14 ++++- networking/dns.md | 5 +- networking/rclone.md | 4 -- system/systemd/{basic commands => basics.md} | 0 8 files changed, 46 insertions(+), 53 deletions(-) rename system/systemd/{basic commands => basics.md} (100%) diff --git a/basics/archives.md b/basics/archives.md index c794541..e849d4f 100644 --- a/basics/archives.md +++ b/basics/archives.md @@ -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 + diff --git a/basics/at.md b/basics/at.md index bf704c7..5e86590 100644 --- a/basics/at.md +++ b/basics/at.md @@ -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/ diff --git a/basics/bash.md b/basics/bash.md index da87549..46c87f0 100644 --- a/basics/bash.md +++ b/basics/bash.md @@ -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] diff --git a/basics/boot.md b/basics/boot.md index e294a12..af2a90c 100644 --- a/basics/boot.md +++ b/basics/boot.md @@ -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. diff --git a/basics/clock.md b/basics/clock.md index 9fa0ea4..7ca71f4 100644 --- a/basics/clock.md +++ b/basics/clock.md @@ -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. diff --git a/networking/dns.md b/networking/dns.md index 5da073f..0a4b523 100644 --- a/networking/dns.md +++ b/networking/dns.md @@ -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 diff --git a/networking/rclone.md b/networking/rclone.md index b96011d..98f10e1 100644 --- a/networking/rclone.md +++ b/networking/rclone.md @@ -49,7 +49,3 @@ Copy to and from with: or > rclone copyto foo google:test - - - - diff --git a/system/systemd/basic commands b/system/systemd/basics.md similarity index 100% rename from system/systemd/basic commands rename to system/systemd/basics.md