Size: 1206
Comment:
|
Size: 1503
Comment: Backup w/ tar
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from GNUCoreUtils <<TableOfContents>> |
|
Line 12: | Line 16: |
}}} == Backup == {{{#!highlight sh numbers=off tar cvpf backup.tar \ --exclude=/proc \ --exclude=/lost+found \ --exclude=/backup.tar \ --exclude=/mnt \ --exclude=/sys \ --exclude=/dev/pts \ / |
|
Line 52: | Line 69: |
---- CategoryCheatSheet |
Contents
Set operations on lines of a file
# Union of unsorted files, items in either file1 or file2
sort file1 file2 | uniq
# Intersection of unsorted files, items in both file1 and file2
sort file1 file2 | uniq -d
# Difference of unsorted files, items in file2 not in file1
sort file1 file1 file2 | uniq -u
# Symmetric Difference of unsorted files, items in file1 or file2 but not both
sort file1 file2 | uniq -u
Backup
tar cvpf backup.tar \
--exclude=/proc \
--exclude=/lost+found \
--exclude=/backup.tar \
--exclude=/mnt \
--exclude=/sys \
--exclude=/dev/pts \
/
Unit conversion
units -t '100m/9.58s' 'miles/hour'
units -t '500GB' 'GiB'
units -t '1 googol'
Dates
What time is it elsewhere?
TZ='America/Los_Angeles' date
TZ='America/Denver' date
TZ='America/New_York' date
TZ='UTC' date
Check /usr/share/zoneinfo/ to find values for $TZ.
Convert UNIX epoch seconds to date
date --date='@2147483647'
Exit a script unless it's the last day of the month
[ $(date -d "tomorrow" +%d) = "01" ] || exit
Calendar for particular month and year
cal 9 1752