Linux (Basics Part 1)

Linux Basics Part 1

1. Linux file system and directory structure

1.1 Linux file system

Everything in a Linux system is a file

1.2 Linux directory structure

Insert image description here

  • /bin
    • Abbreviation for Binary. This directory stores the most commonly used commands.
  • /sbin
    • s means Super User. What is stored here is the system management program used by the system administrator.
  • /home
    • Stores the home directory of ordinary users. In Linux, each user has his own directory. Generally, the directory name is named after the user's account -
  • /root
    • This directory is the user home directory of the system administrator, also known as the super authority.
  • /lib
    • The most basic dynamic link shared library required for system startup, its function is similar to the DLL file in Windows. Almost all applications require these shared libraries
  • /lost+found
    • This directory is usually empty. When the system is shut down illegally, some files are stored here.
  • /usr
    • This is a very important directory. Many of the user's applications and files are placed in this directory, similar to the program files directory under Windows.
  • /boot
    • Stored here are some core files used when starting Linux, including some connection files and image files.Don’t put your own installation here.
  • /proc
    • This directory is a virtual directory, which is a mapping of system memory. We can obtain system information by directly accessing this directory.
  • /src
    • service abbreviation. This directory stores some data that needs to be extracted after the service is started.
  • /sys
    • This is a big change in the linux2.6 kernel. A new file system sysfs that appeared in the 2.6 kernel is installed in this directory.
  • /tmp
    • This directory is used to store some temporary files
  • /dev
    • Similar to Windows Device Manager, all hardware is stored in files
  • /media(CentOS6)
    • The Linux system will automatically recognize some devices, such as U disks, CD-ROM drives, etc. After recognition, Linux will mount the recognized devices to this directory.
    • CentOS7 migrated to /run/media
  • /mnt
    • The system provides this directory to allow users to temporarily mount other file systems. We can mount external storage on /mnt/, and then enter the directory to view the contents.
  • /opt
    • This is the directory where additional software is installed for the host. For example, if you install a mysql database, you can put it in this directory. Default is empty
  • /was
    • This directory stores things that are constantly expanding. We are accustomed to placing directories that are frequently modified in this directory. Includes various log files

2. VI/VIM editor

2.1 What is vi/vim

VI is the most versatile text editor in Unix operating systems and Unix-like operating systems.

The VIM editor is a more powerful text editor developed from VI. You can automatically identify the correctness of the grammar by font color, which facilitates program design. VIM is fully compatible with VI editor.

2.2 Conversion between modes

Insert image description here

2.3 Normal mode

Insert image description here

h Move to the top of the page

G /L Move to the end of the page

shift+X is similar to deleting all the way forward

y+$ copies the content from the current cursor to the end of this line

y+^ Copy the content at the beginning of this line with the current cursor

Number+G Move to target row

2.4 Insert mode

2.4.1 Enter editing mode

In the normal mode, you can delete, copy, paste, etc., but you cannot edit the file content! You have to wait until you press any letter such as "i, I, o, O, a, A" to enter the edit mode

Insert image description here

2.4.2 Exit edit mode

Press the "Esc" key to exit the editing mode, and the mode you are in after that is the normal mode.

2.5 Command mode

In normal mode, enter any of the three buttons ": / ?" to move the cursor to the bottom line

Insert image description here

3. Network configuration

3.1 Network connection mode

  • bridge mode

    A mode in which a virtual machine directly connects to an external physical network, and the host acts as a bridge. In this mode, the virtual machine can directly access the external network and is visible to the external network.

  • NAT mode

    The virtual machine and the host build a private network and translate the IP through a virtual network address translation (NAT) device. The virtual machine can access the external network through the shared host IP, but the external network cannot access the virtual machine.

  • Host only mode

    The virtual machine only shares a private network with the host and cannot communicate with external networks.

3.2 Modify static IP

Open configuration file

Insert image description here

Make modifications as follows:

Insert image description here
The IP address must correspond to that of the virtual machine. Modify it yourself. The viewing path is as follows:

VMware menu baredit->Click on Virtual Network Editor->Click on NAT Settings->View the corresponding gateway

For example, mine is 192.168.182.2, then my added content is

#IP address

IPADDR=192.168.182.100

#gateway

GATEWAY=192.168.182.2

#domain name resolver

DNS1=192.168.182.2

Insert image description here
After modification, restart the network
Insert image description here

3.3 Configure hosts file

byEnter hosts as super administratordocument

Insert image description here
The modified content is as follows:
Insert image description here
Find the hosts file under the windows host

Insert image description hereInsert image description here
The modified content is as follows:
It is the same as the new content under the Linux system. Four of them, 127.0.0.1, are the mapping configurations of the blogger’s own website. There is no need to add them.

If we test the connectivity again at this time, we can directly ping the host name, and the system will automatically resolve it for us, which is more convenient to use.
Insert image description here

4. Remote login

You can directly operate the Linux system in the Windows environment, which is very convenient
Insert image description here

Usually during the work process, the real servers or cloud servers used in the company do not allow employees other than operation and maintenance personnel to directly contact them, so they need to be operated by remote login. Therefore, remote login tools are indispensable. Currently, the more mainstream ones include Xshell, SSH Secure Shell, SecureCRT, FinalShell, etc. Students can choose according to their own habits.Use Xshell7 as the operation

4.1 XShell7 configuration

Software self-pickup: XShell7 download

Insert image description here

Insert image description here
Insert image description here

In this way, we can log in remotely very conveniently o(  ̄▽ ̄ )ブ

4.2 Xftp7 configuration

Software self-pickup: Xftp7 download

Insert image description here

If garbled characters occur, please do as follows:

Insert image description here
Insert image description here
In this way, we can transfer files to each other very conveniently o(  ̄▽ ̄ )ブ

Guess you like

Origin blog.csdn.net/pipihan21/article/details/132504378