Just paste the following commands directly into the operation window and execute them.
- Check whether the Linux system is 32-bit or 64-bit
getconf LONG_BIT
Current operating system kernel information
uname -a
View login user name
hostname
Switch superuser
sudo -i
Directly check the CPU usage of Linux
top
Check the java process
ps -ef |grep java
Check the threads under a certain process
ps -T -p 8574 (8574 is the process number of a certain process)
Check the heap, stack and other information under a thread
jstack 7221 (7221 is a thread number in a process)
We analyze the stack to see if there is an exception in the program.
- When I deploy the project, jdk is installed on the system. How do I find the installation directory where the existing jdk is located?
Check the Java version
java -version
Find the Java compiled file directory
which java --find path 1.
Generally, you can find the path of jdk by finding the path of Java file.
Note: The jdk corresponding to different Linux systems may be different. Recently, I am using Ubuntu to install jdk online:
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre
Just configure the system environment variables
and that’s it.
Recently I have been engaged in serial port communication.
Generally, the serial ports of Linux are under the /dev/ file directory.
The names starting with ttyS or ttys are all serial port names.
Check the ttyS0 serial port information
ttys -F /dev/ttyS0
Modify the bit rate of ttyS0 serial port to 115200
stty -F /dev/ttyS0 115200
We can install the putty plug-in to monitor the messages received by the serial port
sudo apt install putty.
After successful installation, directly enter the command putty
to open a window.
Select Serial, fill in the serial port and bit rate, and click Open to open a receiving box to simulate messages received by the serial port.