It shows, the given process uptime in the form of [[DD-]hh:]mm:ss, in seconds, and exact start date and time. Make a note: You may think the same details can be found on top command output. No, It shows you the total CPU time the task has used since it started. It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc.
To do so, you need to find the PID of a process , we can easily identify it by using pidof command. You can choose to display a certain set of processes by using any combination of options like -A -a , -C , -c , -d , -E , -e , -u , -X , -x , and others. If you specify more than one of these options, then all processes which are matched by at least one of the given options will be displayed.
To display all running processes for all users on your machine, including their usernames, and to show processes not attached to your terminal, you can use the command below:.
You can also use the top task manager command in Linux to see a real-time sorted list of top processes that use the most memory or CPU. Type top in your terminal and you'll get a result like the one you see in the screenshot below:. An alternative to top is htop which provides an interactive system-monitor to view and manage processes. It also displays a real-time sorted list of processes based on their CPU usage, and you can easily search, filter, and kill running processes.
Just type htop in your terminal and you'll get a result like the one you see in the screenshot below:. Killing a process means that you terminate a running application or command. You can kill a process by running the kill command with the process ID or the pkill command with the process name like so:. To find the process ID of a running process, you can use the pgrep command followed by the name of the process like so:.
To kill the iTerm2 process in the screenshot above, we will use any of the commands below. We need to combine multiple commands, and our knowledge of UNIX based systems to find uptime of a process. Here, is the process id. By the way, if there is more than one Java process running on your server, then you might want to use a more specific grep command to find the PID.
Once you have the PID, you can look into proc directory for that process and check the creation date, which is when the process was started. By checking that timestamp, you can easily find from how long your process has been running. In order to check the timestamp of any process id in the procs directory, you can use following UNIX command with the option -ld as shown below:. Find centralized, trusted content and collaborate around the technologies you use most.
Connect and share knowledge within a single location that is structured and easy to search. Is it possible to get the start time of an old running process? It seems that ps will report the date not the time if it wasn't started today, and only the year if it wasn't started this year. Is the precision lost forever for old processes? You can read ps 's manpage or check Opengroup's page for the other formatters. The ps command at least the procps version used by many Linux distributions has a number of format fields that relate to the process start time, including lstart which always gives the full date and time the process started:.
This is a slightly tricky unit to use; see also convert jiffies to seconds for details. This should give you seconds, which you can pass to strftime to get a human-readable, or otherwise timestamp. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to get the start time of a long-running Linux process? Ask Question.
0コメント