Linux uses 3 simple commands to create files and implements an HTML and JavaScript applet

Source: Internet
Author: User
Tags touch command

1. Today, how to implement a JavaScript program under Linux, this is very simple, if you want to engage in Linux under the Web development, server erection, big data and so on, you have to continue to work!





2. First, we want to implement a JavaScript applet, we must have a suffix named html, htm and so on, so let me introduce the three command to create a file:

(1). Touch command: This command can create a new file under the current working directory, such as the following:


This touch command only creates an empty file, to enter the content and must use the Gedit command and the VI command to open the file, and can write content, if the file permission is read-only, the use of the Gedit command to open the file insert is not allowed to save, if you want to save the file must be modified permissions, So I prefer to use VI editor.



(2). gedit command, you can open a file you name, if there is no content directly shut down, the file is not created, if you enter the content, it can be saved and created, such as:

Then open a js.html file that I entered as content, and then save:


After saving, then enter the command ls-l, see if there is js.html this file:



(3). VI command, this is I prefer to use, although the steps used more than the above two, but it can be a read-only file content changes, can be saved, and the gedit command must modify the file permissions, the example is as follows:

Then press ENTER to appear on the interface:

How to insert content, we can press the INSERT key, you can also press the letter I key, the status of the VI editor becomes insert, as shown in:

Then we can enter the content, which can be through the direction key, that is, the direction of the cursor to move up and down around, I entered the following:

Then how to save and exit the VI editor, we can press the ESC key, and then enter: Wq, and then save and exit, if you want to know more about the parameters of the VI command, you can use the Man VI to view!





3. The code we have written, it is time to look at the effect, we can open the working directory of HTML files, double-click Open Browse, if I do this in class, will be criticized by the teacher, learn Linux also use the interface way to browse information, so we must use the command to run our web files, Because Linux is using the Firefox browser, we can see if there is this command, use the manual to check, using the command Man Firefox, click Enter, as shown in:

So we can use this command to open the file we created above, where g.html is empty, here only to see the effects of js.html and js1.html, enter the command Firefox js.html, as shown:

Then we enter the command Firefox js1.html, as shown in:

Then click on the Say hello button and it will appear:






4. The above content is only for everyone to study the reference, thanks! If you have time, I will introduce you to install MyEclipse tools and Tomcat server under Linux, install these two development tools can write Web development, if you want to make SSH three framework, but also download configuration something, so many things under the Windows operating system, We can also do it under Linux!

Linux uses 3 simple commands to create files and implements an HTML and JavaScript applet

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.