Linux Basics

23 / 107

Create Text File Using Nano

You can use a text editor to edit or create a text file. There are many editors in Linux such as nano, pico, vi, emacs. Let's try to use nano for creating a file

  1. Launch nano to edit:

    nano myfirstfile.txt
    
  2. Type the following text into it:

    He walked into his exile
    
  3. Press Control+x, you will get a prompt at the bottom of the screen asking you to "Save modified buffer (Answering No will DESTROY CHANGES)". Press y as we want to save the changes, and then Enter to Save Changes and exit the nano editor.

  4. Alternatively you can create the file with this command

    echo "He walked into his exile" > ~/myfirstfile.txt
    

In case, you are stuck, please see this video:

INSTRUCTIONS
  • Use your home directory, type cd ~ to come to your home directory


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...