Online troubleshooting commands-Shell, online troubleshooting-shell

Source: Internet
Author: User
Tags disk usage
1. Track the online log to refresh the latest content regularly
tail-fn 200 $ log
2. Find the specified string
#Show only matching lines
grep $ String $ file
#Match the upper and lower n lines of the string
grep-C n $ String $ file
#How many lines match the string
grep $ String $ file | wc -l
#Match string highlighting
grep --color $ String $ file
#Using regular
grep-E $ String $ file
3. Intercept the call time printed by logman
# Provided by Hisashi
grep $ String service.log | awk-F'class '{print $ 1}'
Zh
# Provided by Yang Mu
grep $ String service.log | awk-F '[()]' {print $ 4} '
4. View service port
netstat-anp | grep java
lsof-i: 8080
5. View some information in the process
ps-ef | java grep
ps aux | java grep
6. View the JVM process
jps
# With jvm parameter information
jps -v
# Show only id
jps -q
#Output parameters of main method
jps -m
#Output complete package name, application main class name, jar full path
jps -l
7. View files
ls
# View all files
ls-a
# List file permissions
ls-al
# Display file size and sort it by time
ll -thr
8. Copy files remotely
# Copy files from remote server to local
scp root @ host: /dir/file.f/home/
# Copy local files to remote server
scp /home/file.f root @ host: / dir /
9. Storage status check
# View
free-m
# memory size
free-m | grep "Mem" | awk '{print $ 2}'
10.View multiple cluster server configurations
# View
polysh 'xxx <01-04> xxx <01>'
11. Observe system process status
# View top information
top
# System uptime and load average
uptime
# Refresh every 5 seconds, with CPU usage data on the far right
vmstat 5
> Https://linux.cn/thread-12037-1-1.html

12. View disk io
# View
iostat
# Basic Information
iostat -d -k 1 10
13. Check disk usage
# View
df-h
14. Find files
# Find
find path -name "* .conf" -print
15. A few more basic commands for entertainment ~
# 看谁 在线.
w
who
#View the login log.
last
#Login logs for all accounts.
lastlog
# increase user
adduser xxx
#change Password:        
sudo passwd xxx
#Shut down
shutdown-h now
#Restart now
shutdown-r now
#Cut off the power and restart (requires root privileges), it is not recommended.
reboot
#Logout command
logout
#View rules
sudo iptables -L
# View Date
date
16.File directory class
# Create directory
mkdir directory name
# Delete empty directory
rmdir directory name
#Unconditionally delete subdirectories (rm command is not recommended, use mv instead)
rm-rf directory name
# Change the current directory
directory name
# View your own directory
pwd
# View the current directory size
du
#Show directory file list
ls-l (-a: increase display of hidden directories) where: blue: directory; green: executable file; red: compressed file; light blue: link file; gray: other file; white text on red background: wrong link file
# Browse documents
more filename.txt
less file name.txt
#Copy file
cp source file destination file (-r: include directory)
17. kill the process
# kill process
kill [parameter] [pid]
HUP 1 Terminal disconnected
INT 2 Interrupt (same as Ctrl + C)
QUIT 3 Exit (same as Ctrl + \)
TERM 15 Termination
KILL 9 Mandatory termination
CONT 18 continue (as opposed to STOP, fg / bg command)
STOP 19 Pause (same as Ctrl + Z)

————————————————
Copyright statement: This article is the original article of the CSDN blogger "Allen-X", which follows the CC 4.0 BY-SA copyright agreement.
Original link: https://blog.csdn.net/u010827436/article/details/46564673
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.