View Full Version : [ubuntu] Newbie question, how to "save and exit" in Terminal
felinoel
September 9th, 2012, 12:46 AM
Original issue resolved, see here (http://ubuntuforums.org/showthread.php?p=12228387#post12228387) for current issue.
I was following a guide and it said to save and exit... but it doesn't say how?
http://www.unixmen.com/install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat/
Now check if php is working :
$sudo vi /var/www/info.php
and add
<?php
phpinfo();
?>
save and exit
randrews
September 9th, 2012, 02:00 AM
Looks like you used the vi editor to create your file.
You should be able to press [Esc], then ZZ, to "save and close".
felinoel
September 9th, 2012, 02:26 AM
Looks like you used the vi editor to create your file.
You should be able to press [Esc], then ZZ, to "save and close".
When I pres escape nothing happens, when I type zz it just remains like it was, no z's added.
randrews
September 9th, 2012, 02:27 AM
Did you use capital Z's?
vi is... special.
felinoel
September 9th, 2012, 02:35 AM
Did you use capital Z's?
vi is... special.
I used capital Z's I used r's and f's and capitals of those too, it wouldn't let me type anything.
randrews
September 9th, 2012, 02:38 AM
You might want to consider a less mysterious text editor for now, to be honest.
You could use the same command as before to create your file, only instead of "vi" use "nano".
nano /var/www/info.php
steeldriver
September 9th, 2012, 02:44 AM
agreed - use a simpler editor
however if you are already in vi, you can use
ESC
:wq
(ESCape gets you out of insert mode; then "colon w q" for write quit)
felinoel
September 9th, 2012, 03:12 AM
You might want to consider a less mysterious text editor for now, to be honest.
You could use the same command as before to create your file, only instead of "vi" use "nano".
nano /var/www/info.phpI don't know what vi is, I only followed the instructions and did it in the Terminal, if vi runs through the Terminal then idk
agreed - use a simpler editor
however if you are already in vi, you can use
ESC
:wq
(ESCape gets you out of insert mode; then "colon w q" for write quit)Nothing types, not even a colon, because of this I pressed a bunch of buttons and now it says at the bottom, "search hit TOP, continuing at BOTTOM"
sandyd
September 9th, 2012, 03:45 AM
Press Control+C to get out of any modes.
Type
:w to save
:q to quit
felinoel
September 9th, 2012, 04:03 AM
Press Control+C to get out of any modes.
Type
:w to save
:q to quit
"/var/www/info.php"
"/var/www/info.php" E212: Can't open file for writing
Press ENTER or type command to continue
steeldriver
September 9th, 2012, 05:02 AM
OK let's get you out of vi - type
:q!to exit without saving your changes, then when you're back in the terminal either
sudo nano /var/www/info.phpand make your edits there; or you could just do
echo -e "\n<?php\nphpinfo();\n?>" | sudo tee -a /var/www/info.php
felinoel
September 9th, 2012, 07:08 AM
OK let's get you out of vi - type
Oops, did not see the new page
me@3MJ:~$ echo -e "\n<?php\nphpinfo();\n?>" | sudo tee -a /var/www/info.php
[sudo] password for me:
<?php
phpinfo();
?>
me@3MJ:~$ So... does it work now?
EDIT:
I went back to the guide and continued from there, it is now asking lighttp or apache2... I want phpbb3 though?
felinoel
September 9th, 2012, 07:06 PM
After reading about the two I went with lighttp and now it is installed... right?
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
Replacing config file /etc/phpmyadmin/config-db.php with new version
granting access to database phpmyadmin for phpmyadmin@localhost: success.
verifying access for phpmyadmin@localhost: success.
creating database phpmyadmin: success.
verifying database phpmyadmin exists: success.
populating database via sql... done.
dbconfig-common: flushing administrative password
Lighttpd not installed, skipping
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
I go to the next step on that guide which is to go to either of these sites
http://ip/phpmyadmin or http://localhost/phpmyadminand it is just simple phpbb stuff from there... but... those sites give me a 404 error?
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.