Live data from Hacker News

Linux utils that you might not know

shiroyasha.io

21–30 of 159 posts

Re: Linux utils that you might not know

#24

Why does one use `font-weight: 200` for code?

It's to keep the page weight balanced. Prose is considered to have neutral buoyancy, but code is naturally heavier and will tend to drag the page down if that isn't compensated by a lighter font. FWIW poetry can be so light, that it can require a very heavy font weight to keep it tethered to the page.

Re: Linux utils that you might not know

#25

It always pains me when I see people use "cat" left and right, even when they don't need it. This makes for good reading: http://porkmail.org/era/unix/award.html

Using `cat` is wasteful in scripts but not in command line. It separates filenames, which are often actually glob patterns taking some time to confirm, from the parameters, which also often take some time to look up in the manual. `cat` and a pipe make it easier to edit in the command line.

Re: Linux utils that you might not know

#26

It always pains me when I see people use "cat" left and right, even when they don't need it. This makes for good reading: http://porkmail.org/era/unix/award.html

Many people chain ps and grep... pgrep does that

That's not a great example as `pgrep` is a little more nuanced than running `ps [options] | grep [string]`, eg you cannot use many of the same `ps` flags `pgrep` like you can with `ps`.

At least with "in appropriate use of cat" (as some call it) you're literally just swapping the stdin file stream with a disk io file stream so there's no functional difference what-so-ever.

I'm not saying I agree with the GP either though as most of the time complaints about "in appropriate use of cat" are just showboating. Using `cat` "inappropriately" is arguably more readable for less seasoned shell script developer and it's certainly a more logical program flow for a human to parse. ie "open file, grep for contents, do something else, etc". But it's still sometimes worth a reminder that many string processing tools can accept file input directly without the need for piping it via stdin (or the files can be redirected directly from the shell via the less than, `<`, token).

Re: Linux utils that you might not know

#27
post #13

Earlier quoted context omitted.

and on the contrary: aside from the title, is anything in this article specific to Linux?

Actually not, since these GNU tools could be used on BSD as well.

GNU tools? Original column and factor is older than the GNU project. Don't attribute everything to that bearded madman. GNU is mostly just a copycat of already free software.

Re: Linux utils that you might not know

#28

One note: I believe `shred` won't work as expected on a journaling file system like ext4.

No. Ext4 doesn't do data journaling by default. Even when enabled, what's written to the journal is blank data that's about to be written, not the current file's contents.

    1) write to journal "I'm going to overwrite this file with this data (zeros)"
    2) commit journal
    3) write data to file
This is typical for journaling filesystems-- step 3 can be interrupted by a crash and replayed later (by re-reading the journal).

For filesystems with CoW data (ZFS, btrfs), the in-place data will probably not be overwritten.

Re: Linux utils that you might not know

#29
factor is buggy :

factor 100000000000000000000000000000000000000

100000000000000000000000000000000000000: 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5

http://www.wolframalpha.com/input/?i=factor+1000000000000000...

also numfmt bug:

$ numfmt --to=iec 999999999999999999939999999 828Y

$ numfmt --to=iec 999999999999999999940000000 numfmt: value too large to be printed: '1e+27' (cannot handle values > 999Y)

but 999999999999999999939999999 is ~1000YB : http://www.wolframalpha.com/input/?dataset=&i=99999999999999...

Post reply on HN