How do I save with Terminal (Mac)?

I hired someone to help me set up some software on my MacBook Pro, and he showed me how to use the Terminal program. Now I’m able to open and modify a file, but I can’t save it.

He said you have to click Ctrl-0 (Zero) to save a modified file, then click Ctrl-X to exit. Here are the steps I followed:

sudo -s
cd /etc/httpd
pico httpd.conf

Then I scrolled to the bottom and made my changes. Finally, I clicked Ctrl-0 at the same time, but nothing happens. I tried it with both Ctrl keys, with the same result. So I thought maybe he meant the letter 0, rather than zero. So I clicked Ctrl-O (oh), and Terminal says “File Name to Write: httpd.conf”

But I don’t have a clue what to do next. I clicked ^G, which is supposed to “Get Help” according to the key at the bottom of the page, but nothing happens.

So how do you save and exit a page in Terminal? Thanks.

I myself don’t use pico. Use nano
So now your commands are
sudo -s
cd /etc/httpd
nano httpd.conf

After you are done editing then you hold down Control plus X and then hit the y button.

Thanks, I’ll give that a try.

The keyboard shortcuts are at the bottom of the screen in Pico. You were correct to try Ctrl-O (^O WriteOut) and then at the ‘File Name to Write’ prompt you can type a different filename or press return if the displayed filename is what you want to save the file as. When you are done then you can press Ctrl-X (^X Exit).

Pico and nano are the same. Ok, they are like Pepsi vs. Coke but on many systems they are both the same binary or one is just symbolic link to the other since both are commonly used. In Tiger, pico is a symbolic link to nano, so they are exactly the same.

geosite, if you are more comfortable using a GUI editor, in Terminal you can just type in “open /etc/httpd/httpd.conf” and the file will open with the default program as if you had double clicked on it. If it is not the program you want to use you can type “open /etc/httpd” and that folder will come up in Finder. Then you can perform Get Info (command+i) on the httpd.conf file and choose the default application to open it with.

Thanks for all the tips. I’ve got it working now.

I’m glad you got it working :slight_smile: