SSH- How to create php files in /var/www folder?

Question:  How can we create php files in /var/www folder using SSH command?
Answer:
-Create the file

sudo touch hello.php

-Open the file

sudo vi hello.php

Enter write mode (we were in command mode initially) by pressing  a  (note that    vi   is case sensitive)

After that, press Esc (to change to command mode) and type :wq Check if everything is fine with
cat hello.php

However, it's probably a better idea to use editors such as vim or nano as work with them is a lot simpler than that.

No comments:

Post a Comment