# How to Create and Edit Files via SSH

There are several ways to create a file through SSH. In this article, we will present the file creation with two types of word processors.

<div class="vc_row wpb_row vc_row-fluid" id="bkmrk-nano%C2%A0%E2%80%93-for-beginner-"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><div class="wpb_text_column wpb_content_element "><div class="wpb_wrapper">- **nano** – for beginner users
- **vim** – for advanced users

</div></div></div></div></div></div><p class="callout info">If you are editing files from a cumbersome command line, we recommend that you create a file via FTP, you can use this description below:  
[Create and modify a file via FTP](https://dotroll.com/en/knowledge-base/books/ftp/page/how-to-create-and-edit-files-via-ftp "Creating and editing a file via FTP")</p>

<p class="callout danger">The following description is just an example of how to create or modify a file using SSH. Following the description, make sure you create the file at the right place. If you modify it, edit the file you want.</p>

#### CREATING A FILE USING NANO

<div class="vc_row wpb_row vc_row-fluid" id="bkmrk-log-in-to-the-server"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><div class="wpb_text_column wpb_content_element "><div class="wpb_wrapper">1. Log in to the server on SSH.
2. Navigate to the directory where you want to create or edit the file.
3. Next, type the **nano** command and then divide by space, enter the name of the file you want to create/edit. ```
    [server] $ nano .htaccess
    ```
4. ![](https://dotroll.com/wp-content/uploads/2020/08/nano.png)  
    Next, start typing the contents of the file.
5. When you have uploaded the file with the required content, hold down the **Ctrl** key and press the **O** key (Ctrl + O). ![](https://dotroll.com/wp-content/uploads/2020/08/nano1.png)  
    At the bottom of the screen, the editor will ask you again about the name of the file you previously specified.
6. You can confirm the file by pressing Enter.
7. Press **Ctrl+X** to exit the word processor.

</div></div></div></div></div></div>#### CREATING A FILE USING VIM

<div class="vc_row wpb_row vc_row-fluid" id="bkmrk-log-in-to-the-server-1"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><div class="wpb_text_column wpb_content_element "><div class="wpb_wrapper">1. Log in to the server on SSH.
2. Navigate to the directory where you want to create or edit the file.
3. Next, type the **vim** command, and then divide by space, enter the name of the file you want to create/edit. ```
    [server] $ vim .htaccess
    ```
4. ![](https://dotroll.com/wp-content/uploads/2020/08/vim.png)  
    After the word processor starts, you can upload the file by pressing the **i** key as it changes to INSERT mode.  
    ![](https://dotroll.com/wp-content/uploads/2020/08/vim1.png)
5. When you upload the file with the required content, use **Esc** to exit the insertion mode.
6. ![](https://dotroll.com/wp-content/uploads/2020/08/vim2.png)  
    To save the file, type **:wq**, and then use the **Enter** key to save the file.

</div></div></div></div></div></div>