Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to save to bash_profile using nano editor

Tags:

macos

I open bash_profile using the command

nano .bash_profile

To save, I tried ctlr + x, then Y.

then I open the file again, changes are not there?

what am I doing wrong here?

like image 324
Drunken Daddy Avatar asked Aug 01 '15 13:08

Drunken Daddy


People also ask

How to exit and save a file using nano editor on Linux?

As long as you had write permissions on the file you were editing, your new changes will be applied to the file. In this guide, we saw how to exit and save a file using the nano editor on Linux. The key to remember is that you need to press Ctrl + X to close the editor.

How do I Save changes to a nano file?

If you want to save the changes you've made, press Control + O. To exit nano, type Control + X. If you ask nano to exit from a modified file, it will ask you if you want to save it. Just press N in case you don't, or Y in case you do.

How to use nano command in Linux?

How to Use Nano 1 On the command prompt, type nano followed by the filename. 2 Edit the file as required. 3 Use the Ctrl-x command to save and exit the text editor. See More....

How do I edit a bash_profile file?

A Simple Guide to Create, Open, and Edit bash_profile. Create the .bash_profile File. Open the command by a shortcut key Ctrl+Alt+T or from the side icon of the terminal. The command is now opened. First ... List the .bash_profile File. Open the .bash_profile File. Edit the .bash_profile File. ...


1 Answers

In Nano Control + X exits the program. If you want to save changes to a file you've edited do:

Control + O then Enter followed by Control + X

This will overwrite the previous file with the changes and then exit.

like image 58
l'L'l Avatar answered Nov 05 '22 01:11

l'L'l