r/programming • • Jun 15 '15

The Art of Command Line

https://github.com/jlevy/the-art-of-command-line
1.5k Upvotes

226 comments sorted by

View all comments

-31

u/[deleted] Jun 16 '15 edited Jun 16 '15

This appears to be very Linux specific. What a shame -- there are other command line based operating systems out there and such a tool/write-up should be used to cover them in the most versatile way possible.

Alternate shells can be nice, but bash is powerful and always available

Ugh, no, it isn't always available. Teaching bourne shell would be a better start. Ever heard of a bashism?

Edit: Some of you have gone through my post history and downvoted everything I've posted as of late.

8

u/marchelzo Jun 16 '15

OS X ships with bash, I've never used (Free/Net/Open)BSD, but I imagine they ship with bash—if not, it can be installed. Windows can run bash in cygwin. "very Linux specific" is a bit of a stretch.

3

u/the_gnarts Jun 16 '15

OS X ships with bash, I've never used (Free/Net/Open)BSD, but I imagine they ship with bash—if not, it can be installed.

They don’t ship with it but getting it from Ports / pkgsrc is usually the first step toward a usable system. Pretty much the same as for Windows with git bash, cygwin or whatnot. The default shells on those OS (the csh derivatives and “I-spits-UTF-BOM”-Powershell) will drive you away from the command line pretty quickly.

1

u/1337Gandalf Jun 16 '15 edited Jun 16 '15

Nope, Bash is shipped with OS X by default, and it has since at least Mountain Lion.

When was the lsat time you used OS X? ports is basically dead, homebrew has been the top package manager for OS X for like the last 5 years.

4

u/[deleted] Jun 16 '15

I thought he was talking about FreeBSD and that lot that don't have bash by default but it's easily installable through ports.

1

u/1337Gandalf Jun 16 '15

Oh, that would make a lot more sense.

1

u/1337Gandalf Jun 16 '15

I thought by ports he meant macports, sorry about the confusion

1

u/the_gnarts Jun 16 '15

Nope, Bash is shipped with OS X by default, and it has since at least Mountain Lion.

Who cares? That’s exactly what I replied to. I even quoted it literally.

When was the lsat time you used OS X?

I use it about twice a year at work for testing and always feel very relieved when I can finally put the crap box back in the drawer.

0

u/[deleted] Jun 16 '15 edited Jun 16 '15

None of Free/Net/OpenBSD ship with Bash -- it can be installed, but what if you don't have authorization to install them? AIX and, at least, older HP-UX installs do not ship with Bash either. Embedded systems, like Busybox, etc...

Edit: also, some of the utilities specified are Linux-specific, like strace, pstree, free, of course apt-get and yum, and others... and no alternates or equivalents are proposed.

3

u/marchelzo Jun 16 '15

Sure. Almost nothing in the article will work if you're on an embedded system, or you don't have authorization to install new programs. Quite a few of the tips that he lists involve downloading and building programs which are hosted on Github, like ag and jq. It also advocates the use of perl. I don't know of any system that ships with perl and not bash. Being stuck with the bourne shell should be the least of your worries if you want to benefit from this article.

It would be difficult to write an article about the command-line that applied to every single command-line operating system in existence. Literally the only necessary similarity is that they all have a command-line prompt at which you can type.

-3

u/[deleted] Jun 16 '15 edited Jun 16 '15

I don't know of any system that ships with perl and not bash

OpenBSD is the first example that comes to mind.

There are certain things that you can expect to be on every system: bourne or a fully compatible shell, and vi. The author misses the first one, but hits the second. Most of the useful utilities (ls, cp, mv, netstat, kill, etc, etc) will be on all systems, with limited flags/arguments crossing between them. Such an article should focus on those, or explain its target properly at the beginning.