Search for the Solution?
-
Others
- Enable Auto Scaling in Cloud Hosting
- Force www in your .htaccess file in cPanel (For WordPress & All Sites)
- General Terms & Conditions
- How to Backup MySQL Databases with mysqldump
- How to Fix & Rebuild Apache in cPanel/WHM
- How to Force SSL / HTTPS using .htaccess (For WordPress & All Sites)
- How to install MariaDB Instead of MySQL8 in cPanel/WHM
- How to Reset LiteSpeed Web Admin Password
- How to Restart Services in cPanel using SSH Access
- IP Blocking and Iptables in linux / cPanel
- Privacy Policy
- Stop BAD BOTS in cPanel / WHM Using ModSecurity Custom Rule Set (Easiest Way)
- Whitelisting Multiple IPs in Imunify360
- How to Force Delete DNS from Command Line - CLI in WHM
- How to Fix Python Selector IndexError and lvemanager inactive on CloudLinux
- How to Configure CSF in WHM/cPanel for Maximum Security?
- How to Install CSF Firewall in WHM/cPanel (2026 Guide)
- How to Bulk Delete High-Risk External Email Forwarders in cPanel/WHM
- How to Auto-Block Attackers in CSF on LiteSpeed Server in WHM/cPanel (Advanced Script)
- How to Auto-Block Attackers in Imunify360 on LiteSpeed Server in WHM/cPanel (Advanced Script)
- How to Empty Logs in CWP Pro to Reduce Disk Usage
- Data Restoration After Hosting Plan Expiry
- Show All Articles (7) Collapse Articles
How to Force Delete DNS from Command Line – CLI in WHM
Introduction
In certain situations, you might need to force delete a DNS zone from your WHM (Web Host Manager) server using the command line interface (CLI). This is typically required when a standard DNS zone deletion through the WHM interface fails or encounters issues. This guide will walk you through the steps to remove a DNS zone using the command line in WHM, ensuring a clean and efficient removal process.
This method is particularly useful in scenarios where:
- The DNS zone deletion process is stuck in WHM.
- You are experiencing errors when trying to delete the DNS zone through the WHM interface.
- You need to automate DNS zone removal via scripts.
By using the command line, you can bypass potential interface issues and directly instruct the server to forcefully delete the DNS zone.
Prerequisites
Before you begin, ensure you have the following:
- WHM Access: You need administrative access to your WHM server.
- Root Access via SSH: You will need to connect to your server via SSH as the root user. This is necessary to execute commands with the required privileges.
Steps to Force Delete DNS Zone from Command Line – CLI in WHM
Follow these steps to force remove a DNS zone using the command line in WHM:
-
Access your server via SSH:
- Open your terminal application (like Terminal on macOS or PuTTY on Windows).
- Connect to your server using the SSH command, replacing
your_server_ipwith your server’s IP address and ensure you are logging in as therootuser.
-
Identify the DNS Zone to Delete:
- Before proceeding with the force deletion, you need to identify the exact name of the DNS zone you want to remove. This is usually the domain name for which the DNS zone is configured. For example, if you want to delete the DNS zone for
example.com, thenexample.comis your DNS zone name.
- Before proceeding with the force deletion, you need to identify the exact name of the DNS zone you want to remove. This is usually the domain name for which the DNS zone is configured. For example, if you want to delete the DNS zone for
-
Execute the Force Delete Command:
- Use the following command to force delete the DNS zone. Replace
domain.comwith the actual domain name of the DNS zone you want to remove.
whmapi1 killdns domain='example.com'whmapi1: This is the command-line interface to the WHM API 1 (Application Programming Interface). We are using it to interact with WHM functionalities.killdns: This is the specific WHM API 1 function we are calling, designed to remove DNS zones. It effectively “kills” the DNS zone.domain='domain.com': This parameter specifies the DNS zone that you want to delete. Replacedomain.comwith your actual domain name.
- Use the following command to force delete the DNS zone. Replace
-
Verify DNS Zone Deletion:
-
After executing the command, WHM will provide an output indicating the success or failure of the operation. A successful deletion will typically show a “result: 1” message.
-
You can further verify the deletion by:
- Checking the DNS Zones list in your WHM interface to ensure the zone is no longer present.
- Using the following command in the CLI to list all DNS zones and confirm the deleted zone is not listed:
whmapi1 list_dns_zones
-
This article also solves the below issues:
-
How to Fix “A DNS entry for the domain already exists” error in WHM/cPanel?
- If you encounter the error message “A DNS entry for the domain already exists” when trying to create a new cPanel account or add a domain, it often indicates a lingering or corrupted DNS zone in WHM. Even if you cannot see the zone in the WHM interface, it might still exist in the backend DNS configuration.
- Using the
whmapi1 killdns domain='example.com'command (as described above) can forcefully remove this existing, potentially hidden, DNS zone. After force deleting, you should be able to create the cPanel account or add the domain without encountering the “DNS entry already exists” error.
-
How to Force remove DNS record permanently.
- This article directly addresses how to force remove a DNS record permanently (specifically, a DNS zone, which is a collection of DNS records for a domain).
- The
whmapi1 killdns domain='example.com'command ensures the permanent removal of the entire DNS zone for the specified domain from your WHM server. This is a forceful and irreversible action, effectively deleting all DNS records associated with that domain within WHM’s DNS management.
Important Considerations:
- Force deletion is irreversible: Once you force delete a DNS zone, it is permanently removed. Ensure you have backed up any necessary DNS records before proceeding.
- Use with caution: Only use the
killdnscommand when standard deletion methods are failing. Incorrectly forcing deletion can lead to unintended consequences if not used properly. - Alternative Force Delete Command: In certain rare situations, if
killdnsdoes not suffice, you can try the commandwhmapi1 remove_dns_zone zone=domain.com force=1This command also forces deletion and might be helpful in very specific edge cases. However,
killdnsis generally the recommended command for forceful removal. - Propagation time: After deleting a DNS zone, allow time for DNS propagation to complete. During this time, some users might still be directed to the old server until the DNS changes fully propagate across the internet.
Conclusion
By following these steps, you can effectively force delete a DNS zone from the command line in WHM. This method provides a powerful way to resolve DNS zone removal issues, fix “DNS entry already exists” errors, and ensure permanent DNS record removal, thus helping to maintain your server efficiently. Remember to use this command with caution and always verify the DNS zone deletion to ensure the process is successful.
If you have any further questions or encounter any issues, please contact our support team at myglobalHOST for assistance.


