This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
linux:basics [2019/08/12 17:06] mstraub [Regular Expressions] |
linux:basics [2019/09/03 09:46] mstraub [Compressing files] |
||
---|---|---|---|
Line 481: | Line 481: | ||
==== Compressing files ==== | ==== Compressing files ==== | ||
- | For compressig files the zip formats gzip (.gz) and bzip2 (.bz2) are commonly used - especially the former. | + | For compressing files the zip formats gzip (.gz), bzip2 (.bz2) and xz (.xz, which uses LZMA compression) are commonly used. |
+ | |||
+ | Gzip is the most commonly used one, but according to [[https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison|this in-depth comparison]] .xz is the superior format - it is fast to decompress, achieves high compression rates and also has reasonable compression times until level 2 or 3. | ||
<code bash> | <code bash> | ||
gzip my.txt # creates the gzipped file my.txt.gz and remove my.txt | gzip my.txt # creates the gzipped file my.txt.gz and remove my.txt | ||
Line 647: | Line 650: | ||
''date'' is a versatile tool for formatting dates / times and setting the system time ([[linux:installation#date_timezone|see also]]). | ''date'' is a versatile tool for formatting dates / times and setting the system time ([[linux:installation#date_timezone|see also]]). | ||
- | Get the current system time | + | Print the current time in different formats |
<code bash> | <code bash> | ||
- | date # print current system time (human readable) | + | date # default - a human readable format |
+ | date --rfc-3339=date # only the date - similar to ISO 8601 | ||
+ | date --rfc-3339=seconds # date and time - similar to ISO 8601 | ||
+ | date +%Y-%m-%dT%H%M # custom format useful for scripts, e.g. 2019-08-14T1129 | ||
</code> | </code> | ||
+ | |||
+ | Convert unix timestamps | ||
+ | <code bash> | ||
+ | date -d @1278923870 # print the unix timestamp in a human readable format | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
====== Working with Text ====== | ====== Working with Text ====== | ||