Linux daily management-review exercises

Source: Internet
Author: User
Tags rsync

1. View several CPU and CPU cores

# Cat/proc/cpuinfo

2. View system load, load average

W,top the average load in 1 minutes, 5 minutes, 15 minutes.

Meaning of R/b/si/so/bi/bo in 3.vmstat

R the number of processes running and waiting for CPU time slices is greater than the number of CPUs, the CPU is not enough

b Wait for the number of resource processes, I/O, memory, longer than 1, memory and other resources are insufficient

The amount of data written to memory in the SI swap area

So memory writes the amount of data in the swap area

The amount of data that the BI hard disk writes to memory (read disk)

The amount of data that Bo Memory writes to the hard disk (write disk)

How 4.buffer and cache distinguish

Cache caching, buffering between CPU and memory

Buffer I/O cache, between hard disk and memory, reducing disk read and write times

5.top Display, memory consumption

%MEM

6. View network card Real-time traffic? Network card history traffic?

# sar-n DEV 1 5 real-time NIC Traffic

# Sar-n DEV Historical traffic

# sar-n dev-f/var/log/sa/sa24 View network card traffic at a certain point in time


# SAR-Q View the load on the server at some time

7. See which processes are currently in progress

Top,ps-aux

8.ps aux display content, stat column, ss meaning? Z meaning?

Ss has interrupted the main process

Z zombie process, can't kill


D cannot interrupt a process, usually i/o;r a running process, a process that has been interrupted, a process that has stopped or is paused, CTRL + Z pauses, a process that is already dead (never appears), Z Zombie process, S system Master Process;< high-priority process, N low-priority process, l multithreading process; Foreground process.

9. See which ports are open on the system?

# NETSTAT-LNP

10. View Network Connection Status

# Netstat-an

11. Modify IP, edit which configuration file, modify the configuration file, how to restart?

# vi/etc/sysconfig/networkt-scripts/ifcfg-eno16777736

# Service Network Restart/stop/start

# Ifdown Etho/ifup eth0 (when using a remote connection, the Ifdown can no longer be connected, so ifup takes effect.) You can specify that the network card is turned off. )

12. Assign a network card with multiple IPs

#cd/etc/sysconfig/network-scripts

#cp ifcfg-eno16777736 ifcfg-eno16777736\:1

#vi ifcfg-eno16777736\:1

Device=eno16777736:1

....

Ifdown eno16777736 && ifup eno16777736 or service network restart

13. Check that the network adapter is connected to the switch, OK?

# Mii-tool eno16777736 show not supported or link OK

14. How do I check the hostname? Modify host name? Reboot is still in effect, which configuration file needs to be modified?

1.hostname;hostnamectl (view three host names static, Transsient, pretty)

2.# hostname Jasonhost temporarily modified, but restart is invalid

# Hostnamectl Set-hostname Jasonlocalhost simultaneously modifies three host names

# hostnamectl Set-hostname--static/transient/pretty jasonstatic only modify the static hostname, effective immediately, restart is also valid

3./etc/hosts configuration file

15. Which configuration file do I need to modify to set DNS?

#cat/etc/resolv.conf

Configure DNS resolution IP

#vi/etc/hosts

10.1086.90 www.baidu.com

16. Write a iptables, the source IP for 192.168.1.101 access to the native 80 port package directly rejected

#iptables-I input-s 192.168.1.101-p TCP--dport 80-j DROP

17. Want to save the iptables rule to a file? How to recover?

#iptables-save > Ipt.txt

#iptables-restore < Ipt.txt

18. How to back up a user's scheduled tasks

19. What are the first 5 numbers in the Task plan format?

Time-sharing Week

20. How to turn off services that are not used in the system

# NTSYSV visualization on Turn off service

Network/ssh/syslog/irqbalance/sendmail/microcode_ctl General Open

Or: # chkconfig--list

# Chkconfig Crond Stop

21. How to make a service, Kana nginx, only 3/52 run level Open, Other level off?

#chkconfig--level 123456 Nginx off

#chkconfig--level

22.rsync synchronization, if there is a soft connection in the source to be synchronized, how to synchronize the target file or directory of the soft connection?

# Rsync-avl test1/test2/

23.rsync Sync command, what's the difference between the following two ways?

(1) rsync-av/dira/ip:/dirb/

(2) RSYNC-AV/DIRA/IP: IRB:d

: by SSH, when the remote user logs in, the password needs to be entered manually, if the script implementation cannot be completed automatically.

:: Configuring the/etc/rsyncd.conf, configuring the [DIRB] module via the Rsync Server backend service

24. When an account is logged in to Linux, what log files will the system record related information?

# Last command to view login history information.

Binary log file:/var/log/wtmp, just this cannot be viewed directly using the Cat,vim,head,tail tool.

Another,/var/log/secure, logs authentication and authorization information, the SSH login system succeeds or is unsuccessful.

25. When there is a problem with the NIC or hard drive, which command can we use to view the information?

# DMESG

26. Use Xargs and exec, respectively, to implement this requirement to modify the permissions of all files with the suffix. txt in the current directory to 777

# Find. *.txt |xargs-n1-i{} chmod 777

# ls *.txt-exec chmod 777 {}

27. One script can run for more than 2 days, how do you make it run uninterrupted, and you can watch the output information of the script at any time?

# Nohup Sh/usr/local/sbin/sleep.sh &

Create screen

28. How to catch the package according to the following requirements: Only filter access to the HTTP service, the target IP is 192.168.0.101, catch 1000 packets altogether, and save in 1.cap file

# tcpdump

29.rsync synchronizing data, how to filter out all. txt files are out of sync?

# Rsync-av--exclude= "*.txt" test1/test2/

30.rsync when synchronizing data, if the target file is newer than the source file, how do I ignore the file?

# Rsync-avu test1/test2/

31. Want to access a website under the Linux command line, and the site domain name is not resolved, how to do?

#

32. Which file can we edit when we customize the domain name resolution? Can one IP pair multiple domain names? Does a domain name correspond to multiple IPs?

/etc/hosts

One IP can correspond to multiple domain names, but a domain name can only correspond to one IP.

Row, a domain name can only correspond to one IP. When the same domain name appears on multiple rows, the first match principle.

33. Which command can we use to view the system history load?

# W

# Top

34. How do I specify a DNS server under Linux to resolve a domain name?

# vi/etc/hosts

192.168.1.101 www.baidu.com

35. When using rsync to synchronize data, if we are using SSH mode, and the target host's sshd port is not the default 22 port, how to do?

#vim/etc/rsyncd.conf

Port=22

Log File=/var/log/rsync.log

PID File=/var/run/rsync.pid

[Test]

Path=/root/rsync

Use Chroot=true

Max Connections=4

Read Only=no

List=true

Uid=root

Gid=root

Auth Users=test

Secrets file=/etc/rsyncd.passwd

36.rsync synchronization, how to delete the target data more than the data, that the source does not exist, but the target exists in the file or directory?

# Rsync-av--delete/test1//test2/

37. When using free to view memory usage, which value represents the amount of memory actually available?

Second line: value for free

38. One day you suddenly find that the company's website access speed has become very slow and slow, what should you do? (Server can log in, prompt: You can start from the system load and network card traffic)

# sar-n DEV View network card traffic

# sar-q View historical load, view load at a certain point in the past

39.rsync when using the service mode, if we specify a password file, then the permissions of this password file is set to how many?

Permissions: 600



Linux daily management-review exercises

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.