31

I often find a Stack Overflow question that's just about how to use some Unix command, like how a complicated ls | grep | sort is really just how to properly use a combination of the 324 ls command line options.

So where is the line that indicates when a question should be migrated to Unix & Linux?

Writing Awk and Perl scripts is obviously programming. But one line sed commands? Crontabs? Systemd unit files?

8
  • 16
    imho if they're writing a script, which means they're piping outputs between commands, it's on topic. Asking about a specific command, not. But lots of folks disagree on that second part :/
    – user1228
    Commented Apr 18, 2018 at 18:27
  • 8
    When it's not in the man pages or immediately Googleable? Commented Apr 18, 2018 at 19:37
  • 1
    Ask what they want to achieve instead, that usually tells you how much effort is really needed.
    – Braiam
    Commented Apr 18, 2018 at 19:46
  • 1
    This is bash programming. Command lines are mean to be used as part of bash scripts. This has to stay here.
    – NVRM
    Commented Apr 19, 2018 at 2:18
  • In the same light, most regex questions are just asking about how to properly use a combination of the regex rules.
    – MonkeyZeus
    Commented Apr 20, 2018 at 15:51
  • Anyways, simplistic ls | grep | sort questions will get flogged hard at Unix & Linux.
    – MonkeyZeus
    Commented Apr 20, 2018 at 15:52
  • It's Unix arcane shell magic, so everything. :p
    – Ian Kemp
    Commented Apr 30, 2018 at 6:41

4 Answers 4

17

There's no complexity requirement. Any command that can be typed into the shell might also be incorporated into a script, and therefore, it's a programming question. Furthermore, since the command prompt is the runtime by which these scripts are executed, even features dedicated to interactive use are allowable since the tool is a software tool commonly used by programmers for their programming tasks. This means we have significant overlap with Super User, Server Fault, and Unix and Linux. Askers can choose their audience, and that choice will probably result in a different emphasis on different aspects of the problems and their solutions. That's fine and not a problem.

Obviously, the normal rules about sufficient research and question quality still apply. So poorly researched questions with trivial answers can be downvoted, and others can be closed as Too Broad, Unclear, etc. if they aren't answerable.

Here are a couple more in depth discussions of the principle:

(Those are my answers, if you're wondering before you click.)

I'll also add specifically that crontab and systemd clearly fall under "tools commonly used by programmers," as it's often necessary to work with these tools to deploy a program and make it accomplish the task it was designed to do.

11
  • 1
    It's untrue that any command that can be interactively entered can be used in a script, or at least, only true under a limited set of conditions. History expansion is turned off by default in scripts. All extensions marked as "User Portability" in the POSIX spec (most notably aliases) are only applicable to shells intended for interactive use, and are not present, or off-by-default in noninterative mode when they are present, in POSIX-baseline noninteractive interpreters. Etc. Commented Apr 21, 2018 at 20:35
  • 1
    Moreover, questions about prompt colors &c. are by their very nature questions strictly about interactive use. Commented Apr 21, 2018 at 20:36
  • @CharlesDuffy One could make the same argument about Python's REPL, but these are still tools commonly used by programmers.
    – jpmc26
    Commented Apr 25, 2018 at 22:52
  • 1
    Python's REPL is exclusively used by programmers, which is what the "unique to software development" language at stackoverflow.com/help/on-topic requires. POSIX-y interactive shells, by contrast, are widely used by operations staff and end users; they have a large non-developer audience. Commented Apr 25, 2018 at 22:53
  • @CharlesDuffy No, it isn't. It can be used by anyone who wants to run a quick snippet. I bet you money that data scientists fire it up to leverage numpy and pandas at times, without any intention of ever scripting the process. Furthermore, "exclusively used by programmers" is clearly not a requirement for being on topic. I edited in a sentence about it, anyway.
    – jpmc26
    Commented Apr 25, 2018 at 22:55
  • 1
    "Exclusively used by programmers" was my own wording, but "unique to software development" is a direct pull from an AND condition in stackoverflow.com/help/on-topic. Commented Apr 25, 2018 at 22:57
  • @CharlesDuffy By that logic, git is off-topic.
    – jpmc26
    Commented Apr 25, 2018 at 22:58
  • git is a tool developed with software development as its sole intended purpose and primary audience today; it's still on-topic even with the strict reading. Commented Apr 25, 2018 at 22:58
  • @CharlesDuffy I've discussed "unique to software development" in detail here.
    – jpmc26
    Commented Apr 25, 2018 at 22:59
  • 2
    BTW -- I handle a lot of bash questions here, and the thing that gets me about ls | grep | sort type questions is that they're generally asked, and answers selected, without any kind of regard to either robustness in the face of unusual inputs, compliance with best practices, or other goals besides terseness. Having a bunch of acknowledged bad practice code snippets floating around in a resource also used by people (hopefully) doing serious development is harmful to the quality of the site as a whole, or at least the larger tag. Commented Apr 25, 2018 at 23:04
  • @CharlesDuffy I have similar complaints about Python questions. The problem is not unique to command line tools, and it's probably not unique to SO. It is a global problem with how people approach question asking and answering.
    – jpmc26
    Commented Apr 25, 2018 at 23:06
6

As always, context matters. If you want to know how to start a service in a system that uses systemd, other than being already repeated through the entire internet, is not a issue that you only have in the context of software development. How to start a service when you install a package in your favorite distro otherwise is acceptable on SO, since it's in the context of software development, since you are crafting a package using the helper/tools given by the package manager to start the service.

In general, if you see a question about something that you expect an end user, not involved in any way in software development, to do, it's very likely that is off topic for Stack Overflow.

3
  • 3
    that last sentence is a pretty clever way to describe our scope.
    – rene
    Commented Apr 21, 2018 at 18:55
  • I don't expect users who know nothing about software development to be working in bash or any other command prompt. Does that mean everything about it is on topic?
    – jpmc26
    Commented Aug 2, 2018 at 0:17
  • @jpmc26 "only have in the context of software development"
    – Braiam
    Commented Aug 2, 2018 at 0:22
4

I disagree with the answer claiming that any usage of a command-line shell is programming. If interactive use of a shell is equal to (basic) scripting, then that indicates that simple scripts are not programming either, any more than a macro recording is.

Shell programming uses the programming aspects of the shell. At least one of:

  1. control flow
  2. functions
  3. variable expansion

Basically, the things that make bash Turing-complete.

2
  • Your answer would make this question off topic, even though it's clearly relevant to programming.
    – jpmc26
    Commented May 8, 2018 at 0:28
  • 2
    @jpmc26: That question is off-topic. It also predates the sites where it would best fit today.
    – Ben Voigt
    Commented May 8, 2018 at 0:40
-2

Hmmm. That's actually a good question as the Unix shell was in a way designed to blur the distinction.

I recommend the following: when it's being parameterized for saving into a (potentially one-line) script. I can't comment on systemd unit files, but crontab can theoretically qualify as you have to start really thinking about failure modes and partial completion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .