How can I reset sudo password with a seperate monitor?

My laptop screen has been comprimised/ruined so i have a seperate monitor running and when in recovery mode the seperate monitor doesnt have signal to run and i cant see what the screen says while i give it commands. Is there a way to change the password without recovery mode and through the terminal?