Live data from Hacker News

Linux utils that you might not know

shiroyasha.io

31–40 of 159 posts

Re: Linux utils that you might not know

#32
post #4

There is also another command 'paste'. Example: Created two files (1.txt and 2.txt) [efg@fedori ~]$ cat 1.txt file1: line1 file1: line2 [efg@fedori ~]$ cat 2.txt file2: line1 file2: line2 In order to merge the lines of these two files we can use paste: [efg@fedori ~]$ paste 1.txt 2.txt file1: line1 file2: line1 file1: line2 file2: line2 Also check out 'man fold'

Also super handy to turn lines into columns. 'paste - - -' for example will take every three lines as single row.

Re: Linux utils that you might not know

#33
post #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 999999999999…

You got the same answer from factor and Wolfram alpha; where is the bug?

Re: Linux utils that you might not know

#34
post #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 999999999999…

hrrm but bc -l shows :

999999999999999999939999999 / 1024^8 827.18061255302767482177

Re: Linux utils that you might not know

#35
post #33
post #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 999999999999…

You got the same answer from factor and Wolfram alpha; where is the bug?

wa shows 76 prime factors, which is the not same as printing out a bunch of 2's and 5's

Re: Linux utils that you might not know

#36

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

It shouldn't. It's 2017 now, and the speed difference between a "misplaced" cat command is normally negligible. The speed of the terminal user is more important.

Re: Linux utils that you might not know

#37

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).…

Before evaluating the claims myself: The shred manual specifically claims that it is "not guaranteed to be effective" on "log-structured or journaled file systems", and specifically calls out ext3 in data=journal mode.

I would assume that the concern with ext3/4 in data=journal mode is that shred does not guarantee that the records of previous writes are evicted from the journal.

Re: Linux utils that you might not know

#38
post #22

I was really happy about tac when I found out about it, same with paste and comm as already mentioned. Gotten a lot of mileage out of the various seldom used options of uniq, diff and cut too.

tac, but also rev. I can't think of an example right now, but that's been useful as well.

Re: Linux utils that you might not know

#39
post #35
post #33

Earlier quoted context omitted.

You got the same answer from factor and Wolfram alpha; where is the bug?

wa shows 76 prime factors, which is the not same as printing out a bunch of 2's and 5's

WolframAlpha lists the factors as 2^38 * 5^38, which is just a compact notation for 38 2s and 38 5s, totalling 76 factors. If you count the 2s and 5s in the output of factor, you get the same result of 38 each for a total of 76 factors.
Post reply on HN