What all does ADB backup and how do I restore part of it? I am soon going to unlock bootloader and root my Nexus 5, but I didn't wanted to wipe all the data so I thought of using the ADB backup function to restore after rooting is done.

adb backup [-f &lt;file&gt;] [-apk|-noapk] [-shared|-noshared] [-all] [-system|nosystem] [&lt;packages...&gt;]


So, I made a full backup, with apk, with shared, all. 

First of all, what all does this command backup? I suppose everything. Does it include the system, that is, Android files, like the main ROM files including kernel and stuff? Will the ROM get restored after I restore this backup?

Also, after I have rooted the device (which I have still not done), will I be able to restore just the apps, app data and shared storage from the backup? Or should I just backup the apk with shared data backup and that will do it?

Is it possible with a third-party app, root/non-root? (Titanium Backup, maybe?)

I need to know more.
For what ADB backup does, you might wish to see our backup tag-wiki. Basically, depending on the command line switches used, it backs up apps (.apk) and their data. For a full list of options see this.

As for the second part of your question, you might wish to see Is there a way to look inside and modify an adb backup created file? Yes, it's possible extracting parts of it, and yes, Titanium Backup is one of the apps capable of this. Other ways are described in the linked question.

Also worth a look:


How do you extract an App's data from a full backup made through “adb backup”?
Partial adb restore
Backup and restore Android Settings and Application through ADB