#1MinuteTip In Salesforce, the package.xml file serves as the manifest file for both deploying components and retrieving them from a Salesforce Org. It specifies the components that you wish to deploy or retrieve.
Here is a single command in Salesforce CLI that will generate the package.xml file for you.
sf project generate manifest --from-org <salesforce-org-alias>

And here is the package.xml file that the command will generate for you.

You can use –type to specify the type of manifest you want to create such as the standard package.xml or destructiveChanges.xml to delete metadata.
You can also specify the metadata components that should be included in the manifest file. E.g. ApexClass, CustomObject etc.
Please refer to the following link for the reference document on this command.
References & Useful URLs
- Salesforce CLI Command Reference – sf project generate manifest
The sf cli provides a great tool for this
`sf project generate manifest`
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_project_commands_unified.htm#cli_reference_project_generate_manifest_unified