36

A few of us were talking about this the other day in chat, as we are now quite a bit larger and with several thousand Q&As, there are certain questions that are asked very often. Things like redirecting output, process substitution, batch renaming of files, fixing/reinstalling grub, etc.

Let's compile a list of the best/most complete answers to such common questions here, and then we can always close new questions as duplicates of those. That way, we can have a single, canonical answer to these things which we can edit and make as good as we can and avoid having the dupes pointing at each other all over the place. The inspiration comes from this meta AU question:

Ideally, I would like to see an answer below that collects as many as possible. I will make a start but please edit to add more. As part of this initiative, we should also consider asking such questions and answering them ourselves. For example, I just read this question over on SU, having that kind of thing here seems like a very good idea (not specifically for hardware, although that would be useful, but that type of canonical question*).

So, the idea would be to hash it out here, and once we have a decent list, make a meta Q&A like the ones above, listing them. Then, we make sure to close as dupes of the canonical.

--

Please vote for the answers below, upvote them if you consider the suggested Q&A to be a good candidate for the canonical one and downvote them if you don't. Upvoting the question itself is nice but less useful.


* I made a start here: How can I replace a string in a file(s)?

  • 1
    yes That's a very good idea – Kiwy Feb 6 '14 at 11:16
  • I like the idea, and just seen the first one, Thought I'd give some feedback. Having all the answers combined into one answer makes it difficult to provide comments, vote, and contribute new sub-answers to a particular sub question. Maybe separate answers would work better ? One of the interesting (and valuable) aspects of this site is the way it allows different users to provide answers and the voting system. Since this is not actually a wiki, I'm now running out of chars in this comment, will not be able to edit in 5 mins etc. – X Tian Feb 9 '14 at 16:59
  • @XTian my idea was to have one, all encompassing answer to close duplicates with. It's a community wiki answer so I get no rep from it and upvotes just indicate that it works. Since to the best of my knowledge, all the solutions mentioned in the replace strings Q work, I'm not sure if it would be better to have multiple answers. It might, I'm just not sure. Why don't you try making a similar canonical Q&A on another subject and post multiple As? I think that's what Faheem is doing here. – terdon Feb 9 '14 at 17:02
  • Well I've had a go with this question, wanted to choose a problem that had solutions that could be based on multiple technologies. It was funny, someone posted a perl solution whilst I was adding answers. But noticed their solution is not part of the community wiki ! Any way to ensure this ? It does allow popular answers to percolate up and comments per solution. – X Tian Feb 9 '14 at 20:21
  • Cool @XTian, thanks! Don't worry about the CW, I just did that cause I didn't think it was fair to advertise my answer here and then get loads of rep from it if it becomes the canonical. Making posts CW in this context means that you're inviting people to edit them and that you politely decline the rep. If another user posts an answer, let them. – terdon Feb 9 '14 at 20:33
  • Actually, @XTian there is already a pretty good Q&A on that here (the one mentioned in my answer below). Most of the solutions you mention in your answer are already there and it is a nice, old and established post. I think it would be better to add any of your answers that are missing from it to that question instead of starting a whole new one. – terdon Feb 9 '14 at 20:43
  • Judging from your and other comments directly on the post, maybe it's not a good idea to duplicate the question again. So ' ... compile a list ..' means just that, a list of canonical questions. Stackoverflow doesn't have lists like this (afaik), so only way to achieve this is to write a new question, which is where I came in. The answers, if we could write such a question, would simply be references to popular q+a's that are already in existence and maybe it would be these links that are voted up/down. – X Tian Feb 10 '14 at 0:38
  • @XTian this particular question happens to be already answered quite well in the post I link to below. We tend to avoid creating duplicated info (that is actually the whole point of this thread). It's a shame because the Q&A you posted is indeed very good (and appreciated) but since the info already exists it seems pointless to duplicate. Perhaps you could post your answer to the other post, adding anything not already mentioned there? – terdon Feb 10 '14 at 15:16
  • ##How do I solve an APT dependency issue? unix.stackexchange.com/q/121180/4671 – Faheem Mitha Jul 16 '14 at 16:30
  • 8
    The best place to list canonical QAs is not as a mess on meta, but in the tag wiki for the relevant tag(s). – Gilles 'SO- stop being evil' Sep 4 '14 at 13:35
  • 1
    The bash tag on Stack Overflow has a tag wiki with a collection of common questions. Not all of them are "canonical" in the strict sense, but the list there works well to find a quick dupe for many common problems. – tripleee Apr 25 '17 at 7:14
  • Single-quoting vs Double-quoting: unix.stackexchange.com/questions/7574/… – Jeff Schaller Jul 27 '17 at 21:38
  • this needs a good canonical answer for why you can't change a variable in a subshell (e.g. pipe into a while loop). I have to search for one every time it gets duped. – cas Jan 18 '18 at 11:35
  • @cas do you have a suggestion? I know I've seen one but I can't find it now. – terdon Jan 18 '18 at 12:09
  • I just used this unix.stackexchange.com/questions/9954/… because of Gilles' explanation, but I know i've seen better (more comprehensive) ones, possibly also by Gilles or maybe Stéphane – cas Jan 18 '18 at 12:15

33 Answers 33

2

How can I recursively delete files/directories matching a given pattern?

Proposed canonical:

How do I recursively delete directories with wildcard?

1

How to run a script before user login on Graphical environment

How to execute command before user login on linux

You must log in to answer this question.

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