Get the App
SLTechnology News&Howtos  ›  Servers  › 

View commands such as start-up and running time of processes under linux

Shulou Source: shulou.com Published: 2022-06-02 16:09:58 09月16日 Update

Can be viewed by ps, viewed by parameter-o

ps -eo pid,tty,user,comm,lstart,etime | grep redis

Parameter Description:

pid: Process ID

tty: terminal

User: User

comm: process name

lstart: start time

time: running time

The results are as follows:

The difference between ps aux, ps -aux, ps -ef ps aux is to display the process in BSD format. USER , PID , %CPU , %MEM , VSZ , RSS , TTY , STAT , START , TIME , COMMANDUSER //username %CPU //percentage of CPU used by process %MEM //percentage of memory used VSZ //amount of virtual memory used by process (KB) RSS //fixed amount of memory used by process (KB)(number of pages residing) STAT //status of process START //time the process was triggered to start//time the process actually used CPU ps -ef is a standard format for displaying progress. Items displayed are: UID , PID , PPID , C , STIME , TTY , TIME , CMDps and top distinguish ps from top, which can see the process information at the moment of command execution, while top can continuously monitor ps only to view the process, while top can also monitor system performance, such as average load,cpu and memory consumption. In addition, top can also operate the process, such as changing priority (command r) and closing the process (command k)ps mainly to view the process. Focus on viewing the processes you need to view top Focus on cpu, memory usage, and the most resource-intensive processes sorted from high to low Focus on resource usage du and df in Linux and their differences

du : Displays disk space usage for each file and directory ~~~ File size.

Command parameters: -a #Displays the size of files in the directory in KB. - b #Displays the size of files in the directory in bytes. - c#Displays the size of files in the directory, and also displays the total; unit KB. - k, -m,#show file size in directory, -k in KB, -m in MB.- s #Displays only the total value of the directory in KB. - h #is displayed in K M G units to improve readability ~~~(the most commonly used one ~ may also meet the requirements only with this one)

-x #Based on the file system at the beginning of processing, skip if different file system directories are encountered. - L #Displays the source file size of the symbolic link specified in the options. - S #displays the size of individual directories without including the size of their subdirectories. - X #in the specified directory or file. - exclude= #Skip the specified directory or file. - D #Displays the source file size of the specified symbolic link. - H or-si #is the same as the-h parameter, but K, M, G are converted to 1000 units. - l #Duplicate count hardware-linked files.

df: Displays the available disk space on a disk partition

Just remember two parameters:

-a #View all file systems in KB by default

-h #Use-h option to display in KB, MB, GB units, high readability ~~~(most commonly used)

Tags: Process file unit directory size parameter command time system run memory disk link concern readability stock commonly used situation format source file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Technology Xiaomi Apple NVidia