Linux System Command Review 2

Source: Internet
Author: User
Tags ip number syslog web hosting rsyslog

When source and bash/sh execute scripts, they want to take immediate effect. General settings for environment variables with source, generic scripts are used Bash/sh


When looking at the hard disk space, the storage is not enough, because I node no more, small files, resulting in I node is not.
[[Email protected] Desktop]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda2 197G 89G 99G 48%/
Tmpfs 3.8G 1.5M 3.8G 1%/DEV/SHM
/DEV/SDA1 190M 41M 140M 23%/boot
/dev/sda3 99G 24G 70G 26%/weekend
/iso/rhel-server-6.7-x86_64-dvd.iso
3.6G 3.6G 0 100%/var/ftp/pub/iso/rhel6
[[Email protected] Desktop]# df-i
Filesystem inodes iused IFree iuse% mounted on
/dev/sda2 13107200 183466 12923734 2%/
TMPFS 991482 8 991474 1%/DEV/SHM
/DEV/SDA1 51200 51161 1%/boot
/dev/sda3 6553600 1104 6552496 1%/weekend
/iso/rhel-server-6.7-x86_64-dvd.iso
0 0 0-/var/ftp/pub/iso/rhel6
[[Email protected] Desktop]# df-th
Filesystem Type Size used Avail use% mounted on
/dev/sda2 ext4 197G 89G 99G 48%/
Tmpfs tmpfs 3.8G 1.5M 3.8G 1%/DEV/SHM
/DEV/SDA1 ext4 190M 41M 140M 23%/boot
/dev/sda3 ext4 99G 24G 70G 26%/weekend
/iso/rhel-server-6.7-x86_64-dvd.iso
iso9660 3.6G 3.6G 0 100%/var/ftp/pub/iso/rhel6


Zombie Process: The program has been terminated, but the process is still in use of memory space consumption system resources (code is finished, not consume the CPU consumes only memory)


FG BG


Crontab-e-l-r

Profile: Cron.allow (When you have this profile, the scheduled task only allows users in that list to use) Cron.deny (when there is this profile, you can use scheduled tasks in addition to the list of users) Cron.allow and Cron.deny (none exist, Only allow root use)


Put the program running in the foreground and run it back.
CTRL +Z

Jobs

BJ 1


Killall-9 vim (full Kill)

Killall-9-U Lisi


/etc/rc.d/rc.sysinit (startup script)
/etc/inittab (Default Level)
/etc/rc.d/rc.local (When the system starts all initialization script execution and then executes the script, so when some scripts need to be powered on automatically when the configuration is placed)


[[email protected] ~]# WATCH-N 1 PS a monitor all processes

[[Email protected] ~] #ps A (all running processes)

IPv4 2 of 32-time IP

Ipv6:ipng IP number 2 128-Time Square
128-bit, colon-separated hexadecimal representation
2001:0000:0000:000c:9110:0000:0000:0001

2001:0:0:c:9110:0:0:1
2001::c:9110:0:0:1


# Ping6:: 1

# ping6-i Eth0 fe80::76d4:35ff:fe4f:d17d



#gedit open a new file file


----------------------------------------------------------------------------------------------------
Write to see if a script is running successfully


[Email protected] Desktop]# cat jlrx.sh
#!/bin/bash

Read-p "Username:" username
If ["$username" = = "Bob"];then
Logger "$username Login successful"
Else
Logger "$username Login incorrect"
Fi
[[Email protected] Desktop]# sh jlrx.sh
Username:bob
[[Email protected] Desktop]# sh jlrx.sh
Username:ad
You have new mail in/var/spool/mail/root
[[Email protected] Desktop]# sh jlrx.sh
Username:acle
[Email protected] Desktop]# tailf-4/var/log/messages
APR 6 14:01:02 room1pc01 kernel:usb 2-1.6:usb Disconnect, device number 4
APR 6 14:52:03 room1pc01 root:bob Login Successful
APR 6 14:52:06 room1pc01 root:ad Login Incorrect
APR 6 14:52:11 room1pc01 root:acle Login Incorrect


See how many accesses (check IP)
[[Email protected] Desktop]# awk ' {ip[$1]++} end{for (i in IP) {print i,ip[i]}} '/var/log/secure

[[Email protected] Desktop]# awk ' {print $} '/var/log/secure |sort |uniq-c

[[Email protected] Desktop]# who |awk ' {ip[$1]++} end{for (i in IP) {print i,ip[i]}} '
Root 5
[[Email protected] Desktop]# who |awk ' {print $} ' |sort |uniq-c
5 root


/var/log/messages Many services start messages in this log
/var/log/secure record access restrictions related security log

/var/log/cron Scheduled Task log
/VAR/LOG/DMESG Logging system Startup message Log



[[Email protected] Desktop]# lastb Linux lastb command to list user-related information of login system failure

[[Email protected] Desktop]# Last this command is used to list information about users who have logged in to the system in the past

_____________________________________________________________________________

Sometimes the service doesn't start, and it's going to look at the log. Here is one more space in the config file

[[Email protected] Desktop]# service vsftpd restart
Close vsftpd: [OK]
Start vsftpd:500 oops:bad bool value in config file for:anonymous_enable for vsftpd
[failure] refers to anonymous_enable this line is wrong


[[Email protected] Desktop]# vim/etc/vsftpd/vsftpd.conf
Anonymous_enable=yes (YES, one more space is removed)


[[Email protected] Desktop]# service vsftpd restart
Close vsftpd: [Failed]
Start vsftpd for vsftpd: [OK]


——————————————————————————————————————————————————————————————
Remote log:

1. Original server
[[Email protected] Desktop]# vim/etc/rsyslog.conf
*.info;mail.none;authpriv.none;cron.none/var/log/messages
43
*.info;mail.none;authpriv.none;cron.none @172.40.55.161 (Paste a line on the IP of the remote log server)

[[Email protected] Desktop]# service rsyslog restart
Turn off the system logger: [OK]
Start the system logger: [OK]



2. Remote server receiving log messages


[Email protected] ~]# vim/etc/rsyslog.conf

# provides UDP syslog reception
$ModLoad IMUDP
$UDPServerRun 514

# provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

[Email protected] ~]# service Rsyslog restart

3. Testing
The original server can open two terminals
Terminal 1:
[Email protected] Desktop]# tail-f/var/log/messages

Remote server:
[Email protected] ~]# tail-f/var/log/messages

Original Server Terminal 2:
[[Email protected] Desktop]# Logger "Hahdhahd" observe the above log changes
————————————————————————————————————————————————————————————————————

Three ways to implement web hosting:
1.ip

2. Ports

3. Domain Name


Pros and Cons: Too many IP addresses, to write port number experience is not good


FTP (Master) 20: Server------"Client
(by) The------------client (port number is not determined)


Passive


ftp> Passive
Passive mode on. (Passive mode)
ftp> Passive
Passive mode off. (Active mode)


/etc/vsftpd/ftpusers blacklist
/etc/vsftpd/user_list Black-and-white list (depending on vsftp.conf configuration file)

#iptables-VNL INPUT

User has local user (normal user) anonymous User: FTP or Anonymous

#iptables-I input-p TCP--dport 21-j ACCEPT


Client DNS parsing process

1. Look at the cache first
2./etc/hosts
3. Local DNS server



Recursive query: Return the final result

Iterative query: Return close results



______________________________
With PXE 7 o'clock

Yum source name to be changed to development
[Development]
Name=development
Baseurl= .....
______________________________



Iptables Four table five chain


Filter: Implementing a Firewall

NAT: Network Address Translation

Mangle: Flow coloring, traffic marking

Raw: Status Tracking


INPUT: The packet is the firewall itself
OUTPUT: The original address of the packet is the firewall itself
FORWARD: Through the firewall
Prerouting:dnat
Postrouting:snat

Status: 5 species
NEW established related INVALID untracked


Mail:
POP: Offline
IMAP: Online


SMTP protocol:


Database language: DCL (Database Control Language) DML (Data manipulation language)


Root---"Eight top-level domains
DNS resource resolution record A PTR
SOA: Start of Authorization (authoritative server) NS: Name server MX: Mail server CNAME: Alias

This article is from the "12336621" blog, please be sure to keep this source http://12346621.blog.51cto.com/12336621/1913565

Linux System Command Review 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.