{"id":21674,"date":"2022-03-21T09:00:15","date_gmt":"2022-03-21T01:00:15","guid":{"rendered":"https:\/\/www.mondoze.com\/guide\/?post_type=kb&p=21674"},"modified":"2022-10-07T08:21:09","modified_gmt":"2022-10-07T00:21:09","slug":"linux-vps-hosting-file-edit-tips","status":"publish","type":"kb","link":"https:\/\/www.mondoze.com\/guide\/kb\/linux-vps-hosting-file-edit-tips","title":{"rendered":"Linux VPS Hosting Tips On Editing Host File In 3 Steps"},"content":{"rendered":"\t\t
Regardless of the operating system, such as\u00a0Linux VPS hosting<\/a>, or\u00a0Windows VPS hosting<\/a>, a system\u2019s host file is essential for the operating system to map the hostnames to the IP addresses. For hosting users who are switching to another provider, it is possible to check if their website works properly before moving their domain to another server by editing the host files.<\/p> This will be a guide on how to edit the host file in your Linux OS via terminal. The steps to edit the host file are as followed.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t For Linux operating system, the terminal is able to easily access the system. While some of the Linux may vary with others, the logic behind it is usually the same.<\/p> To open the terminal, go through the \u201cApplication\u201d, then \u201cUtilities\u201d page and you can find the terminal application there. Another easy way of doing it is to right-click on the desktop and pick the option \u201cOpen Terminal\u201d.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t To locate the host file in your system, use the following command to achieve it.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t Note that the command above, where it says \u201cvim\u201d, is for the text editor called \u201cVim\u201d. If you are using any other text editor, you may replace the command with the vim command. After running the command, the system will identify if the user is an administrator by prompting the user to enter the password.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Similar to the way of editing the host file, just enter the format as shown below for every domain needed to be tested. Do note that the test only works on the local machine, similar to the case of the Windows VPS hosting.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t Similar to Windows, add a new line for each domain tested and click “Y” when prompted to save changes. Revert the file back to its original version once the tests were done.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":" Regardless of the operating system, such as\u00a0Linux VPS hosting, or\u00a0Windows VPS hosting, a system\u2019s host file is essential for the operating system to map the hostnames to the IP addresses. For hosting users who are switching to another provider, it is possible to check if their website works properly before moving their domain to another …<\/p>\nStep 1: Open terminal<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
Step 2: Locate and open the file<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
sudo vim \/etc\/hosts<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
Step 3: Modify Hosts File<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
{IP Address} {exampledomain.com} {www.exampledomain.com}<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t