Skip to content

Instantly share code, notes, and snippets.

+----------------------------------------------------------------------------------------------------------------------------------------+
| Task | One-Liner
+----------------------------------------------------------------------------------------------------------------------------------------+
| Count the number of lines in a file | wc -l filename |
| ----------------------------------------------------------------------------------------------------------------------------------------
| Show the field names, one in each line, preceded by line numbers | head -1 filename | tr ‘\t’ ‘\n’ | nl    (tab-delimited file) |
| (helpful when you have numerous fields in a new file and want to | head -1 filename | tr ‘,’ ‘\n’ | nl     (comma-delimited file) |
| get the lay of the land)