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

LINUX notes

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

Share

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

Notes

Systemctl restart service name restart service

Systemctl start service name start service

Systemctl stop service name stop service

Add the Systemctl enable service name to the startup item

Systemctl staus service name view service status

Systemctl configuration tool

Systemd service name

Linux server shutdown command:

Power off:

Shutdown-h now

Poweroff

Halt

Restart: l

Shutdown-r now

Reboot

BASH

1. Easy to use

two。 Extensive, take-all, applicable

Command parameter object

Hit Xiaogang hard.

-letter-a-l

-- word-- all-- list

Principle of merging between parameters: parameters in short format and short format can be merged, leaving only one minus sign in short format and not in long format.

Long format and short format cannot be merged.

The command needs parameters to assist.

Bash features: command + parameter + object

5 types

R (run) process command to provide service

S (interrupt) dormant state waiting for the service process

D (uninterruptible) a process that cannot be terminated

Z (zombie) zombie process zombie

The T (stop) process stops when it receives the message

Ifconfig network card information

Ether MAC address the physical address of the Nic

History command execution record! Add a number

Eport collects information

Cd directory

Cd ~ returns the user's home directory

C-returns the directory where it was last located

Cd.. Higher-level directory

/ root → / home

Ls displays the current directory files

Ls-a displays all files

Ls-l long format the format of the output details

Everything in the Linux system is a file

Cat is used to view smaller files

Last command to view the user's login record

More is used to view large files.

The Wc command-l displays only lines-w shows only words-c shows only bytes

Start

Cut-d delimiter interval-f column number file name

Diff compares the differences between the two files

Touch can modify the time file name of a file

Cp files are used to copy files or directories

Mkdir-p nested relational directories are equivalent to folders

If Rm-rf deletes the system, sudo rm-rf don't try.

Dd parameter if of bs count

Tar Compression Command

Compress

The Tar czvf package needs to be packaged.

Decompression

Tar xzvf compressed package

Cut-d spacer-f column number file name

Grep keyword file name

Pidof queries the PID of the service program on this machine

Kill terminates the queried PID process.

System status detection command

Ifconfig command queries information such as network card configuration and network status.

The inet parameter is followed by IP

The ether parameter is followed by the physical address of the network card, MAC address.

The number and cumulative traffic of RX RT accepting and relaxing data packets

If you want to view the details of the current system version, you need to view the redhat-release file, and the commands and the corresponding results are as follows:

[root@linuxprobe ~] # cat / etc/redhat-release

Uptime displays information such as the number of terminals enabled and the average load value of the current system time system to run time

The free command displays the memory usage information on the current system, plus the-h argument is Gb

Who to view the user terminal information of the currently logged-in host

Last is used to view all login records that can be easily tampered with.

The History command is used to display the history of executed commands plus the argument-c to clear

History commands are saved to the. bash_history file in the user's home directory. Files that start with a dot (.) in the Linux system represent hidden files. Most of these files are system service files, and you can use the cat command to view the contents of the files.

Redirect husband (command) file

Clear > commands > Files

Output redirector

Append > Command > > File

Enter redirector

< &>

& > input both wrong and right

Command file

Command command

Pipe symbol

Command An I Command B

Null or infinite

? Single character

[0-9] number

[Amurz] [Amurz] letter

Bashe interpreter

Interpreting command

MAIL message save path

RANDOM random value

Let the variable take effect immediately everyone can use export to promote to the global variable

Vim-- > vi

1: VIM works well

2: 99% widely used

3: input mode: insert `edit

Last line mode: colon, two points

Wq! Force save and exit

1:45 minutes

Diff command

Command for differences in multiple text files you can use the-brief parameter to confirm whether the two files are different or to compare in detail with the-c parameter

Touch command

Time to create a blank file to set the file

Cp command

The Cp command is used to copy files or directories

Mv command

Used for cutting file renaming

Rm command

When deleting a file or directory, you can add a-r parameter if you can't delete it.

The Dd command is used to convert or copy files

File command

The type format used to view files is file file name

Grep command

Used to perform keyword search in text

Find command

The find command is used to find files according to the specified criteria.

Chapter three, page 80.

Redirect husband (command) file

Clear > commands > Files

Output redirector

Append > Command > > File

Enter redirector

< &>

& > input both wrong and right

Command file

Command command

Pipe symbol

Command An I Command B

Null or infinite

? Single character

[0-9] number

[Amurz] [Amurz] letter

Bashe interpreter

Information output by Man bash to the screen

Alias alias = name creation

Cancel alias unalias command

The Rm command deletes the file

#! / bin/bash script declaration

# for test script comments

Ending with .sh

Save and exit! Wq

/ etc/sysconfig/network-scripts

1: accept

2: judge

3:

& & if the previous is successful, execute the back.

| | if the previous failure occurs, execute the back. |

! Take the inverse value

[- z xxxxx]

Echo?

See if the variable is used? 、

0 No

1 Yes

45 minutes.

W2

X1

R4

Fail

Wxrwr-r-x

Rw-rx-rmuri-

The useradd command creates a user

-d specify the user's home directory

-u specifies the default UID for the user

The Passwd command is used to modify password expiration time authentication information.

[root@localhost ~] # cat / etc/group

The Suserdel command is used to delete users

File authority and attribution

SUID is a special permission to set binary programs.

SGID gives the executor temporary permissions to belong to the group (setting binaries that have execution permissions)

SBIT special limit position

The Chattr command sets hidden permissions for files

Setfacl commands manage ACL rules Special permission Control for Files

The Getfacl command displays the ACL information set on the file

Su command

The / Bin directory is called the command file binary

/ Use self-installed program

/ media can also be hung on the CD image of the U disk mnt.

/ Var directory holds frequently changing data database websites

/ boot saves the information needed to boot

/ dev device directory

/ home user home directory

/ root system administrator's home directory

/ srv data files for some network services

Temporary directory of / tmp share

/ proc virtual file

/ var should store frequently changing files such as logs

/ dev/cdrom CD

468bytes 64bytes

Master boot record partition

Primary partition 1-4

Extended partition 1-4

Logical partition 5 ~

The equipment is named according to the system identity.

Inode block

File name the true content of the file

Modification time

Owner

All groups

Size

Pointer

Mount directory device files and directories for mounting

one hundred and sixty one

thirty-three

Posrouting road is ahead.

After Prerouting routin

Firewall-config Firewall configuration

LIUNX Apache static website

Mount the system image in the CD device to the / media/cdrom directory.

The code is mkdir-p / media/cdrom

Mount / dev/cdrom / media/cdrom

Hands-on installation of Apache service programs

Yum install httpd in yum warehouse

.

.

one

Enable the httpd service program and add it to the boot entry so that it can run as the system boots, thus continuously providing Web services to users.

The code is as follows: systemctl start httpd

Systemctl enable httpd

Find your previously configured IP address to view

The DocumentRoot parameter is used to define the path where the website data is saved.

The default value is to store the site data in the / var/www/html directory; at present, the common first page name of the website is index.html, so you can write a file to the / var/www/html directory, replacing the default first page of the httpd server.

The code is: echo "Welcome To LinuxProbe.Com" > / var/www/html/index.html

SELinux security subsystem

Enforcing: force the security policy mode to intercept illegal requests from the service.

Permissive: when you encounter unauthorized access to a service, you will only issue a warning and not force it to block it.

Disabled: no warning or intercept for ultra vires.

[root@linuxprobe ~] # vim / etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing-SELinux security policy is enforced.

# permissive-SELinux prints warnings instead of enforcing.

# disabled-No SELinux policy is loaded.

SELINUX=enforcing understands and looks at the downlink

If it is permissive or disabled, it is recommended to change it to enforcing.

# SELINUXTYPE= can take one of these two values:

# targeted-Targeted processes are protected

# minimum-Modification of targeted policy. Only selected processes are protected.

# mls-Multi Level Security protection.

SELINUXTYPE=targeted

[root@linuxprobe ~] # setenforce 1

[root@linuxprobe ~] # ls-Zd / var/www/html

Drwxr-xr-x. Root root system_u:object_r:httpd_sys_content_t:s0 / var/www/html

[root@linuxprobe ~] # ls-Zd / home/wwwroot

Drwxrwxrwx. Root root unconfined_u:object_r:home_root_t:s0 / home/wwwroot

Permission problems will occur during the operation.

Edit the last file

Add a Html casually.

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