Linux View system Status and backup

Source: Internet
Author: User
Tags rsync

1. How do I see the current Linux system with several physical CPUs and the number of cores per CPU?
Cat/proc/cpuinfo
Divide the total number of cores of the CPU by the number of physical CPUs to get the number of cores per CPU.
2. Check the system load there are two common commands, which are the two? What do these three numbers mean?
W and uptime, the first value represents the average load value of the system within 1 minutes, the second value represents the average load value of the system within 5 minutes, and the third value represents the average load value of the system within 15 minutes.
3. Vmstat R, B, Si, so, bi, bo What do these columns mean?
R: Indicates the number of processes running and waiting for CPU time slices
B: Number of processes that are waiting for resources
Si: Represents the amount of data written to memory by the swap area
So: The amount of data written to the swap area by memory
BI: The amount of data read from a block device
Bo: The amount of data written from a block device
4. In the Linux system, do you know how to differentiate between buffer and cache?
Cache (cached) is to save the read data, re-read if hit (find the required data) do not read the hard disk, if not hit the hard drive. The data will be organized according to the frequency of reading, the most frequently read content in the most easily found in the location, the content is no longer read to the back row, until removed from it.
Buffer (buffers) is based on the disk read-write design, the decentralized write operations centralized, reduce disk fragmentation and hard disk repeatedly seek, thereby improving system performance.
5. When using top to view system resource usage, which column represents memory consumption?
Res This column represents the amount of physical memory consumed
6. How to check the network card traffic in real time? How do I view historical network card traffic?
Sar-n DEV 1 100
Sar-n DEV can view the day's historical network card traffic
Sar-n dev-f/var/log/sa/saxx where xx is the date
7. How do I see which processes are currently in the system?
PS aux
8. PS when viewing the system process, there is a column stat, if the current process of the stat for SS what meaning? What do you mean by Z?
The SS represents the main process, and Z represents the zombie process
9. How do I see which ports are open on my system?
Netstat-lnp
10. How do I check the status of My network connection?
Net-an
11. Want to modify the IP, which configuration file to edit, after modifying the configuration file, how to restart the network card, so that the configuration takes effect?
/etc/sysconfig/network-scripts/ifcfg-eth0
Restart Network Service with service network Restart after the modification is complete
12. Can I configure multiple IPs for a network card? If so, how to configure?
Nic configuration file name is typically ifcfg-eth0 if you need to bind more than one IP address to the first network device, just create a file named ifcfg-eth0:0 in the/etc/sysconfig/network-scripts directory
13. How do I see if a network adapter is connected to the switch?
Mii-tool eth0 or Mii-tool eth1
14. How to view the host name of the current host, and how to modify the hostname? What configuration file do I need to modify to continue to take effect after reboot?
Enter the command hostname can view the current hostname, modify the host name can be through the command: hostname newhostname
The configuration file needs to be modified/etc/sysconfig/network if the reboot is still in effect
15. Which configuration file do I need to modify to set DNS?
Need to modify/etc/resolv.conf,
If you modify the file and then restart the network services DNS related settings are lost, you need to add dns1=xxxxx such settings in/etc/sysconfig/network-scripts/ifcfg-eth0
16. Write a rule using iptables: direct rejection of packets with source IP for 192.168.1.101 access to native 80 ports
Iptables-i input-s 192.168.1.101-p TCP--dport 80-j REJECT
17. How do you want to save the Iptable rules to a file? How to recover?
Save: Iptables-save > 1.ipt
Recovery: Iptables-restore < 1.ipt
18. How do I back up a user's task schedule?
Copy the user's cron file directly cp/var/spool/cron/username/bak/
19. What does the preceding 5-digit table mean in the task plan format?
From left to right, then to: minute, time, day, month, week, command line
20. How can I turn off the unused services in the system?
Use NTSYSV or use chkconfig servicename off
21. How to make a service (if the service name is Nginx) open only in 3, 52 runlevel, other levels off?
Chkconfig--level
What is the difference between the following two methods in the rsync Sync command?
(1) rsync-av/dira/ip:/dirb/
(2) RSYNC-AV/DIRA/IP: IRB:d
(1) rsync-av/dira/ip:/dirb/is synchronized via SSH
(2) RSYNC-AV/DIRA/IP::d IRB is synchronized via the Rsync service
When Rsync is synchronized, how can I synchronize the destination file or directory of a soft connection if there is a soft connection in the source to be synchronized?
Rsync-l
24. When an account logs on to Linux, what log files will the system record related information?
There are two log files: 1)/var/log/secure This record verifies the user information of the process 2)/var/log/wtmp This log records the user information successfully logged in
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 the requirement to modify the permissions of all files with the suffix. txt in the current directory to 777.
LS *.txt | Xargs chmod 777
LS *.txt-exec chmod 777 {} \;
27. There is a script that 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?
Using the screen command
28. Under the Linux system, how to capture the package according to the following requirements: only to filter out the HTTP service, the target IP is 192.168.0.111, catch 1000 packets altogether, and save to 1.cap file?
TCPDUMP-NN-S0 host 192.168.0.111 and Port 80-c 1000-w 1.cap
When rsync synchronizes data, how do I filter out all. txt files that are out of sync?
rsync--exclude = "*.txt"
When rsync synchronizes data, if the target file is newer than the source file, how do I ignore the file?
Plus-u option
31. Want to visit a website under the Linux command line, and the site domain name has not been resolved, how to do?
Modify/etc/hosts to add parsing records, or use Curl-x
32. Which file can we edit when we customize the domain name resolution? Can one IP correspond to multiple domain names? Does a domain name correspond to multiple IPs?
Edit/etc/hosts, can be an IP corresponding to multiple domain names, not a domain name on multiple IP
33. Which command can we use to view the historical load of the system (e.g. two days ago)?
Sar-q-f/var/log/sa/saxx where xx is two days before the date
34. How do I specify a DNS server under Linux to resolve a domain name?
Dig @DNSip domain.com
35. When using rsync to synchronize data, if we are using SSH, and the target machine sshd port is not the default 22 port, then how do we do?
Rsync "--rsh=ssh-p Port"
When Rsync synchronizes, how to delete the data of the target data, that is, the source does not exist, but the target exists files or directories?
Rsync--delete
37. When using free to view memory usage, which value represents the amount of memory actually available?
The second line-/+ Buffers/cache corresponding to the number of free
38. One day you suddenly find that the company's website access speed is slow and slow, what should you do? (Server can login, prompt: You can start from the system load and network card traffic)
First login to the server, first look at the load situation, using command W, if the first value is large, and then use Vmstat 1 to see what the lack of resources caused by the high load, can be calculated by r,b,si,so a few columns because of the lack of resources. For example, the R column value is large, you need to use the top command to see which process consumes more CPU, if the number of Si,so two column changes frequently, it means that there is not enough memory, you can also use the top command to see which processes occupy more memory.
If the system load is not high, you need to check the network card traffic is normal: Sar-n DEV 1 10 compared to the usual network traffic to see if normal.
When Rsync uses the service mode, if we specify a password file, how much permission should the password file be set to?
or 400

Linux View system Status and backup

Related Article

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.