linux server command and common operations

1. What is linux server load average?

Load is used to measure the size of the server workload, namely computer cpu task execution queue length, the greater the value, indicating including several running and running processes to be more.
Reference: http://en.wikipedia.org/wiki/Load_average 

2. How can I see linux server load

By w, top, uptime, procinfo command, or through / proc / loadavg file viewing. 

3. Server Load high how to do?

Server load (load / load average) length of the queue process according to the display.
When the server has a high load phenomenon (recommended 15-minute average for the reference), the cause may be due to lack of CPU resources, I / O read and write bottlenecks, lack of memory resources, it may be due to the ongoing CPU-intensive computing .
Recommended vmstat -x, iostat, top command to determine the cause of excessive load, and then find the specific process-intensive resources to optimize the process. 

4. How to view the server memory usage?

May, Top (performed by the memory ordering shitf + m), vmstat, procinfo command, can also be viewed through the / proc / meminfo files free. 

5. How do you view a single process memory size?

You can use top -p PID, pmap -x PID, ps aux | grep PID command, or through / proc / $ process_id (process PID) / status file viewing, such as / proc / 7159 / status file. 

6. can not log in from linux server A to server B how to do?

Please first make sure the server developers A and B belong to the same application, different applications can not cross login.
1. When the server A can not log on server B, you can use ping IP and telnet IP 36000 B command to confirm whether the server crashes, ssh service is normal.
If there is an exception, log open.qq.com Management Center to restart the server (see detailed instructions: CVM_V2 # 3.2 applications and manage server restart ). 
2. If the client can directly access the server B, but not from server A login server B, please business QQ contact operation and maintenance support to assist positioning. 

7. How do you view services and ports are being used?

You can use netstat -tunlp, netstat -antup, lsof -i: PORT command. 

8. How do you view the server process information?

You can use ps auxww | grep PID, ps -ef, lsof -p PID, top -p PID command. 

9. How do you kill the process?

You can kill the process using the kill -9 PID (process ID), killall name of the program (such as killall cron).
If you want to kill a zombie process, you need to kill the parent of the process will be effective, the command is: kill -9 ppid (ppid parent process ID number, you can find by ps -o ppid PID, such as ps -o ppid 32535). 

10. How do I find zombie process?

The total number of top command can be used to view the zombie process (zombie) using ps -ef | grep defunct | grep -v grep to find information specific zombie. 

11. How to transfer data between the internal network server?

Different machines in the same application, file transfer can be achieved by the following command:

scp -P port (port using 36,000) / home / user / localfilename (local file path) User (using appid) @serverip: / home / user / removefilename (target file path)

rsync -e 'ssh -p port (port using 36,000) -q' / home / user / localfilename (local file path) User (using appid) @serverip: / home / user / removefilename (target file path) 

12. Why not start the server port?

Start the listener server port, you need to see itself from the operating system and applications.
linux operating system ports below 1024 can only be started by the root user, that need to run sudo su - to gain root privileges and then enable the service port.
Application problems, it is recommended to start by the Application log to troubleshoot the cause of the failure, such as a port conflict (Tencent server system using the port can not be occupied, such as 36,000), configuration issues. 

13. commonly used commands linux server performance to see what?

Command Name Explanation
top Process monitoring command that monitors the overall performance of the system.

You can display the load, process, cpu, memory, paging information, and shift + m commonly shift + p cpu and memory for use by sort process.

vmstat System monitoring command, the focus has focused on virtual memory, you can also monitor the status cpu, process, memory paging and IO's.

For example, vmstat 3 10, output every 3 seconds, performed 10 times.

iostatc Means for outputting the state, and IO state cpu, can display the detailed information IO system.

E.g. iostat -dxmt 10, every 10 seconds to details of the format of the output IO MB.

df Used to check the system's disk space usage conditions.

For example: df -m, in MB show disk usage.

lsof List system is an open file, because the file system is linux based, this command is useful in system administration.

For example:
lsof -i: 36,000, 36,000 display using the port process 
lsof -u root, run the display program to root 
lsof -c php-fpm, show php-fpm process open files 
lsof php.ini, display open php.ini process.

ps Process Viewer command, detailed information display process can be used.

Common command parameter combination, ps -ef, ps aux, recommended ps -A -o customize the output field.
For example:
PS -A -o PID, STAT, the uname,% CPU,% MEM, RSS, args, lstart, etime | Sort -k6,6 -rn, and the sixth field to be sorted by output field listed
ps - a -o comm | sort -k1 | uniq -c | sort -k1 -rn | head, list up to running instance of the process.


Other commonly used commands and files, free -m, du, uptime,  w, / proc / stat, / proc / cpuinfo, / proc / meminfo.
Reference: http://en.wikipedia.org/wiki/Template:Unix_commands,http://www.linuxmanpages.com/ 

 

14. Cron does not take effect how to do?

Troubleshooting steps:
1. Verify crontab running.
Run the command crontab -e add the following test entry * / 1 * * * * / bin / date >> / tmp / crontest 2> & 1 &, then observe / tmp / crontest file. 
If there are problems, we recommend using ps aux | grep cron cron Find the pid, kill -9 PID end of the cron process, and then re-started by cron /etc/init.d/cron start. 

2. Verify that the script cron entry path to an absolute path.
3. Check the run cron user account is correct, while viewing /etc/cron.deny whether to include this account.
4. Check the script execute permissions, file permissions and directory script logs.
The background mode is recommended by running the script, the script entry is added after the "&", e.g., * / 1 * * * *  / bin / date >> / tmp / crontest 2> & 1 &

15. How to set opensuse server is powered on task?

Linux kernel boot sequence is:
/ sbin / init process starts,
followed by the init initial script,
running script /etc/rc.d/rc*.d,* level number value is equal to the operating mode, you can view the / etc / inittab in ,
finally /etc/rc.d/rc.local.

If you need to configure the boot task, can S ** rclocal configuration file in the /etc/rc.d/rc*.d can also be configured to /etc/rc.d/rc.local. 

16. Why server hard disk read-only?

Common causes of hard disk read-only as follows:
1. Disk space is full
by df -m command to view disk usage, and then delete unnecessary files to free up disk space (non-third-party file deletion is not recommended, if necessary, please contact QQ confirmation); 
2. disk inode resource usage finish
by df -i command to view, confirm that the relevant process; 
3. hardware failure.

If the application is still unable to confirm the reason for hosting the manner described above, please business QQ contact operation and maintenance support to assist positioning. 

17. How to view the system log linux?

System-level log file storage path is / var / log.
The system is commonly used log / var / log / messages.

18. How to Find File System large files?

You can view the first disk partition by df command usage, such as df -m;
then:
View the size of a specific folder by du command, such as du -sh ./*,du -h --max-depth = 1 | head -10 ;
ls command to list the files and size, such as ls -lSh;
also possible to directly view the find command to the file size below a specific directory, such as find / -type f -size + 10M -exec  ls -lrt {} \;

19. How to view the server OS version?

You can view the system version the following command:
uname -a, CAT / proc / Version, CAT / etc / Issue 

20. How to restart the server?

Method 1:
Log open.qq.com Management Center to restart the server (see detailed instructions: CVM_V2 # 3.2 applications and manage server restart ). 

Mode 2: 1 if the way is not effective, you can try to restart the server to run as root on the reboot command. 

21. Why linux terminal will display Chinese garbled?

Server itself is no language restrictions on the display, if the impact of Chinese display terminal software
can try to adjust options - Session Options - Appearance (secureCRT setting, other versions of the software look for relevant settings);
if it is pure Linux shell garbled, please use export command to view the user environment variables, see the LANG, LC_CTYPE environment variables, such settings.

22. How to set timeout CVM server connected via SecureCRT?

May be provided by the connection SecureCRT the CVM, do not disconnect:
Open secureCRT option (the Options), select the option session (Session Opetions), click on the terminal (Terminal), anti-hook idle on the right (Anti-idle) box transmission protocol selected from NO-OP (send protocol NO- OP), set time (every 120 seconds) every 120 seconds. 

24. How do I get root privileges CVM's?

See: root privileges instructions

25. Why delete files on the linux server, disk space is not released?

Phenomenon:
Log linux server, execute  rm  command to delete a file, use  df  After a review of hard disk space command, found that deleting files, available hard disk space does not increase.
The reason:
By  rm  delete file command, if there is just another process accessing the file by  df  command to view, delete files take up space is not immediately released.
Solution:
Use root privileges to perform  lsof | grep deleted  , view deleted files are using the process PID, the command  kill -9 PID  to kill the corresponding process can be. 

Guess you like

Origin www.cnblogs.com/0daybug/p/11761521.html