Basic Linux TutorialIntroduction – What is it? Why to learn? Linux installation directory structures Boot process Run levels in Linux Desktop Environments Different shells BASH Internal and External Commands Basic Linux Commands Important files and directories in Linux Environmental and Shell Variables Command history in Linux Character classes in Linux Text editors vim nano Searching files Creating new files Viewing File Contents File commands File permissions and ownership WildCards (Globbing) in files File compression Directory commands xargs command in Linux Comparing files Searching patterns using grep command Translating the characters using tr command Extracting data using cut command Stream editing using sed command Data extraction and reporting using awk command Sorting the file or string input uniq command in Linux Difference between grep, tr, cut, sed and awk commands Hardware commands Hard disk and memory space commands Working with Processes Managing Jobs Working with cron jobs Service command in Linux Network commands Managing Users and Groups Other Popular commands Standard streams and Redirection Pipes Package Managers in Linux
process commands in linux shellA process is nothing but a binary file that is currently executing (running). For example – When you execute ls command in Linux, the /bin/ls binary starts running. Every process has a parent process associated with it except the init process. When you execute any command in shell, the process that is created is a child process of a shell and a shell process is the parent of that process. You can find the process id of shell by executing below command.
Here list of commands related to processes in Linux.
- ps – list the processes
- top – more detailed information about the processes
- kill pid – kills the process by id
- killall processname – kills process by name
- pstree command – shows the process tree
ps command in Linuxps command lists down the processes started in current shell.
To list down all processes of specific user, you can use below syntax.
To list down all processes in a system, you can use below command.
ps -u <User_Name>
top command in Linuxtop command shows all processes in the system. It also shows cpu usage, memory usage, status of process, user of process etc.
kill command in Linuxkill command terminates the process by id. Below command will kill process with id 1233
here -9 means kill forcefully. Terminate signal is sent to the process. To view all signals, you can use below command.
kill -9 1233
killall command in Linuxkillall command terminates the process by name. Below command will kill all nano processes.
killall -9 nano
pstree command in Linuxpstree command shows the process tree of the system. We can easily find the parent and child of each process using pstree.
Complex problems, Simple Solutions