0

I'm trying to edit a text file in terminal using the nano command however when I do it and specify the correct location it shows nothing. If I go and open the actual text file then all the content is in there.

3
  • 3
    Please edit your question with an example of a specific command / file that you tried to open Oct 26, 2017 at 15:54
  • 3
    You are perhaps getting the path to that file all wrong! Oct 26, 2017 at 16:04
  • Most likely you've mistyped the filename. Using tab completion can help ensure the file you are trying to edit actually exists: howtogeek.com/195207/…
    – moo
    Feb 18 at 12:34

1 Answer 1

0

I am assuming that when you say it shows nothing, you mean nano doesn't open the said file. And that when you go and open the file to see its content, you're doing so through a GUI.

Nevertheless, with this assumption in mind, I'll suggest you do any of the following since I believe it should be an issue of user privilege(s):

  1. Use sudo as a prefix to the command you're running on the terminal.

    $ sudo nano <file>
    

    Note that <file> includes both the "file name" and "file extension". For example: README.md.

  2. Edit the file as a user with high privileges such as root.

    $ sudo su
    

    Enter your password when prompted... then proceed as follows:

    # nano <file>
    

After any of the steps above, you should see your file content on your terminal (that's your file open). You can then proceed with any editing.


NB: Check the bottom of the terminal for any other available instructions once file editing has been enabled.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .