How to edit/save a file through Ubuntu Terminal

后端 未结 5 1329
心在旅途
心在旅途 2020-12-22 18:23

This is quite a simple question:

I just need to open a file (this filename is galfit.feedme). I can view the file with view galfit.feedme when I\'m in the directory

5条回答
  •  有刺的猬
    2020-12-22 18:50

    If you are not root user then, use following commands:

    There are two ways to do it -

    1.

    sudo vi path_to_file/file_name
    

    Press Esc and then type below respectively

    :wq //save and exit
    :q! //exit without saving
    
    1. sudo nano path_to_file/file_name

    When using nano: after you finish editing press ctrl+x then it will ask save Y/N.
    If you want to save press Y, if not press N. And press enter to exit the editor.

提交回复
热议问题