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

Basic knowledge of centos- (1)

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. List the distributions of Linux by series, and describe the connections and differences between different distributions.

The release of linux:

RedHat, Fedora, Red Flag, debian, Ubuntu, centos

Connections and differences between different distributions:

Red Hat, the enterprise version of redhat itself, is an important node of redhat.

Fedore is an operating system based on linux, and it is also a set of software that keeps the computer running normally. Sponsored by Red Hat.

The distribution of Red Flag linux, including desktop version, workstation version, data center server version, HA cluster version and Red Flag embedded linux, is one of the larger and more mature linux distributions in China.

Debian, the only one of the three major distributions, operates as a community, not as a commercial company. Is a cooperative organization dedicated to creating a free operating system. And most of the basic tools in the operating system created by debian developers come from the GNU project.

Ubuntu is a linux operating system based on desktop applications. The goal of Ubuntu is to provide the average user with an up-to-date and fairly stable operating system built mainly from free software.

Centos is an enterprise linux distribution based on the freely available source code provided by redhat linux. At present, Centos has been acquired and has become an organization under redhat.

2. Install the Centos7.6 operating system, create a user name with your own name, and log in normally, and take a screenshot of the main steps. :

Install centos in the VMware virtual machine

1. Put the CD image file in the CD drive

two。 Check the boot entry key in the power submenu in the virtual machine menu, and configure to boot from the CD

3. Select install centos7 from the installation menu

4. Select language

5. Select installation location, and software selection

6. Configure the network (you can also leave it unconfigured for the time being)

7. Create your own users

3. Configure the environment variable so that when you execute history, you can see the time of execution of the command.

1.vim / root/.bashrc open the file (to save some personal personalization, such as command aliases, paths, etc.)

2.Export HISTIMEFORMAT='%F% T' adds the statement after the file, and wq saves and exits

3.Source / root/.bashrc update profile

4.History display history command, display time, history command before configuration is to display the current time

4. Summarize the philosophy of Linux.

1. Everything is a document

2. It consists of many applications with a single purpose.

3. Combine Mini Program with a single purpose to accomplish complex tasks

4. Avoid capturing the user interface as much as possible

5. Provide mechanism rather than strategy

5. Summarize the format of commonly used Linux commands and illustrate them with examples. Such as echo, screen, date, ifconfig, export, etc.

1.Echo

Format: echo [SHORT-OPTION]... [STRING]...

Option:

Special characters appear in the-e string; for example: $echo-e "abc\ b"

\ a sound of warning; $ab

\ b Delete the previous character

\ c finally, no newline symbol is added.

\ t insert tab

\ insert\ character

-n output without line wrapping

Variables can also be connected in [STRING].

For example: # xroom10 changes the value of X to 10

# echo "X values is $x" # X values is 10

Note: the function of string quotation marks: variables can be automatically identified in "" quotation marks.

The variable is not recognized in quotation marks as text output.

Command recognizable command

Example: # echo "the computer hostname is hostname"

The computer hostname is code-serverscreen

Free software for command line terminal switching. Users can connect multiple local or remote command line sessions at the same time and switch freely between them through the software.

Format: screen [- AmRvx-ls-wipe] [- d] [- h] [- r] [- s] [- S]

Parameter description

-An adjusts all windows to the size of the current terminal.

-d takes the specified screen job offline.

-m forces the creation of a new screen job even if it is already in the job.

-r resumes offline screen jobs.

-R first attempts to resume offline jobs. If an offline job cannot be found, a new screen job is created.

-s specifies the shell to be executed when a new window is created.

-S specifies the name of the screen job.

-v displays version information.

-x resumes previously offline screen jobs.

-ls or-- list displays all current screen jobs.

-wipe checks all current screen jobs and deletes screen jobs that are no longer available. Remote demonstration

First, the presenter executes screen-S test on the server to create a screen session, and the viewer can link to the remote server to execute screen-x test. The viewer will synchronize with the presenter on the viewer's screen.

Common shortcut keys

Ctrl+a c: create a window in the current screen session

Ctrl+a w: window list

Ctrl+a n: next window

Ctrl+a p: previous window

Ctrl+a 0-9: switch between window 0 and window 9

3. Date command to view the current time or set the system date time

Format: date [parameters]... [+ format]

Parameters:

% H hours (expressed as 00-23).

% I hours (expressed as 01-12).

% K hours (expressed as 0-23).

% l hours (expressed as 0-12).

% M minutes (expressed as 00-59).

% P AM or PM.

The full name of% A week.

Full English name of% B month

% r: direct display time (12-hour format in hh:mm:ss [AP] M)

% S: seconds (00.61)

% T: direct display time (24-hour system)

% A: what day of the week (Sunday..Saturday)

% b: month (Jan..Dec)

% D: direct display date (mm/dd/yy)

% m: month (01.. 12)

% y: last two digits of the year (00.99)

% Y: full year (000.9999)

Date-s [date field] [time field] change the time field to the current time

Date-s 20200220-date-s 10:38:50

Date-s "10:38:50 20200220" # change the current date and time

Date addition and subtraction

Date +% Y%m%d # shows the date of the current year

Date-d "- 10 day" shows the date 10 days ago

Date-d "10 day" displays the date after 10 days

Date-d "- 1 month" # shows the date of the previous month

Date "+% Y" shows only the year

Date "+% Y-%m-%d" # 2020-02-21

4. The ifconfig command is used to view and configure network devices.

Ifconfig eth0 up/down/reload # start / shut down / restart the Nic eth0

Ifconfig eth0 192.168.25.166 up # configure the fixed IP of the eth0 network card and start it

Ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE # modify the eth0 MAC address of the network card

5. The export command sets or displays environment variables

Export [- fnp] [variable name] = [variable setting value]

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

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

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

Export PATH=$PATH:/home/daichengyong # append directory to PATH change value

Export setting environment variable is temporary and only valid in this login. You can modify the following file to make the command valid for a long time.

Example: modify / etc/profile file # all users take effect

Export PATH=$PATH:/home/daichengyong

Modification / home/daichengyong/.bashrc # takes effect for daichengyong users

Source home/daichengyong/.bashrc # Update configuration

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