In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you what commands you must know in Linux. I hope you will gain something after reading this article. Let's discuss it together.
Top
The top command is a commonly used command to view the usage of system resources and the processes that take up the most system resources. Top displays all processes as columns, and the processes that account for the most CPU resources are displayed at the top.
To exit top or htop, you can use the keyboard shortcut Ctrl-C. This keyboard shortcut usually terminates the process currently running on the terminal.
Htop
The htop command is an improved version of top. By default, most Linux distributions do not have htop-- installed on Ubuntu systems to run the following command:
Sudo apt-get install htop
The htop command displays the same information as top, but its interface is more user-friendly. You can use the keyboard arrow keys to select processes and take certain actions, such as killing processes or changing their priorities.
We have explained htop in detail in the past.
Ps
The ps command lists the running processes. The following command lists all commands running on your system:
Ps-A
This command may list too much information to read. You can use the less command to pipe the output so that you can scroll through it at your speed:
Ps-A | less
When you have finished reading, you can press Q to exit.
You can also use grep to pipe the output so that you can search for a process without using other commands. The following command searches for the Firefox process:
Ps-A | grep firefox
Pstree
The pstree command can also display process information. It displays the process in the form of a tree. For example, your x system and graphics environment will appear under the display manager that generates the tree process.
Kill
The kill command can kill a process based on its ID. You can use ps-A _ top, or the grep command to get the process ID.
Kill pid
Technically, the kill command can send any signal to a process. You can use kill-KILL or kill-9 to kill stubborn processes.
Pgrep
Given a search keyword, the pgrep command returns all processes ID that match that keyword. For example, you can use the following command to find the PID of Firefox:
Pgrep firefox
You can also combine this with the kill command to kill a specific process. However, it is easier to use pkill or killall.
Pkill & killall
The pkill and killall commands can kill a process based on its name. You can kill the Firefox process using any of the following methods:
Pkill firefox killall firefox
Renice
The renice command is used to change the nice value of the process. The nice value represents the priority of the process. The nice value of-19 is a very high priority, whereas 19 is a very low priority. 0 is the default priority.
Running the renice command requires the ID of the process. The following command allows a process to run at a very low priority.
Renice 19 pid
You can use pregrep and renice together, as shown in the figure above.
If you want to raise the priority of the process, then you need to use root permissions. On the Ubuntu system, use sudo to obtain root permissions:
Sudo renice-19 #
Xkill
The xkill command is a command that can easily kill the graphics level. After running it, your cursor will change to the x symbol. Click on the window of the corresponding graphics program to kill the program. If you want to give up the operation, you can click the right mouse button to cancel.
You don't have to run this command on the terminal-you can press Alt-F2 on the graphical desktop, type xkill, and then press enter to run it. We have bound xkill to hotkeys to make it easier to kill the process.
After reading this article, I believe you have a certain understanding of "what commands you must know in Linux". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.