What is Linux?

Linux is an open source, free operating system, its stability, safety, ability to deal with multiple concurrent has been recognised by industry, currently most enterprise applications and even cluster project deployment run on Linux operating system, many software companies considering the development costs are preferred Linux software company has been widely used in China.

Share to everyone Linux video explanation, xiao Bai can also watch the video, easier to understand and absorb ~

The video explains the origin and development of Linux, the installation and configuration of CentOS, a common Linux system used by enterprises.

This section describes the ten types of Linux commands and provides examples. Web applications developed with JAVA.

Build Web application running environment in Linux :JDK,MySQL,Tomcat installation, configuration, log view, etc.

Deploy the Web application as a WAR.

Video learning can meet the actual combat requirements in the enterprise.

Watch online: www.bilibili.com/video/BV1Li.

Data download: www.bjpowernode.com/javavideo/1…

Major distributions of Linux

Ubuntu, RedHat, CentOS, Debain, Fedora, SuSE,

OpenSUSE, Red Flag Linux(domestic)

Linux installation:

Download the software

1. Virtual Machine software Download:

2, CentOS download:

Netease mirror: mirrors.163.com/centos/6/is…

Sohu mirror: mirrors.sohu.com/centos/6/is…

Installing a VM:

For details, see vm Installation Manual. Docx.

Install CentOS:

Reference: CentOS Installation Manual. Docx

Linux directory structure

Overview of the Linux directory structure

Linux doesn’t have a flashy visual interface, most of its operations are directly executed commands, and the executable files are stored in the corresponding directory, so most of our operations on Linux are to find and execute the executable 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.

In the Linux world, everything is a file.

Linux specific directory structure

  1. Root: this directory is the system administrator directory. Root is a user with super permission.

  2. Bin ->usr/bin: stores pre-installed executable programs in the system. The executable files stored here can be executed in any directory in the system.

  3. Usr is the Linux system resources directory, which contains system executables or file libraries from the system.

  4. Usr /local/bin: stores the user’s own executable file, which can be executed in any directory in the system.

  5. Lib ->usr/lib: This directory contains the system’s most basic dynamic connection shared libraries. It functions like Windows DLL files, and almost all applications need these shared libraries.

  6. Boot: This directory stores the core files used to start Linux, including connection files and image files.

  7. Dev: Dev is short for Device. This directory stores Linux external devices, which also exist as files.

  8. Etc: This directory stores all configuration files required for system management.

  9. Home: The user’s home directory. In Linux, each user has his or her own directory, which is usually named after the user’s account. After a user logs in, the root directory is opened by default.

  10. 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.

  11. 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

  12. 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.

  13. TMP: This directory is used to store temporary files.

Linux remote operation tool

Remote operation of 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.

Xshell

  1. Brief introduction:

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.

  1. Download: www.netsarang.com

  2. Installation and use: refer to “Xshell Installation Manual. Docx”

Xftp

  1. Brief introduction:

Is a Windows platform based on powerful SFTP, FTP file transfer software. With Xftp, Windows users can securely transfer files between UNIX/Linux and Windows PCS.

  1. Download: www.netsarang.com

  2. Installation and use: Refer to Xftp Installation manual. Docx.

Linux System Management

Use of VI and VIm

Vi and Vim introduction:

The VI editor is the most basic text editor on Linux and Unix and works in character mode. Vi is a highly efficient text editor because it does not require a graphical interface. Although there are many graphical interface editors available on Linux, VI has more functionality in system and server administration than those graphical editors can match.

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.

Vi and VIm have three common modes:

  • 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: Press I, I, O, O, A, A, R, r and other letters to enter the edit mode. Generally speaking, press I.
  • Command line mode: in this mode, can provide you with relevant commands, complete read, save, replace, leave vim, display line number, etc. Action is achieved in this mode!

Vi and vim are common shortcuts

  1. In general mode, copy the current line (YY), copy 5 lines down from the current line (5YY), and paste (p).

  2. In general mode, delete the current line (DD) and delete the 5 lines down from the current line (5DD).

  3. In normal mode, to find a word in a file, [in command mode :(/ keyword), press enter to find, type (n) to find next].

  4. In normal mode, use the shortcut keys to reach the first line [gg] and the last line [G].

  5. In normal mode, enter “XXXX” in a file and then undo the action (u).

  6. In normal mode, move the cursor to 10 lines Shift +g

Step 1: Enter 10

Step 2: Enter Shift +g

Step 3: Enter

  1. In cli mode, set the line number of the file and cancel the line number of the file [command line :set nu and :set nonu]].

  2. Other shortcut keys:

Linux User Management

Linux User Profile:

Linux is a multi-user and multi-task operating system. Any user who wants to use system resources must apply for an account from the system administrator and use the account to access the system. The root user is the default administrator account.

Adding a user:

Useradd [option] User name

Useradd Zhangsan: Creates an account named zhangsan. In this case, an account is created, a group named Zhangsan is created and assigned to this group, and a directory named Zhangsan is created under /home as the root directory of the newly created user.

Useradd -d /home/ls lisi: create an account called lisi and specify the home directory /ls for lisi.

Passwd Zhangsan: Sets a password for Zhangsan.

Delete a user:

Userdel [Option] User name

Userdel Zhangsan: Deletes user Zhangsan and reserves the home directory of Zhangsan.

Userdel -r lisi: delete user lisi and delete the home directory of lisi.

Query user information:

Id is a user name

Id Zhangsan: View information about user Zhangsan.

Switching users:

Su user name

Su Zhangsan: Switch to user Zhangsan.

Note: When switching from a user with high permission to a user with low permission, you do not need to enter a password. Otherwise, enter the password.

Another: the exit command can return to the original user.

Linux group management

Linux Group Introduction:

Linux groups are similar to roles. The system can centrally manage multiple users with common features. Each user belongs to at least one group. If you do not specify a group when creating a user, the system creates a group with the same user name by default and assigns the newly created user to the group. By default, the root user belongs to the root group.

Add group:

Groupadd group name

Groupadd devgroup: Creates a devgroup.

Delete the group:

Groupdel group name

Groupdel devgroup: deletes the devgroup.

Specify group when adding user:

Useradd -g group name User name

Useradd -g devgroup zhangsan: Add user Zhangsan and specify that Zhangsan belongs to devgroup.

Add a user to/remove a user from a group:

Gpasswd -a /-d User name Group name

Gpasswd – a zhangsan test

Gpasswd – d zhangsan test

Operating the Linux system

Shutdown now: shutdown the system immediately

Shudown-h 1: It will be powered down after 1 hour

Shutdown -r now: Restart the computer

Reboot: Now restart the computer

Sync: Synchronizes memory data to disks.

Linux practice instruction

Help instructions

In the process of using Linux, if you encounter unfamiliar instructions, one is to go to the network to find, the other is to use help instructions.

Help instruction MAN

Basic syntax:

Man [command or configuration file]

Function Description: Get the information from the help manual

Practical case:

Check the usage of the ls command:

Help instruction help

Basic syntax:

Help [command]

Function Description: Obtain the help information built in the command

Practical case:

Check the usage of the CD command: