Open and edit a file's contents via the terminal on Ubuntu?

Answered
yaboy01 asked this question 21 days ago
yaboy01 21 days ago

I have a text file that I want to make edits to. And other files as well.

Can I make edits to it via the command line? How would I do that?

My operating system is Ubuntu.

4 suggested answers
itsbambi 15 days ago

You can use nano:

nano your_file.txt

This will open your file in your terminal window where you can make edits to it.

When you're done making edits, you can save the file with the CTRL + o keyboard shortcut.

And close the editor with the CTRL + x keyboard shortcut.

0 replies
suparman21 15 days ago

You can use the gedit command to open a text editor for your file:

gedit file.txt
0 replies
looper003 15 days ago

The vi text editor works for this. It should be included on your machine automatically.

Open a file with:

vi hello.txt

And then press the INSERT keyboard button to edit the file contents.

0 replies
nick 15 days ago
nano the_file_path.txt
0 replies
Answered