7 ms·
This reminds me of an old joke I heard a while back, which is that the opposite of "it's like riding a bike" is "it's like the UNIX command line". No matter ho
by hcks 4y ago
This reminds me of an old joke I heard a while back, which is that the opposite of "it's like riding a bike" is "it's like the UNIX command line".
No matter how many times you do it, you will have to re-learn it every single time.
- shadow28 4y ago"It's like regex" could be another punchline for the joke
- bcrosby95 4y agoMy biggest problem with regex is each language/program/whatever has their own take on it. You don't have to learn it over and over, you have to learn multiple slightly different versions of it over and over.
- Banana699 4y agoI don't mind the slightly different versions, that's what documentation and SO is for. I mind the language being a garbage kludge of organically-grown syntax and semantics, with not the slightest hint of a single principle or a unifying idea. And I mind that the vast majority of interfaces to it from a general purpose PL is fucking around with strings like a caveman, instead of a typed, IDE-assisted, first-class representation as a full-blown language construct or mix of constructs
- cestith 4y agoFrom this description, you may enjoy Raku.
- deckard1 4y agobeen recently learning Python in earnest. Coming from Perl, Ruby, PHP, JavaScript, etc. I'm just dumbfounded. How on earth did Python's regex library get to be so bad? It's like it was designed by people that were figuring out how regexes worked as they went along but must have skipped the part about modifiers, how anchoring works, etc. No wonder so many people hate regexes. The ironic part is Python's "one obvious way to do it" zen thing. It has like 5 different ways to do the same thing with a regex whereas Perl, the "more than one way to do it" camp has simple and obvious ways to do everything with regex. I love regex in Perl. In Python I don't want to touch it ever again. Even JavaScript is miles better.
- hvs 4y agoI agree. I actually have a pretty strong understanding of regexes and use them regularly (for editing, not so much in code), but I despise how every editor/language does them subtly different.
- jpitz 4y agoTruly relevant XKCD https://xkcd.com/1168/ https://xkcd.com/1168/
- avg_dev 4y agoI’ve never understood that one. I realize it’s just a joke, but xvf/cfv (extract/compress, view, uh,. Ok I did have to look up f, which I think is file) and the z for gzip is one of the few commands I have no trouble remembering.
- Izkata 4y agoThough if you include the dash to use those as flags, the second one is wrong (it treats the "v" as the file name for "f"). Without the dash, the next positional argument is the file name. Examples: These do the same thing: tar cfv foo.tar a b c tar cvf foo.tar a b c tar -cvf foo.tar a b c This errors, trying to add foo.tar to archive v: tar -cfv foo.tar a b c
- metadat 4y agoCorrect, it's -cvf.
- joemi 4y agoEven easier: tar --help
- vxNsr 4y agoThis is why imo powershell (when done right) is more powerful than bash (no matter how correctly it’s done). Powershell cmdlet names are descriptive and generally make sense as do the parameter names, additionally the guidelines for how to make powershell commands forces a certain style that once you grok it makes sense for most powershell commands. If bash has something like that I’m still missing it. Obviously the brevity of bash can be its own power.
- okasaki 4y agoThe brevity is great when used interactively. For scripting you can always use Python, which is lightyears ahead of PS.
- avg_dev 4y agoI do feel like we are all a little beholden to bash and it is tiring. While I will put simple work into simple bash scripts I always use shellcheck and do ‘set -euo pipefail’. For the life of me I can’t remember what that is or why I need it, I just know that I do. (I’d be comfortable looking it up if I actually cared enough to.) Anything more than trivial I do in a high level programming language like Go (previously I would use Ruby or Perl). From everything I’ve seen PS is a nice direction to go in. I wish there was a sudden upheaval and everybody used a shell that wasn’t so legacy-cruft-laden.
- Tijdreiziger 4y agoPowerShell’s learning curve was too steep for me (or maybe I didn’t try hard enough, idk). I used it for a couple of years, but once WSL turned up I went back to my trusty old Linux skills.
- icambron 4y agoI use the `ln` command a lot. I use the `man ln` command _almost_ as much.
- kortilla 4y ago“Same argument order as cp” always helped me.
- lifthrasiir 4y agoI learned to behave as if there is no second argument for ln. Instead of doing `ln -s path/to/foo bar` I do `ln -s path/to/foo` then `mv foo bar`. Of course it doesn't always work, but covers most use cases for me.
- a-dub 4y agoi've always considered manpages to be sort of part of the unix command line experience. since they're fast, it's no matter. but yea, it took me many years to wire down ln's target link_name semantics for some reason. what helped for me was to reason about the single argument form. ln -s ~/opt/junk/bin/thinger creates a link to thinger in the current directory. this single argument form is easy to remember, if you want to create a link of course you have to specify the name of the target (from which the link name will be inferred) and since it's the only argument it has to be the first one. now if you want to give it a different name, put the name in obvious still open place, the second argument.
- rustyminnow 4y agoFunny, I always reason about the 3+ argument form... For example, what does ln -s foo bar baz do? Well it can't create a foo symlink that points to bar AND baz, but it could create multiple symlinks - bar and baz - that point to the file foo. Therefore the first arg is the file you want to point to, and the rest of the arguments are symlinks you want to create (of which there happens to usually only be one). Edit: this line of reasoning works for common usage of a lot of other utils too, like zip/tar etc. Even grep - is it grep FILE PATTERN [PATTERN ...] or grep PATTERN FILE [FILE ...] ?
- 4y ago
- hinkley 4y agoI get a little offended by people who think stackoverflow is a character flaw. I go there because it will tell me things like if you get the arguments to ‘dd’ wrong you’ll zero out the drive you were trying to back up. That the function breaks if you pass in null for the second parameter. Or that it simply doesn’t work properly.
- alex_smart 4y agoI think that using dd is a character flaw.
- davegauer 4y agoTo expand on this, people needlessly cargo-cult arcane dd commands, but on many (most?) systems, "cp foo.iso /dev/sdb" will do the same thing, but with possibly even better performance!
- hinkley 4y agoThat’s a restore not a backup. I’m not actually defending dd. It’s bonkers how long it was considered acceptable to offer that as a solution for anything except zeroing out a disk. I shed a single proverbial tear and contemplated the sad state of technology every time I used it, and felt dirty for having done so. It is The Worst. It’s just the most egregious example. The difference in excess argument processing between commands is rather broad example. Is the last arg special or the first one? Grep and tar are in the majority, but cp works differently. They only make sense if you think of the power user.
- alex_smart 4y agoWhat I meant was that using dd to take format/backup disks is just way too dangerous for human beings. The prospect of losing your precious data even once in your lifetime is too expensive a cost for the questionable benefit of feeling cool about doing backups by running a command on the terminal. Just use a gui tool for writing to physical disks. The additional visual feedback that a gui can provide is absolutely essential for human beings performing such a dangerous operation.
- MobiusHorizons 4y agoI think what a lot of people don’t get about the Unix command line is that learning to use the tool is part of the experience. Sure I forget the precise flags to get various tools doing what I need, but browsing the man page and rediscovering the breadth of the tool is half the beauty.
- jahewson 4y agoWhat? That’s some intense Stockholm syndrome right there.
- a-dub 4y agonah. learning unix was fun. having all the documentation online and in an easily called up and consistent format made it possible. microcomputer operating systems didn't have things like "man -k" and while we can complain all day here till we're blue in the face about small quirks, it was light-years beyond the crap that was going on in microcomputer operating systems. even when doing windows or embedded development with tools like visual studio or wrs tornado, i've always insisted on having mkl or cygwin for command line tasks.
- cpach 4y agoHow so? I remember the times before I learned Bash and the Unix userland. Those where dark times. I was stuck on Windows 98, which I really didn’t like. It just felt so needlessly crippled. When I discovered Bash, Debian, the Unix way, it felt like a breath of fresh air. These days I’m on macOS. And one of the best things about it is that it’s a great desktop operating system, with a Unix under the hood. The userland Apple ships is quite dated, but that’s easily solvable by installing GNU Coreutils etc via Homebrew.
- hvs 4y agoThe only feeling I've gotten looking at a man page is, "well, I don't have to time to dig through all of this. Guess I'll just look at stack overflow which will have my exact use case and required parameters."
- 4y ago
- jakey_bakey 4y agoReminds me of a peeve I had with the Apple docs when they described Bash like riding a bike (but in a different metaphor - it's good to get around somewhere easily but won't take you as far as an application language)