Mac Book Pro 2012 Terminal Pass Recovery Recently bought this computer and am not an administrator just trying to log previous owner out to log in via the use of the Terminal through accessing the physical written form of the password and using it to log prior owner out. Very basic understanding of coding and relatively new to the extensive study of it so details details details!
This can be done by removing the .AppleSetupDone file, forcing the Mac to go back through the initial setup, part of which includes creating an admin account.  The following steps should walk you through that process:


Shutdown as normal
Power on your Mac while holding command+S to enter Single User mode
Type rm /var/db/.AppleSetupDone and press return
Type reboot and press return
The Mac should now reboot and go through the setup assistant, allowing you to create a new admin account.


Once you have an admin account you should be able to use sudo elevation in Terminal and remove any other user accounts on the system.