## page was renamed from GNUCoreUtils <> == Set operations on lines of a file == {{{#!highlight sh numbers=off # 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 == {{{#!highlight sh numbers=off # CAVEAT: apparently does not backup setuid bits? tar cvpf backup.tar \ --exclude=/proc \ --exclude=/lost+found \ --exclude=/backup.tar \ --exclude=/mnt \ --exclude=/sys \ --exclude=/dev/pts \ / }}} == Unit conversion == {{{#!highlight sh numbers=off units -t '100m/9.58s' 'miles/hour' units -t '500GB' 'GiB' units -t '1 googol' }}} == Dates == === What time is it elsewhere? === {{{#!highlight sh numbers=off 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 === {{{#!highlight sh numbers=off date --date='@2147483647' }}} === Exit a script unless it's the last day of the month === {{{#!highlight sh numbers=off [ $(date -d "tomorrow" +%d) = "01" ] || exit }}} === Calendar for particular month and year === {{{#!highlight sh numbers=off cal 9 1752 }}} ---- CategoryCheatSheet