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.
-
3Please edit your question with an example of a specific command / file that you tried to open– steeldriverOct 26, 2017 at 15:54
-
3You are perhaps getting the path to that file all wrong!– George UdosenOct 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/…– mooFeb 18 at 12:34
1 Answer
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):
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
.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.