All process by all users :
ps aux | less
VSZ : Virtual Memory Size in KB
RSS : Resident Set Size ( physical Memory , not swapped )
TTY : Started in Background NOT in Terminal if it as '?'
STAT : State of the running process
TTY : Terminal
This above command will remove or filter with -v or It won't appear in the screen.
Below is the Tree , how the process started one by one,
pstree | less
ps aux | sort -nk 4 | tail -3
( Here sort by fourth column i.e., Memory and tail 3 is the last three value which is consuming more memory )
Only giving 'ps' will show the process which are running in this terminal alone,
aux --> will provide all process in all terminal.
Monitoring :
- ps
- ps aux | grep syslogs
- top
PR : Priority
Once you press 'd' then it will prompt for entering the number. Now we can change from 3 secs delay to 1 secs delay also like below ,
Press 'f' , it will show the abbreviation of the given name which shows n 'top' command.
F for select
Space-Bar for deselect the column
Q to go-back
S for which column you need to sort
Top command to batch file ,
top -n 5 -b > /tmp/top_output.txt ( 5 is the Iteration & out to a file )
Killing a process :
& - will send it to run at the back-end.
15 - Graceful shutdown
9 - Forceful
NO SIGNAL - it saves and gets terminated
-9 - its killed
We should send only PID ? we can also send process name.
pgrep --> greps the process id
kill -1 cmd & --> even if you close the terminal , this killing process will run at the back-end.
PROCESS PRIORITY :
- Focus on 6th column , nice value.
- This is the priority value given to any process accordingly.
- You can reassign the priority or assign while start of the process itself.
Where these PID is stored ?
- /proc/
Process Information :
cat /proc/cpuinfo
File System :
df -h ( h human readable )
watch -n 5 df -h ( for every 5 secs watch the df -h )
Logs :
- tail is see the last lines in a file or log.
- '-f' is used to check the real time logs.
- /var/log --> system logs
If you want to check process which are running by specific user in TOP ,
top -u
In the below you can see , no terminal information.
But here you can see terminal information , but editing the TOP command like F , SPACE-BAR , S & Q
If you want to check only one PID ,
STARTING & STOPPING OF SERVICES :
- In TOP command , you can see TTY as '?' , that means these process are started by Operating SYSTEM not manually.
- systemctl and service commands are used , which is discussed in detail in other blog.
- systemctl list-unit-files --type service | less
- Static means ONLY ONE TIME WHEN NEEDED.
What is SYSTEMD ?
All system dot files will be here , which is used to run the daemon.
System files are present here also,
*systemctl list-unit-files --type service --all | less
*
This is the list of services which are managed by " SYSTEMD ".
There are 3 section if you notice , UNIT - it will say the dependencies , SERVICE - service level information & WANTED - Environmental files .
The environmental file contains the , details of the environmental details of the specific service.
These are the service which are managed by SYSTEMD,
SYSTEMD can manage all CHILD process also ,
systemctl list-unit-files | less
proc-sys-fs-binfmt_misc.automount
dev-hugepages.mount
These type of extension is also maintained by SYSTEMD.
Lets displace the dependencies of services ,
All the immediate dependencies are listed.
RUNLEVEL :
Now its called TARGETS. (TBD)
Also SYSTEMD can used in LOGGING, these are called JOURNALS.
Some text will be RED colour , that means it as some issue.
Latest logs,
Real time logs ,
Logs of Current BOOT session,
Note :
- syslog - which is logged when the server starts , all starting logs will be stored here.
ps aux | grep syslog
- Zombie task - Which didn't shutdown properly.
- SIGNAL 15 is the default killing process. ( graceful shutdown )
- Here in Linux , services are called daemon.
- If you are creating a service to be started at the time BOOTING , then a symbolic link will be created.
- Script10 service ( this can be used to replace the CRON Jobs ) which is by SYSTEMD
- Mask - it will make a symbolic link to null and never can be started.
Top comments (0)