How to close all background apps at once in Android 5.0 (lollipop)? I noticed that I can press the square button on the bottom right to show all background apps, and then swipe from left to right with my finger to stop them manually.

But sometimes, I find that I have twenty or more apps in the background, so I want to stop them all at once.

I did a simple search on Google, but didn't find an answer.

Is it possible to do that?
As far as I know : no you can't.

TL;DR : 

Closing all background apps is a bad practice. You should close apps that you don't use often or apps you specifically want to close for X reason. IMO, the only good reason to close all recent apps is that you feel like there are too many of them and you can't find an app any more because of the mess it creates. 

-- 

The recent apps feature in Lollipop appears to behave differently from previous versions. First of all, as you noticed, the button to clear all recent apps is gone. Moreover, the recent apps persist through reboot (read on Android Police : The Recent Apps List Now Persists Through Reboot).

Now, you still can clear them by swiping all the cards, which I agree is tedious. But as the top comment on the AP post I quoted above explains :


  Clearing out all of the apps in recents just puts more work on CPU and
  thus your battery because you're essentially having to start from
  scratch the next time you load it. If something stays in your recents
  list and is in RAM, it loads instantly with virtually no battery or
  processing penalty minus refreshing the content via the network
  connection.


Basically, all the Android users (including me a while ago) who frequently clear their recent apps, use task killers, etc. are using their Android device the wrong way.

You can read more about Why you shouldn't use a task killer on Android (a post by cybervibin on XDA), which is roughly the same as killing the apps yourself. In short, unused RAM is useless RAM. If a large amount of RAM is required by an app, the system will stop recent apps by itself to provide the newly launched app the needed resources. No need to stop them yourself, it's the OS's job.

I also recommend the read of this question on Android Enthusiasts about What happens when you swipe an app out of the recent apps list.

--

To conclude, to this day and as far as I know, you can't clear your recent apps all at once on Android Lollipop 5.0. But you shouldn't have to do that anyway, which is surely why Google's teams removed the button.