 Hello and welcome to a video from filmsbychrist.com. That's Chris with the K, I'm Chris with the K. Today we're gonna be looking at, looking at your contact information on your mobile device, your Android device from the shell, from the ADB shell, the Android debugging shell, debugging bridge shell. So here I am, I'm on my desktop but I'm logged into my phone's shell through the debugging bridge. And so we're at the prompt on my phone. Now, if your phone is rooted, you know, one of the best things you can do is just look at this file. Data, data, com, Android providers, contacts, databases, contacts2.db. This is a SQLite3 database but if you try to access it without root, it just tells you permission denied because you're not allowed to look at your own contacts, you're not allowed to modify your own contacts unless you're using an app. So if you have root on your phone you can just use SQLite and modify this like any other database but if you don't have root, you can't do that. There is one option at least to view your contact information and that's using a command that's built into Android. It's the content query command and then we're gonna do dash dash URI. And then we're gonna pass that this option of content, colon, forward slash, forward slash, com, Android, contacts, forward slash, data. When you do that it's gonna dump all of your contact information to the screen. Now I'm assuming that you have some knowledge of shell scripting. We're gonna use some tools here to clean this up a little bit. So let's just run that again but we're gonna pipe it into tr, tr colon, or sorry, quotations. Inside the quotations, a comma and then in the next set of quotations we're gonna do back slash and for new lines. So basically we're gonna break everything up on the new line. So when we do that, you can see here that it dumps all the information but breaks it up and now we can see all the values here. For example, data one in this case is this person's address but so is data four. I don't really know why that is. There's some things in this that seem a little weird to me but just looking at it and again with basic grep and said type commands you can do a lot of stuff here. So we can clean this up a little bit before we even put it into tr. Let's go back to the original commands. So we got our content query command. Let's add to the end of that projection. And after projection we can give it any one of the values. So actually let's remove that. Let's run this again. So you can see again, do it with tr so it'll make it a little easier to read. You have status TS, raw contact user profile. You have all these things. Anything that's on the left side of the equal sign. So basically the variable is what you can put in here. So let's go ahead and clear the screen again. Run this with the dash dash projection command and then we're going to say display underscore name and that will show you their display name. So in this case it's going to be their first name and their last name. A lot of these contacts were contacts I generated randomly just for this tutorial. I didn't give them last names. I gave them first names and I gave them display names. So keep that in mind. We're going to go a little bit further with this and before we said data one on that one showed his address the thing is the users inside your contacts actually show up on more than one row. So let me go ahead and run this and you'll see here that we actually have every contact in here three times because there's three bits of data here data one for each of them but we can get their first name, their phone number and their address. So let's go ahead and again it was pretty much the end of the tutorial but we're just going to clean it up a little bit more. Let's just go ahead and get everything after this equal sign here. So we got column one, column two, column three. So we're going to clear the screen just to make things easier to read. We're going to pipe that into our cut command. We're going to say cut at equal sign, field three and now we get the information for these users. So we got Mitchell here and we got his address or his phone number and his address George of course doing this because I didn't put in last names they're not showing their last names but of course we can always change that up a little bit and probably if we do one comma three. Okay, so we got their display name. No, so we want two comma three. There we go. So now we got their display name and then the information over here and then we can always use set. Again, I'm just adding stuff to what we can do to clean this up a little bit. It would be much better if we could just again access the database like you would on a normal system. But let's go ahead and say set and remove that just make it a space. There we go. That's a little bit cleaner. We got Tom Mitchell. His first name is Mitchell, his phone number is this and his address is this. Anyway, so again there's links in the description but the main portion of this command that you're gonna wanna know at least to dump everything in a very weird format but is content query dash dash URI content colon four slash forward slash com.android.contacts forward slash data. Do that and it'll just dump all your contact information. Again, it's not really in a useful format that you're gonna import and export from different contact applications but this is a quick and dirty way that you can search through or at least make some sort of backup. Again, there's other options out there. Like I said, if you're rooted you can just back up the database files. Just copy the whole database file. You don't even need to know any SQL like you just copy it. But if you're not root, you're not allowed to do that with your own contacts. Also, if you're running termux, termux actually has an option to dump your contacts in a nice JSON format. So that's something else. But I just wanted to show you on an unrooted phone just with tools that are built into Android how you can at least view your contacts. I do thank you for watching. Again, visit filmsbychrist.com that's Chris the K. Links in the description to my website as well as notes on this information as well as actually directly accessing that SQLite database and a few options to look at stuff in there. Anyway, I can do a video on that. If you're interested in accessing the raw data right out of the database, let me know in the comments below and I can revisit this on a rooted device and actually access the database directly. Thanks for watching. Please visit filmsbychrist.com. I already said that. Have a great day.