Command Line One-Liners

194 points by aphrax 2 years ago | 23 comments
  • asicsp 2 years ago
    Sorted by votes: https://www.commandlinefu.com/commands/browse/sort-by-votes

    Filter option is nice too, here's top `awk` commands: https://www.commandlinefu.com/commands/matching/awk/YXdr/sor... (expected removing duplicates to be #1 instead of #3)

    There are comments too, but some are filled with spam.

    See also:

    * http://www.compciv.org/unix-tools/

    * https://github.com/jlevy/the-art-of-command-line

    * https://github.com/learnbyexample/scripting_course#ebooks (my books on grep/sed/awk/perl/ruby/coreutils/etc - free to read online)

    • iudqnolq 2 years ago
      It's unfortunate the #2 listing is outdated (python2 vs python3)
      • asicsp 2 years ago
        Yeah, and that reminds me of stackoverflow answers for older software versions. Also, the comments have the updated command for python3.
    • pfoof 2 years ago
      Very cool but I have never seen so large spambot density per square 1em as in the comment sections
      • technick 2 years ago
        Completely agree, the spam is a turn off for the site. I assume if someone is smart enough to build a site like this, they know how to eliminate the spam but are just lazy.
        • BtM909 2 years ago
          1. What's up with that? Looks like testing bots, because most of the messages don't make sense at all.

          2. They should mitigate these bots, because ultimately it will make the website annoying to visit.

          • status200 2 years ago
            Looks like oldschool SEO farming by stuffing a bunch of reference links to their site all over the internet so the robots think that tons of people are linking to your site. Don't think it works as well anymore but still a common tactic.
            • cp1 2 years ago
              I don't think they're testing bots; many seem to be linking to external sites or advertising something.
        • mikece 2 years ago
          I can't stop laughing at the name of the website: I personally would have ended it with "foo" rather that something that can be pronounced "f you" but I'm bookmarking this one for regular reference!
          • cfiggers 2 years ago
            The word "Fu" (pronounced "foo") is a reference to "Kung Fu," a Chinese martial art. It is used colloquially in combination with other words to mean "something someone has to practice to become a skilled expert in." You might see "Google-fu," as in, "skill using search engines to find what you're looking for," or "Spreadsheet-fu," as in, "skill using Microsoft Excel or other spreadsheet programs," or similar things.

            In this case, "Command Line Fu" is meant to suggest that the command line is something you can practice to improve your skills with, analogous to a martial art. It's not meant to be pronounced "F you"—though I'm sure you're allowed to continue doing that if you find it amusing!

            • 2 years ago
            • politelemon 2 years ago
              In case anyone misses it, click the titles and you'll see alternatives.

              For example the second most popular one is to serve a directory and the alternatives show the Python3 way of doing it.

              https://www.commandlinefu.com/commands/view/71/serve-current...

              • godshatter 2 years ago
                For the simple tar command, I've read somewhere that it's best to not encode the output using the tar command itself (i.e. tar -cvf blah; zip blah instead of tar -cvzf blah), but I'm not sure what the reasoning is. Has anyone else heard this? Something to do with passing files between systems that may not the right encoding software maybe?
                • lgeorget 2 years ago
                  I think it would only makes sense if the target system on which the script may run has `zip` but not a version of `tar` supporting the `-z` option. That's certainly unlikely to ever happen.

                  There's also `tar -cvf - | zip blah.zip -` with the idea that it's a poor man's way to parallelize the `tar` and `zip` processes but I don't think it makes a real difference in recent implementations of `tar`. At least in a couple of tests I've just run, it's just as fast.

                • aka878 2 years ago
                  This is amazing, "Watch Star Wars via telnet": https://www.commandlinefu.com/commands/view/1713/watch-star-...
                  • shortrounddev 2 years ago
                    Only bash?
                    • recursive 2 years ago
                      Found some powershell too, but curiously, they seem to be all mixed together.
                      • scbrg 2 years ago
                        No, most of them work fine in vanilla sh too :-)
                      • greyman 2 years ago
                        Nice work, but I wonder if websites like this will not become obsolete soon. In most cases I can get the same result with ChatGPT, where I can also ask followup questions.
                        • s_dev 2 years ago
                          Where do you think ChatGPT gets the data to try on to produce results from a query? I suspect websites like this are part and parcel of the training data it scours the open web for.
                          • greyman 2 years ago
                            You are right. I only wanted to say, that in the pre-GPT era, such websites were more useful for the programmers as they are now.
                            • creeble 2 years ago
                              Thus the future of AI eating its own tail - when we give up on maintaining the sites that feed the AI because the AI is so good at replacing them.

                              Then AI stops learning.

                              • reyqn 2 years ago
                                This also has the advantage of being browseable. I just sorted by votes and learnt some neat new tricks.