Okay, all one needs to do is "pair" the controller just like any other bluetooth device - these instructions relate to the "regular" variant of Ubuntu, so adjust them accordingly if you use a different variant of Ubuntu or a different Linux-based operating system...
- Hold the and
Share buttons to put the controller into "pairing" mode (the Light Bar/LED should start to rapidly blink/flash), then pair the controller with the computer using the bluetooth settings (Settings → Bluetooth → Wireless Controller).
Once the controller is "paired", you can turn it on by pressing (not holding!) the button - do this before starting Steam or a game, because sometimes they may not recognize the controller if you do this after opening Steam or a game.
Ubuntu 20.04 LTS ("Focal Fossa") and newer has pseudo-official support for the DUALSHOCK 4 (it correctly recognizes the DUALSHOCK 4 as a gaming controller) and Valve Software's Steam has native/official support... Ubuntu doesn't offer anything in the way of configuration for controllers at the time of writing, but Steam has a default setup available or you can configure the controller to your individual liking - to do this, go into "Big Picture Mode" and adjust the "Controller" settings.
A few points about what I have noticed however...
- Steam has surprisingly good support for the DUALSHOCK 4, and even many older games seem to work well enough... Numerous games available outside of Steam also seem to work well (such as those from GOG.com) - but it varies from game-to-game, so you'll need to experiment yourself.
- If you're using "Big Picture Mode" and you have connected your
controller in Steam, it will show a "controller" icon for games
which support the DUALSHOCK 4 (refer to "Tomb Raider" in the picture below).
- Steam will "work its magic" to get the DUALSHOCK 4 working as
expected in most games (e.g. for
"select"/"accept"/"enter" and for
"cancel"/"decline"/"back"), however some games will still show
Microsoft Xbox series icons, which may lead to some minor confusion.
- Some games (including numerous older games) support force-feedback
(vibration), though this varies and you may need to enable this
functionality within the game itself.
- Support for the "fancy" functionality of the DUALSHOCK 4 - such as
accelerometer control and the touchpad - may not work in part or at
all... I found a couple of games in Steam that supported the
accelerometer (older games, too!), but support seems to be pretty
mixed from game-to-game.
- You can check the battery status in Ubuntu's settings (under "Power"); if you look in the "Devices" section, you should see "Wireless Controller" with the current battery status listed.
- You will need to manually turn the controller off when you're
finished with it, by holding the button until it
switches off (you should see the Light Bar/LED turn off).
Updated content of answer to reflect experience using Ubuntu LTS 18.04 ("Bionic Beaver") and the most recent version of Steam as at September 8th, 2018.