tags: command line

Action executed in 0.000

Each Tag

command line

Common tags - number of posts

unix (1), open source (1), readable (1), SQL (1), human (1),

Human Readable UNIX Commands

Isn't it odd that some UNIX commands like ls and df have options like -h to make the output more human readable? You would think it would be the default! I love open source, but sometimes UNIX just stinks.

So i guess if you omit the -h options, that output is machine readable, facilitating the flow of information from one process to the next. NOPE. In my opinion unix does this very poorly and it's never consistent.

example: When you run ls -l, is it safe to assume that the date starts at character 36 (0 based). It almost alwasy does, but if the file size is over 999,999,999 bytes, then the date starts at character 37.

So you say delimit fields based on space. If your file name has a space in it, then field[7] will only have the first word of it.

If you've ever noticed, the output of many unix commands is tabular. That is there are fields and records. Doesn't it make sense that comma separated fields is the best machine readable output? All unix commands with tabular output should have this option.

In fact i can go so far as to suggest using SQL as an interface to a computer system.

select name, size
from directory
where '2005-10-10' < date
order by size desc
limit 10