Tips for setting Linux environment (JDK installation and Vi editor settings are used as an example)

Source: Internet
Author: User
Tips for setting the Linux environment (JDK installation and Vi editor settings are used as an example)-Linux general technology-Linux technology and application information. For more information, see the following. Dragon tornado original
Since Linux is an Open-source product, it has interfaces from the underlying layer to the high-level to provide modifications. Compared to Windows, when APIs are only opened at the upper level, the modification to the registry is already very advanced. In Linux, there is no registry, and most of the startup programs are read from the configuration files in the/etc/directory.

1. Environment Variables
/Etc/profile is a system configuration file that stores environment variables within the system scope. You can add system-level variables here. Note: This file has a big impact. If it is not necessary to modify the file, there are other solutions below.

Home Directory (for root users/root/, for general users such as dwl for/home/dwl), you can set user-level environment variables written in. in bashrc, if this file does not exist, use touch or vi to create it. Variables defined in. bash are invalid for other users.

After understanding this, you can check the JDK Linux installation on the Internet. In, after extracting the JDK binfile, You need to modify the/etc/profile and ~ at the same time ~ /. Bashrc (~ And add environment variables such as Java_Home pointing to the decompressed path. This is probably the result of mutual understanding of materials. The effect is certainly acceptable, but it is a misunderstanding: modifying/etc/profile requires that all users can use the Java Virtual Machine ~ /. Bashrc only applies to Java virtual machines for specific users. The two methods are completely different. From the principles mentioned in this article, you only need to modify one of the two, and only one is enough. As for WHO to modify, it is your own configuration scheme.

Example: determine a configuration file (/etc/profile or ~ /. Bashrc) Add the following
JAVA_HOME =/usr/java/jdk 1.6.0
PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin
CLASSPATH =.: $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME %/lib/dt. jar: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
Export JAVA_HOME PATH CLASSPATH

Or
Export JAVA_HOME =/usr/java/jdk1.6.0/
Export PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin
Export CLASSPATH =.: $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME %/lib/dt. jar: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib

2. settings of the program itself
Take vi as an example. This is an essential text editor for Linux. Its configuration file is in/etc/vimrc. We do not recommend modifying this file, the first is that this configuration file is global and cannot be used in case of any problems. The modified configuration file may not meet the usage characteristics of each user.

You can create ~ /. Vimrc file (created without it), write your own vi configuration in it, which is the need for personalization. For example, create/home/dwl/. vimrc with the following content:

: Set nu # display the row number

: Set hlsearch # reversed search characters

: Set autoindent # automatic contraction

: Set ruler # The status line is displayed in the lower right corner.

: Set showmode # Insert status prompt in the lower right corner

This is a good fit for my own habits.

Two points
1. There are too many and too many things on the network, so you must have your own identification. After understanding the essence, it is easy to pretend to be true.

2. New users can get started as soon as possible only when the system establishes a concept system for Linux and implements Linux system practices one by one.
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.