Some common operating commands for Linux system testing
In the related testing work of the LInux system, it is often encountered that it is necessary to view the system memory and some file information through commands. I specially summarize some commonly used commands and record them for easy learning and use:
1. Check the disk remaining status:
df-hT
2. Check the system resource usage:
top
3. View the overall memory usage:
free #以kb为单位显示
free -m #以Mb单位来显示
4. View all existing files in the current directory:
ls
5. Display all files and file details in the current directory:
ls -al
6. Filter files:
ls | grep ssl #过滤出包含ssl的文件
7. Display all contents of the file:
cat filename #显示filename整个内容
8. Display the specified content of the file:
tail -n 20 filename #显示filename最后20行
9. View the size of all files in the folder:
du -h
10. View the size of the specified folder:
du -sh 目录
11. Display the content of the file by page, press the space bar to display the next page, and press q to exit:
more filename
12. Delete all files in the current directory and cannot be restored:
rm -rf
13. Display the detailed information of the specified file/directory:
stat 文件名
14. View network configuration information:
ifconfig
15. Restart the system:
reboot