Live data from Hacker News

Linux utils that you might not know

shiroyasha.io

71–80 of 159 posts

Re: Linux utils that you might not know

#73

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

In both the ‘data=ordered’ (default) and ‘data=writeback’ modes, ‘shred’ works as usual.

Source: https://www.gnu.org/software/coreutils/manual/html_node/shre...

Re: Linux utils that you might not know

#75
post #72

My favorite: basename Returns just the filename plus extensions e.g. basename a/b/c/d/foo.php returns foo.php Very useful for shell scripting.

It can also strip off a given suffix, if it appears:

    $ basename a/b/c/d/foo.php .php
    foo
The complement to basename is dirname:

    $ dirname a/b/c/d/foo.php
    a/b/c/d

Re: Linux utils that you might not know

#76
post #68

Just look at anything in the "moreutils" package. Just great stuff. Excerpt: - ifdata: do not parse the output of ifconfig/ip anymore. Just use this tool. - sponge: when you need to overwrite an input file at the end of pipe. sponge will wait for the pipe to end before overwriting, preventing any data loss - vidir: edit a given dir with your EDITOR. Awesome for mass renames/deletes. - ts: add timestamps to a command…

Although these tools are great, I'm afraid these are of limited use, as these aren't preinstalled but must be explicitly installed.

For personal use these are great. But if you write a shell script to be executed on different machines where you can't install anything, these tools won't be available to you.

And if you don't have that requirement, i.e. you can install everything, just install appropriate Perl/Python/Ruby libraries and use a proper scripting language.

(BTW, I tend to assume that Python is installed on almost all modern Unix systems by default, hence I prefer writing portable tools in Python instead of portable Shell code.)

Re: Linux utils that you might not know

#78
post #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.

No post body was provided.

Re: Linux utils that you might not know

#80
post #44

Don't forget the often overlooked "apropos"!

My problem with apropos (and man, for that matter) is related to how at least one major distribution handles the man pages. Rather than bundling the man pages with the applications, the man pages for many applications are bundled together in one base package. When this is done regardless of whether or not the application is actually on the system, apropos and man continually return information on applications which are not on the system.
Post reply on HN