Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Computer fundamentals / Linux Basics and help

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1.1. the connection and difference of the distribution of Linux.

Slackware:SUSE Linux Enterprise Server (SLES)

OpenSuse Desktop

Debian: ubuntu,deepin (depth), mint

Redhat: RHEL: RedHat Enterprise Linux (Red Hat, Commercial), which releases a new version every 18 months

Community version of CentOS:RHEL, free.

Winning the bid Kirin: domestic linux based on Red Hat

Fedora: the beta version of RHEL, which uses a large number of new technologies and releases a new version every 6 months.

ArchLinux: lightweight and concise, follow K.I.S.S. Keep it simple and stupid.

Gentoo: extreme performance, do not provide the traditional installer, download the source code to compile and install the software on the local machine

LFS:Linux From scratch self-made Linux

Android:kernel+busybox (tool set) + java virtual machine

1.2. install the Centos7.6 operating system, take a screenshot.

Build a system with 2 cores and 2GMA200G hard disk. To start the installation, select the boot connection and specify the location of the ISO file.

Test whether the CD is good or bad, then install it, and select line 2. If you have determined that the disc is correct, you can select line 1 directly

Choose a language, English

Time zone chooses Asia, Shanghai

Choose a GNOME desktop for the environment

Self-partitioning is the key point, and mount points that do not appear can type on their own. Such as / data

During the installation process, you can press Ctrl+Alt+F2, cut to check the memory size, and then determine the swap partition size, which is generally 2 times. Press Ctrl+Alt+F6 to switch back to the graphical installation interface.

The final partition is as follows

Finally set the time zone, hard disk partition, software installation, network conditions, and then Begin Installation

Set up the account password

When finished, restart, and select the support protocol after restart. Then just order finish.

Installation complete.

1.3.Configuring environment variables so that when you execute history, you can see the time when the command is executed.

Configure the following command HISTTIMEFORMAT= "% F% T" to / etc/profile.d/env.sh, ending with sh.

1.4.The philosophy of Linux.

Everything is a file (including hardware)

A small, single-purpose program

Link programs to complete complex tasks together. Such as shell programming, the combination of multiple Mini Program.

Avoid confusing user interfaces. Most of them use character interface.

Configuration data is stored in text

1.5. Linux commonly used commands use formats, such as echo, screen, date, ifconfig, export, etc.

Command format

COMMAND [OPTIONS...] [ARGUMENTS...]

Options, option: to enable or disable one or some of the functions of a command

Short option:-c for example:-l,-h

Long option:-- word for example:-- all,-- human-readable

Arguments, parameter: the object of the command, such as file name, user name, etc.

Note:

Multiple options and multiple parameters and commands are separated by white space characters

Cancel and end command execution: Ctrl+c,Ctrl+d

Multiple commands can be written on one line; symbols are separated and executed in turn.

A command can be divided into multiple lines with\

Date command

Usage: date [OPTION]... [+ FORMAT]

Or: date [- u |-- utc |-- universal] [MMDDhhmm [[CC] YY] [.ss]]

Usage 1: date option format

Month / day hour, month / day lowercase, other uppercase.

Note that the option-d displays the time by string and-s sets the time by string.

Note that there can only be one + sign in the format.

The common formats are as follows:

-s, set the current date to 2019-08-07 06:05:10. As follows, the current time has changed.

[root@centos6 ~] # date-s "1 year"

Tue Feb 16 21:33:10 CST 2021

-d, showing the current time, format: 2016-06-18 10:20:30. As follows, the display is correct, and the current time has not changed

[root@centos6] # date-d yesterday

Sat Feb 15 21:28:02 CST 2020

[root@centos6] # date-d tomorrow

Mon Feb 17 21:28:33 CST 2020

[root@centos6] # date-d "- 2 day" / / shows that the day before yesterday was Friday Fri

Fri Feb 14 21:28:58 CST 2020

[root@centos6 ~] # date-d "+ 2 day"

Tue Feb 18 21:29:06 CST 2020

Echo command

U function: display characters

U syntax: echo [- neE] [string]

U description: echo sends the input string to standard output. The output strings are separated by blank characters and are followed by a newline number

U option:

0-E (default) does not support the\ interpretation feature

Z-n does not wrap automatically

Z-e enables the interpretation function of\ characters

U display variable

The echo "$VAR_NAME" variable is replaced with a weak reference

Echo'$VAR_NAME' variables will not be replaced, strongly referenced

Enable the command option-e. If the following character appears in the string, it will be specially treated instead of being output as normal text.

\ a sound of warning

\ b Backspace key

\ c finally, no newline symbol is added.

\ e escape, equivalent to\ 033

\ nWrap and the cursor moves to the beginning of the line

\ r enter, that is, the cursor moves to the beginning of the line, but does not wrap

\ t insert tab

\ insert\ character

Command line extension: $() or ``

Print the output of one command to the parameters of another command

# echo "This system's name is $(hostname)"

This system's name is server1.example.com

# echo "i am whoami"

I am root

Parenthesis extension: {}

Print a simplified form of a duplicate string

The result of echo file {1 ~ 3 ~ 5} is: file1 file3 file5

Screen command

Open a new virtual screen, and multiple terminals can be virtualized on one terminal. Exit screen and use exit. Note that the screen package needs to be installed before it can be used.

Purpose:

When using a command that can be executed in a long time, you need to wait a long time for the result, or because the window is temporarily closed accidentally, you have to start all over again.

And help each other.

Use:

Screen, to start a screen session, simply type screen in the console, which opens a screen session, creates a new window, and starts a shell in that window.

Screen-S session_name, which can be distinguished by creating a named session when running multiple screen sessions.

Screen-r pid returns the previously hidden terminal.

Screen-x pid or session_name, add a screen.

Screen-ls, which can find the screen session ID to list what is currently running:

Screen-r 14883, restore to a screen_session

Temporary exit, Ctrl+a d (the order is Ctrl+a, then let go, and then enter d).

Quit completely, exit.

Ifconfig command

Display network device information (active):

Ifconfig, check the current network card status.

Description:

Eth0, which represents the first network card.

Lo is the loopback address of the host, which is generally used to test a network program, but does not want users of the local area network or external network to view it, so it can only run and view the network interface used on this host. For example, assign the httpd server to the loopback address and type 127.0.0.1 in the browser to see your WEB site. But only you can see, other hosts or users of the local area network do not know.

Start and close the specified network card:

Ifconfig eth0 up

Ifconfig eth0 down

Configure and delete IPv6 addresses for the network card:

Ifconfig eth0 add 33ffe:3240:800:1005::3/64 # configure the IPv6 address for the network card eth0

Ifconfig eth0 del 33ffe:3240:800:1005::3/64 # removes the IPv6 address for the Nic eth0

Modify the MAC address with ifconfig:

Ifconfig eth0 hw ether 00:AA:BB:CC:dd:EE

Configure the IP address:

[root@localhost ~] # ifconfig eth0 192.168.2.10

[root@localhost ~] # ifconfig eth0 192.168.2.10 netmask 255.255.255.0

[root@localhost ~] # ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255

Enable and disable the arp protocol:

Ifconfig eth0 arp # arp protocol for enabling Nic eth0

Ifconfig eth0-arp # shuts down the arp protocol of the network card eth0

Set the maximum transmission unit:

Ifconfig eth0 mtu 1500 # sets the maximum big data packet size to 1500 bytes

Export command

The export command is used to output shell variables as environment variables, or to export shell functions as environment variables.

When a variable is created, it is not automatically known to the shell process created after it. The command export can pass the value of the variable to the following shell. When a shell script is called and executed, it does not automatically gain access to variables that were originally defined in the script (caller) unless those variables have been explicitly set to available. The export command can be used to pass the values of one or more variables to any subsequent script.

Grammar

Export (option) (parameter)

Option

-f: represents the function name in [variable name]

-n: deletes the specified variable. The variable is not actually deleted, but it will not be output to the execution environment of subsequent instructions

-p: lists all the environment variables assigned to the program by shell.

Parameters.

Variable: specifies the environment variable to output or delete.

Example

List all current environment variables:

Export-p defines environment variable: # export MYENV defines environment variable assignment: # export MYENV=7

**

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report