Use the following command to check macOS version
softwareupdate --list-full-installers
For example
softwareupdate --fetch-full-installer --full-installer-version 11.7.11
Erase using Disk Utility. You can see the size of each OS with the –list-full-installers command before.
Use the following command, change OS name and volume name based on your needs
sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
For Apple Silicon Mac: Press and hold the power button on your Mac. As you continue to hold, your Mac starts up and loads startup options, which shows your bootable volumes, including the bootable installer.
For Other Mac: Turn on your Mac, then immediately press and hold the Option (Alt) key. Release the Option key when you see a screen showing your bootable volumes, including the bootable installer.
How to download and install macOS: https://support.apple.com/en-us/102662
Create a bootable installer for macOS: https://support.apple.com/en-us/101578