“This is the second day of my participation in the November Gwen Challenge. See details of the event: The last Gwen Challenge 2021”.
👨🎓 author: Java Academic Conference
🏦 Storage: Github, Gitee
✏️ blogs: CSDN, Nuggets, InfoQ, Cloud + Community
💌 public account: Java Academic Party
🚫 special statement: the original is not easy, shall not be reproduced or copied without authorization, if you need to reproduce can contact xiaobian authorization.
🙏 Copyright notice: part of the text or pictures in the article come from the Internet and Baidu Encyclopedia, if there is infringement, please contact xiaobian as soon as possible. Wechat search public Java academic party contact xiaobian.
☠️ Daily toxic chicken Soup: Nothing to say, read the article.
👋 Hello! I’m your old friend Java Academic Party. When we play Windows is very skilled, so xiaobian today to take you to make a Linux system, xiaobian with a week to give you the whole of some Linux dry goods, because the content is too much, xiaobian sub development. Without further ado, let’s jump right into today’s topic: Linux. Linux, full name GNU/Linux, is a free to use and freely distributed Unix-like operating system. Its kernel was first released by Linus Benadicte Torvalds on October 5, 1991. It is mainly inspired by the ideas of Minix and UNIX. POSIX is a multiuser, multitask, multithreaded and multi-CPU operating system based on POSIX. It can run major Unix tools, applications, and network protocols. It supports both 32-bit and 64-bit hardware. Linux inherits the design idea of Unix taking network as the core, and is a stable multi-user network operating system. There are hundreds of different distributions of Linux, such as community-based debian and ArchLinux, and commercially based Red Hat Enterprise Linux, SUSE, Oracle Linux, and more.
1. Introduction of Linux
- Linux: An open source, free operating system (paid for by Windows) that is installed on a computer and used to manage the hardware and software resources of the computer. Linux emphasizes security and stability, high concurrency and strong processing capability.
- Linux performs better than Windows, but the visual interface is not as good.
- Windows is used on personal computers and Linux is used on enterprise servers.
2. Linux version
- Version 1.0, developed by Linus in 1991, is called the Linux kernel program.
Current versions of Linux on the market:
- Ubuntu
- RedHat
- CentOS
- Red flag: Domestic
3. The virtual machine
- Virtual machine software can be used to simulate a set of complete hardware system functions, running in a completely isolated environment of the computer system. That is to simulate a new computer with hardware (CPU, memory, sound card, nic lights, etc.) and system software (Windows, Linux, MacOS, etc.) on top of your Windows system. The simulated computer has all the functions of a complete computer, including boot, shutdown, restart and so on. In addition, the VM running on Windows does not affect the Windows operating system. The two systems do not interfere with each other.
4. Install the Linux system
- Search the Web for images of Linux systems.
5. Introduction to the Linux installation directory
- In the Linux world, everything is a file.
- In Linux, the location of various types of files (configuration file directory, system file directory, user file directory, etc.) is clearly specified. Linux doesn’t have a perfect visual interface, so we can only use this defined directory structure to store response-type files.
- The Linux file system uses a hierarchical tree directory structure, in which the top layer is the root directory “/”, under which other directories are created.
Linux directory structure:
- Linux has only one root directory, and this directory is /.
- Linux uses a hierarchical directory structure (that is, a tree)
This is the structure of a Linux directory, and we will focus on the first layer of directory structure.
- Root: this directory is the system administrator directory. Root is a user with super permission.
- Bin –>usr/bin: an executable program that stores system preview files. The executable files stored here can be executed in any directory on the system.
- Usr is Linux’s system resources directory, which houses libraries of files that system executables and/or shampoo depend on.
- Usr /local/bin: stores the user’s own executable file, which can be executed in any directory on the system.
- Lib ->usr/lib: this directory contains the system’s most basic dynamic connection sharing shared library. Similar to DLL files in Windows (The DLL fileDLL is a system dynamic link library file,DLL is a library containing code and data that can be used by multiple programs simultaneously), almost all applications need to use these shared libraries.
- Boot: This directory stores core files used to start Linux, including connection files and image files.
- Dev: Dev is short for Divce. This directory is used to store Linux external devices, which also exist as files in Linux.
- Etc: This directory stores all configuration files required for system administration.
- In Linux, each user has his or her own directory. Generally, the directory is named after the user account and is called the user root directory. After the user logs in, the user opens his or her own root directory by default.
- Var: This directory is where things keep expanding and we’re used to storing files that are constantly being modified, such as running log files.
- MNT: This directory is provided by the system to allow users to temporarily mount other file systems. You can mount the CD-ROM drive to/MNT/and view the contents of the cd-rom drive in this directory.
- Opt: This is the directory for storing additional installation software for Linux. For example, if you install an Oracle database, you can place it in this directory. It is empty by default
- TMP: This directory is used to store temporary files.
5.1 Analysis of the bin->usr/bin directory
The bin directory is full of executable files, a file equivalent to a command, the javadoc.exe file in the Windos JDK (full of compiled code), which can be executed anywhere on the system, the same way that a DOS window can be used anywhere on Windows.
The JDK can be executed in any directory on Windows because the JDK Path environment variable is configured on the computer.
In the bin directory on Linux, the Path environment variable is automatically configured for us, although we have not configured the environment variable.
By placing the executable in this directory, we have configured the Path environment variable, which can be executed in any directory on the system.
5.2 Analyzing the usr/local/bin directory
- This directory holds the user’s own executable files. Executable files in this directory can also be executed in any directory on the system.
5.3 Analyzing the ETC Directory
- Etc contains configuration files required by the system. (e.g. Config file, etc.)
- /etc/profile: This directory is used to configure environment variables.
The principle of setting environment variables in Windows is as follows: After setting the path, bin directory and other information in environment variables, the system will write these configurations into a configuration file and save them. The system will load this configuration file when it starts up next time, so that we can continue to use the environment variable information.
There is no visual interface on Linux, so at this point we will write our environment variables by hand in the configuration file.
5.4 Analyzing the Home Directory
- Home: stores the root directory of each user (this directory may contain multiple root directories: John, John, and John). The directory name is the same as the user name by default, but can be changed.
- Every Linux user has its own root directory, which stores the user’s private information.
5.5 Analyzing the OPT Directory
- Opt: Stores additional installed software (JDK, Tomcat, etc.)
- This directory is the default installation path for additional software downloads in Windows (Program Files(x86))
6. Remote operations in Linux
- In actual development, we do not see the server, the server is usually in a small space or other server maintenance company, and most of the server is a host, no display, etc. At this point we need to operate the server remotely.
Common remote operation software:
- XShell: Terminal simulation software for Linux.
- In software companies, both test and formal servers are deployed on corporate Linux systems, which are usually shared by development teams, so programmers need to remotely log in to centos for project management or development. Remote login client has Xshell, Xftp and other tools, we learned to use Xshell and Xftp, other remote tools are similar with minor differences.
6.1 introduce Xshell
- Xshell is a powerful secure terminal simulation software, it supports SSH1, SSH2, and The TELNET protocol of Microsoft Windows platform. It helps users enjoy their work in a complex networking environment through secure Internet connections to remote systems and its innovative design and features.
- Xshell is currently the best remote login to Linux operating system software, fluent speed and perfect solution to the problem of Chinese garble, is currently the programmer’s preferred software.
- Xshell can only operate on files that already exist on the terminal (JDK, Tomcat, or war packages for deployment), but cannot transfer files to the server or retrieve files from the server. This software can not be implemented, need to use other software to achieve this function.
6.2 Xftp
- Introduction: SFTP(Secure File Transfer Protocol) and FTP(File Transfer Protocol) file transfer software based on Windows platform. With Xftp, Windows users can securely transfer files between UNIX/Linux and Windows PCS.
- Xftp can transfer files between any two systems (Linux<–>Liunx,Windows<– >Windows)
6.3 Xshell Connection Operations
- You need to obtain the IP address of our remote Linux host.
- We can use XShell on our own computer to access the server in the United States, but we must ensure that the IP address on the Internet needs to be filled in when connecting to the external network (namely the Internet). Now we are testing the LAN used.
7. Vi and Vim editors
7.1 Introduction to VI and VIM editors
- Vim is an updated version of VI, the editor provided by Linux for creating, viewing, and editing text files. Is a Linux editor (equivalent to Notepad in Windows). Text files are made up of characters, numbers and special symbols. As long as you can open them with Notepad, they are text files. You can only compile text files, not images and videos.
- Vim is an enhanced version of VI and is easier to use than VI. Almost all of vi’s commands can be used on Vim.
7.2 Basic use of VI and VIm editors
Three states of VI and VIm:
- Normal mode: Open a file with vi/vim to enter normal mode (the default mode). In this mode, you can use the “up, down, left and right” keys to move the cursor, you can use the “Delete character” or “Delete entire line” shortcuts to work with file content, and you can use the “copy and paste” shortcuts to work with your file data.
- Edit mode: In normal mode, press I, I, O, O, A, A, R, R to enter the edit mode. Generally, press I. Edit mode allows editing of text content, but does not save compiled content. Press Esc key to return to normal mode
-
Command line mode: In common mode, press: to enter the command mode. In this mode, can provide you with relevant instructions, complete read, save, replace, leave vim, display line number and so on action is achieved in this mode!
- q! : Does not save the file and forcibly exits editing.
- Wq: Save the changes and exit the editor.
- Q: Just exit the editor.
7.3 Long common shortcut keys of vim editor
- Copy current line: In normal mode, press YY to copy the line where the cursor is located to the clipboard, press P to paste the contents of the clipboard to the next line where the cursor is located. If you want to put the copied data on the copied row, you need to enter edit mode to wrap the line.
- Copy 5 lines below the current line: in general mode, press 5YY (including the line where the cursor is) and 4 lines below, paste the same as above.
- Delete current cursor position: In normal mode, press DD to delete current cursor position.
- Delete 5 lines below the cursor: In general mode, press 5DD (including the line where the cursor is located) and 4 lines below
- Undo: In edit mode, enter a line of characters, or modify something. In normal mode, enter “u”. This effect is the same as the undo effect in Windows, which can be repeated.
- To display the line number: In command mode, enter “Set nu” and press Enter.
- Hide line number: In command mode, type “Set nonu”, press Enter.
- Searching for a keyword in a text file: In command mode, enter/keyword, and press Enter. Press “n” to indicate the cursor to find the next keyword.
♥♥ today’s share on the first here, tomorrow to continue to share Linux(two).
Above project source code,Click planet to get it for freeplanet(making address)If I didn’t have my Github buddies. You can follow my wechat official account:Java academic lie prone, send jQuery, free to send you the project source code, the code is personally tested by xiaobian, absolutely reliable. It’s free to use.