The Linux command line sucks


  • :belt_onion:

    @boomzilla said in The Linux command line sucks:

    However, I still like using the CLI for doing stuff.

    So do I. I'm a system administrator. Let's take a hypothetical scenario. If I'm in a folder of Oracle dump files and I want to move all of the ones bigger than 2G (that don't contain PROD on their name), off the top of my head I can do a dir | where-object filesize -gt (2*1024*1024*1024) | where-object name -notcontains PROD | foreach-object { move $_ /u10/archive/ }... or I can look up what the hell combination of find parameters that is (note that my servers don't have outbound Internet access so I have to context switch to another machine for that Stack Exchange spree) and end up with a command that's much less intuitive to me and everyone else.

    I'm not arguing PowerShell is a better programming environment but that it really is a better shell day-in and day-out. YMMV, of course; switching shells is always going to take some getting used to.


  • Considered Harmful

    @dragnslcr Certainly worse than standardizing, it, though (for example Get-Help for PS).


  • ♿ (Parody)

    @heterodox said in The Linux command line sucks:

    @boomzilla said in The Linux command line sucks:

    However, I still like using the CLI for doing stuff.

    So do I. I'm a system administrator. Let's take a hypothetical scenario. If I'm in a folder of Oracle dump files and I want to move all of the ones bigger than 2G (that don't contain PROD on their name), off the top of my head I can do a dir | where-object filesize -gt (2*1024*1024*1024) | where-object name -notcontains PROD | foreach-object { move $_ /u10/archive/ }... or I can look up what the hell combination of find parameters that is (note that my servers don't have outbound Internet access so I have to context switch to another machine for that Stack Exchange spree) and end up with a command that's much less intuitive to me and everyone else.

    Eh...either way seems painful, but I don't have to do anything remotely like that.


  • Considered Harmful

    This post is deleted!

  • area_can

    I agree with what pie_flavor said!



  • @heterodox said in The Linux command line sucks:

    @boomzilla said in The Linux command line sucks:

    However, I still like using the CLI for doing stuff.

    So do I. I'm a system administrator. Let's take a hypothetical scenario. If I'm in a folder of Oracle dump files and I want to move all of the ones bigger than 2G (that don't contain PROD on their name), off the top of my head I can do a dir | where-object filesize -gt (2*1024*1024*1024) | where-object name -notcontains PROD | foreach-object { move $_ /u10/archive/ }... or I can look up what the hell combination of find parameters that is (note that my servers don't have outbound Internet access so I have to context switch to another machine for that Stack Exchange spree) and end up with a command that's much less intuitive to me and everyone else.

    I'm not arguing PowerShell is a better programming environment but that it really is a better shell day-in and day-out. YMMV, of course; switching shells is always going to take some getting used to.

    find -size +2G -not -name '*PROD*' -exec mv {} /u10/archive/ \;
    

    Ok, so PowerShell is better because you know the get-help command but man is too hard to remember?

    For the record, I did not use any internet resources to get that information.


  • :belt_onion:

    @ben_lubar said in The Linux command line sucks:

    Ok, so PowerShell is better because you know the get-help command but man is too hard to remember?
    For the record, I did not use any internet resources to get that information.

    I used bash + GNU utilities for 11 years and I still don't know these things off the top of my head. Maybe others do. That's why I said YMMV.

    But I find with PowerShell it's easier to remember how things work (I didn't use Get-Help for the above, I'm on mobile) because everything's built in the platform. It doesn't shell out to diff for comparison, to sed for regex replacement, etc. It's all in the platform which means everything works the same way. All cmdlets take parameters in the same way. They all escape parameters in the same way (I don't miss having to run sed over and over to see if I needed four or five backslashes in my shell script). They all do error handling in the same way.

    The "UNIX way" says it should shell out to external utilities but the fact that it doesn't makes it much easier to use. For me. In case that qualifier wasn't clear.



  • @heterodox said in The Linux command line sucks:

    and I still don't know these things off the top of my head

    You only have to remember one word: man

    Then your computer will mansplain what you want to know.


  • area_can

    @ben_lubar how did you find the not flag? I tried looking for invert, inverse, opposite and couldn't find it in the man pages. For reference:

    find's manpage (line 1064/1500):

    0_1516577992763_Screenshot from 2018-01-21 18-39-48.png

    grep (line 64/650):

    0_1516578013562_Screenshot from 2018-01-21 18-39-01.png



  • @bb36e it's in the section with all the other operators:

    0_1516578188637_a4d0481c-e479-4ae1-be42-175bb2ed0e24-image.png

    Or you could check the examples section:

    0_1516578322499_522056e0-26c2-4984-a4ed-995e46df5233-image.png

    Examples:

    0_1516578346511_a2283a54-27b8-4bcf-be44-2a0ba5d673cb-image.png

    0_1516578436336_04f14202-784f-4296-9ff2-c8cf372206dd-image.png

    0_1516578376183_8230fcfc-64d3-483a-a997-101dfe5d0e93-image.png


  • area_can

    @ben_lubar said in The Linux command line sucks:

    For the record, I did not use any internet resources to get that information.

    to be fair, I think scrolling through manpages would be faster than searching the web in Ben's case.


  • :belt_onion:

    @ben_lubar said in The Linux command line sucks:

    You only have to remember one word: man

    I literally just got done explaining I didn't have to use man's equivalent in PowerShell (which, incidentally is also aliased to man). Why would I want to use one command when I could use no commands?


  • Banned

    @ben_lubar said in The Linux command line sucks:

    @gąska said in The Linux command line sucks:

    @dkf said in The Linux command line sucks:

    a quick cheap-ass CLI can be knocked out in a few minutes and lets you get on with being productive actually testing the real code in question.

    So does GUI. It's 2018 for fuck's sake, every GUI framework has a GUI editor for GUIs that lets you put together a bunch of buttons and textbox about as fast as it takes to write CLI argument parser.

    Ok, but how fast can you write a script to interact with that GUI?

    If you want automated test, make automated test. A simple int main(){assert(EverythingIsOk());} is much much faster than either GUI or CLI.


  • ♿ (Parody)

    @heterodox said in The Linux command line sucks:

    @ben_lubar said in The Linux command line sucks:

    You only have to remember one word: man

    I literally just got done explaining I didn't have to use man's equivalent in PowerShell (which, incidentally is also aliased to man). Why would I want to use one command when I could use no commands?

    Omnipotence is certainly preferable to a mortal existence.


  • area_can

    year of the linux desktop:

    0_1516595484708_52ea6157-ffc1-40f5-9586-cc63aa4d0319-image.png

    this person is being serious. they said they just copy everything over LAN when they need to share files between computers..


  • :belt_onion:

    @bb36e said in The Linux command line sucks:

    they said they just copy everything over LAN when they need to share files between computers..

    That... doesn't seem that unusual. I can't remember the last time I used USB media to transfer files vs. installing an OS. Most people copy files over the network, copy to/from the cloud...


  • area_can

    @heterodox I guess i'm a luddite. I keep a portable HDD around for stuff that I want to work on with my laptop and copy over to my desktop later. That and movies. Gotta have my emoji movie rips.

    To be fair the WiFi at my house was always shitty so idk


  • :belt_onion:

    @bb36e said in The Linux command line sucks:

    Gotta have my emoji movie rips.

    D:

    @bb36e said in The Linux command line sucks:

    To be fair the WiFi at my house was always shitty so idk

    Could be it too. With good WiFi even streaming movies in HD from a NAS is no problem.


  • Java Dev

    @heterodox said in The Linux command line sucks:

    They all escape parameters in the same way (I don't miss having to run sed over and over to see if I needed four or five backslashes in my shell script)

    Escaping in general is a shell thing not a tool thing. The problem is when you're dealing with regular expressions and literally every single gnu tool accepting regexes uses a different list of which symbols are magic when escaped and which are magic when not escaped.


  • Considered Harmful

    @pleegwat Right. So much simpler when your variables are just of type Regex, and the parser thus becomes universal.



  • @lb_ said in The Linux command line sucks:

    @dkf yeah but the brainworm is still everywhere. Try using ffmpeg's tee muxer to output to two files where one has a single quote in the name and let me know how that goes. Doesn't matter what shell you're using or how you launch ffmpeg, you have to escape various characters that the tee muxer cares about. The documentation even talks about double escaping. I have no idea how anyone thought this was an acceptable user interface.

    Similarly, if you have any files with square brackets in their names, good luck dealing with them in any capacity in CMake.

    The filesystem should never have allowed these characters.



  • @ben_lubar said in The Linux command line sucks:

    @heterodox said in The Linux command line sucks:

    and I still don't know these things off the top of my head

    You only have to remember one word: man

    Then your computer will mansplain what you want to know.

    INB4 someone will make a joke pull request changing it's name, arguing that it's not politically correct


  • Considered Harmful

    @sockpuppet7 Adam's first steps.mp4 is a perfectly good file name. If Linux can't handle that, then the file system is shit too.



  • @pie_flavor windows blocks all ascii control characters, \0, \, /, :, *, ?, ", <, >, and |. I think the Linux CLI would be a lot better if it did the same. IMO we should block the single quote too, easier quoting in the CLI trumps using it on file names.


  • Considered Harmful

    @sockpuppet7 said in The Linux command line sucks:

    easier quoting in the CLI trumps using it on file names.

    The quoting is the CLI's problem, not the name's. You would never have this problem in, say, Powershell. Meanwhile, no.


  • ♿ (Parody)

    @pie_flavor said in The Linux command line sucks:

    @sockpuppet7 Adam's first steps.mp4 is a perfectly good file name. If Linux can't handle that, then the file system is shit too.

    THAT'S NOT THE FILESYSTEM THAT'S DOM

    Oops, sorry, wrong rant subject.



  • @pie_flavor how would you do "type filename", if filename contained all those blocked characters I mentioned before?


  • kills Dumbledore

    Relevant



  • @jaloopa Following one of the answers to your link led me to something that made any CLI look good:

    To use the original dsw, you would set the front panel switches to a number and run dsw, which would then read that number of entries from the current directory, print on the terminal the name of the last one it had read, and crash itself, leaving a core dump. You could then, if you wanted, remove the file it had named by reexecuting the core file.

    Source:

    http://www.tldp.org/LDP/LG/issue49/fischer.html



  • @jaloopa said in The Linux command line sucks:

    Relevant

    Whatever you do, for God's sake, do not put -delete before -inum.

    That's Linux command line for you. Put the parameters in the wrong order, and instead of deleting the file it wipes your drive and leaves a six-horned beast of the nether in its wake for you to deal with.



  • @dkf said in The Linux command line sucks:

    That's why you don't write significant programs in shell if you can help it. Fortunately, almost everyone's learned that already.

    Indeed. Relatively simple Shell Scripts can be used to invoke extremely complex operations vie the CLI interface to the appropriate programs.

    As an example, a basic script to invoke a C++ compiler (language chosen pseudo randomly) - not a problem. Writing a C++ compiler as a shell script - nightmare is an understatement.



  • @sockpuppet7 said in The Linux command line sucks:

    The filesystem should never have allowed these characters.

    All characters should be allowed in filenames, including null and non-existant unicode characters. The mistake was making paths strings and using a directory separator. Google Drive already supports the kind of interface I desire, there's no limitations on file or folder names and you can even have multiple items with the same name. It just works. And you can script it with Google Apps Script.


  • Fake News

    @lb_ said in The Linux command line sucks:

    @sockpuppet7 said in The Linux command line sucks:

    The filesystem should never have allowed these characters.

    All characters should be allowed in filenames, including null and non-existant unicode characters. The mistake was making paths strings and using a directory separator. Google Drive already supports the kind of interface I desire, there's no limitations on file or folder names and you can even have multiple items with the same name. It just works. And you can script it with Google Apps Script.

    The Bad Ideas thread is :arrows:

    What reason would you have to allow non-printable characters and especially the null character?



  • @bb36e said in The Linux command line sucks:

    Look up 'golang generics Canadian Aboriginal Syllabics'.

    Is this actually implemented anywhere or is it just a weird naming in one guy's experimental code?



  • @anonymous234 said in The Linux command line sucks:

    […] it was never designed. It just kind "happened" over time. So it's completely inconsistent.

    So did most GUIs. And APIs. And any other kinds of interfaces to computers.



  • @bb36e said in The Linux command line sucks:

    The command line (bash, zsh, fish,...) sucks for regular everyday use because:

    On the other hand the Windows command line

    • one wrong keypress/character breaks everything
    • check
    • each application has its own interface (gnu vs BSD args), --foo vs -foo, dd's decision to use if and of, parameters that are literally one key away from each other on a QWERTY keyboard
    • check, and much more, because there is also / and the fact some commands handle wildcards, while others don't and some handle quotes differently…
    • only method of discovery is manpages/foo --help (--help is not a recognized option: use foo -h)
    • only method of discovery is digging through obscure internet fora.
    • the fact that everything has to be typed led to everything being optimized for speed of entry instead of consistency and ease of use (c.f. tmpnam umount ls's manpage ls -abcdefghijABCDEFGHIJ01234)*
    • everything has to be typed in whatever arbitrary way given author was feeling like. Some use one-letter options, some use long ones, sometimes options go before arguments (most cmd subcommands), sometimes after arguments (net use) and sometimes a very specific order is required (devenv.com), for some a quoted argument has special meaning (start)…

    Also:

    • The return value (%errorlevel%) means different things for different command (for robocopy, status 0–3 is generally success)
    • The output is totally arbitrary, so most commands are totally useless for automation anyway.

    Well, they've added the powershell. It attempts to fix the problems except:

    • The commands are not all that more consistent.
    • There are zillions of them, so finding what you need is pain and
    • It tries to DWIM, but the net result is it is write-only in a way Perl only ever dreamed of.

    Do you agree? Discuss.

    Yes. Nobody managed to come up with anything wouldn't suck yet though.



  • @bb36e said in The Linux command line sucks:

    @boomzilla what's wrong with powershell?

    Even colleagues who do know it quite well admit that it is effectively write-only in a way that Perl only ever dreamed of. It tries to do what you mean, but then when you need to understand what it actually does, it gets pretty hard to actually understand.

    @boomzilla said in The Linux command line sucks:

    I think the "NOT EVERYTHING IS A STRING" is another one of those things that isn't as big a deal as it's always made out to be

    There is one huge advantage to the everything is a string approach. You can look at the output and just beat it into the shape you need. With a bit of experience with sed it becomes a piece of cake and while the result is dirty, it gets the job done and gets it done quickly. Objects are great as long as they fit, but in practice you'll always need to glue together bits written by different authors that don't just fit together all that well and then it becomes harder with objects.


  • Discourse touched me in a no-no place

    @pie_flavor said in The Linux command line sucks:

    Adam's first steps.mp4 is a perfectly good file name. If Linux can't handle that, then the file system is shit too.

    WOMM

    bash-4.4$ touch "Adam's first steps.mp4"
    bash-4.4$ ls
    Adam's first steps.mp4
    bash-4.4$ file Adam\'s\ first\ steps.mp4 
    Adam's first steps.mp4: empty
    

    Yes, I did autocomplete to get the filename in the third case. Because I'm worth it very lazy


  • area_can

    @bulb said in The Linux command line sucks:

    On the other hand the Windows command line

    I dunno anything about Windows, so I focused on linux but sure, they both are hot garbage.


  • area_can

    @lb_ said in The Linux command line sucks:

    All characters should be allowed in filenames

    +1 for linux/ext4:

    0_1516634445796_186ff583-049d-4c8f-8f3e-90b35b900b51-image.png


  • BINNED

    @bb36e said in The Linux command line sucks:

    +1

    or -1 it just depends on your way of looking at it



  • The biggest conceptual issue I have with any command line is discoverability. If you don't know that a command exists, there is no way you can guess its name -- or rather, it is unlikely you can guess it, and in the case of Linux ones, it's impossible because of the stupid naming convention (read: the absence of...).

    Given that the goal of shells is, for me at least, to accomplish small one-off tasks, most commands are going to be used only once in a while and therefore I will very quickly forget their very existence. It's a bit like doing small DIY tasks, but instead of being able to look into your toolbox, you must name the tool. "OK, now I need a pair of pliers, but the kind that is slightly angled at the end, and not too big, but slightly larger than tweezers. I know it's in there, but I do not know its exact name. So I can't use it. So instead I will use a screwdriver, an Allen key and a magnet. See, command line is great, you can do whatever you want!"


  • Java Dev

    @remi said in The Linux command line sucks:

    So instead I will use a screwdriver, an Allen key and a magnet.

    How does that work.



  • @pleegwat Badly, and with a lot of swearing, like most DIY tasks without the right tools.



  • @remi said in The Linux command line sucks:

    If you don't know that a command exists

    ... RTFM


  • Java Dev

    @thecpuwizard said in The Linux command line sucks:

    @remi said in The Linux command line sucks:

    If you don't know that a command exists

    ... RTFM

    $ man tweezers
    No manual entry for tweezers
    


  • @thecpuwizard Is that serious, or a joke? 'cause you know, I'd love to know how the FM would help me finding the name of a command for which I have a vague idea of what it does, but none of the name. Or worse, to find that there is a command that does what I'm thinking of in the first place!

    Do you have a manual that lists all hundreds of commands that can be used in a shell, and presented in such a way that I can actually find information before knowing exactly where it is beforehand?

    For example: I want to run a command and see its output on the command line at the same time that I write it to a file. How can I ever find that what I want is a command named tee? Or that there is such a command in the first place?



  • @pleegwat -

    tom@muon:~$ hammer
    hammer: command not found
    tom@muon:~$ wrench
    wrench: command not found
    tom@muon:~$ screwdriver
    screwdriver: command not found
    tom@muon:~$ tweezers
    tweezers: command not found
    Obviously your system administrator doesn't trust you using such powerful tools and has removed access to them for your account. :)


  • Java Dev

    @remi I'd point you to apropos, but probably the first search string I'd think of is apropos copy, which returns 570 results, not including tee.

    apropos duplicate works, but who'd think of that?



  • @pleegwat said in The Linux command line sucks:

    @remi said in The Linux command line sucks:

    So instead I will use a screwdriver, an Allen key and a magnet.

    How does that work.

    :juggalo-magnets.jpg:


Log in to reply