Often used or needed Mac commands and key combinations
Diagnostics on Mac
On your Mac, choose Apple menu > Restart, then press and hold the D key while your Mac restarts. Keep holding the D key until the screen listing different languages appears. Select a language. Apple Diagnostics starts automatically.
Single User Mode on a Mac
Boot up the Mac or restart the computer.
As soon as the boot process begins, hold down COMMAND + S keys together.
Keep holding the Command and S keys until you see white text on a black background, indicating that single user mode is loading.
Enter the admin password to gain access to the Mac via Single User Mode.
Mac in Recovery Mode
Turn on your Mac and immediately press and hold Command (⌘)-R, follow the prompts afterwards.
Run file system check on your Mac
You can type fsck -fy to run fsck. (options: f for force and y for yes to anything that this process will ask for)
***You need to login to single user mode first
Boot from USB drive on Mac
Insert the USB boot media into an open USB slot.
Press the Power button to turn on your Mac (or Restart your Mac if it's already on).
When you hear the startup chime, press and hold the Option key.
Also known as startup manager
Press and hold the Option (Alt) key immediately after turning on or restarting your Mac.
Use Recovery Mode to reset your password
Apple includes a tool to replace a Mac's password. This is the best option if you have completely forgotten your password. Follow these steps:
Turn off your Mac (choose Apple > Shut Down).
Press the power button while holding down Command + R. The Mac will boot into Recovery (we have a separate article about how to boot a Mac in Recovery).
When you see the load bar appear you can let go of the keys. It may take a few minutes to load.
Select Disk Utility and press Continue.
Choose Utilities > Terminal.
Enter resetpassword (all one word, lower-case letters) and press Return.
Select the volume containing the account (normally this will be your main hard drive).
Choose the account to change with Select the User Account.
Enter a new password and re-enter it into the password fields.
Enter a new password hint related to the password.
Click Save.
A warning will appear that the password has changed, but not the Keychain Password. Click OK.
Click Apple > Shut Down.
Now start up the Mac. You can log in using the new password.
ref:
https://www.macworld.co.uk/how-to/mac/forgotten-mac-password-3594395/
too bad Apple will not give you that information and look what Apple tells you to do
https://support.apple.com/guide/mac-help/reset-your-mac-login-password-mh35902/mac