Saturday, March 23, 2019


Process (ps) command: -
Part – 1: -
Q) What is process ?
Ans – It is the instance of current running command.
$ ps<Enter – Key>
This command will show all the processes name.
Q) How many processes are there ?
Ans – There are two processes, such as –
1.       System Process/ Daemon Process – These Processes are created by system.
2.       User Process – These Processes are created by User.
Q) How to see other user processes along with own user processes and also those are not associated any terminals ?
Ans - $ ps –e<Enter – Key> or $ ps –A<Enter – Key>
Q) How to see all processes in full listing ?
Ans - $ ps –ef<Enter – Key>
Where f -> Full Listing
Q) How many columns are present in ps –ef output and what are they ?
Ans – There are 8 columns such as –
1st Column (UID) – Give the User ID who will start the process
2nd Column (PID) – It is the unique id or process id that identify a process
3rd Column (PPID) – It is parent process id of PID
4th Column (C) – Nice Value of the process i.e. how much cpu gives priority for this process
5th Column (STIME) – Start Time of the process
6th Column (Terminal) – It shows the terminal which is associated with the process
7th Column (TIME) – It shows since how long this process is running
8th Column (CMD) – Process Name
Q) How we get user processes not the system process ?
Ans - $ ps –a<Enter – Key>
Q) How we get a specific user process ?
Ans - $ ps –u UserName<Enter – Key>
Q) How we confirm if a process ngs_gcc_vist_stat01.sh is running  or not ?
Ans - $ ps –ef | grep ngs_gcc_vist_stat01.sh<Enter – Key>
If you will get output as ngs_gcc_vist_stat01.sh, then you will sure that the process is running.
Q) What is the difference between ps –ef and ps –aux ?
Ans – ps –ef contains no long command line arguments whereas ps – aux contains long command line arguments.

Part – 2: -
Q) What is job ?
Ans – The Process which is running in back ground is called job.
Q) How you make a command as back ground process ?
Ans – By adding an ampersand (&) at the end of the command.
Example –
$ sleep 45 &<Enter – Key>
Output – [1] 1785
Where [1] – job id
1785 – Process id
Q) How you see all the back ground processes ?
Ans - $ jobs<Enter – Key>
Q) How you get back a process from back groung to fore ground ?
Ans - $ fg %JobID<Enter – Key>
Q) What is nohup command ?
Ans – By default, all the processes and jobs will be terminated once you come out from your shell.
If you want to continue the process for a long time, then nohup command is used.
$ nohup command & > File<Enter – Key>
Where File – the output of the above nohup command will be stored in the File.
By default, if you will not give the file name, then it will be storing to nohup.out  file.
Q) What is Nice command ?
Ans – This command will help us in setting the priority during creation of a process.
$ nice –n command<Enter – Key>
Where n – ranges from -20 to 19.
Example –
$ nice - -20 ls –lrt<Enter – Key>
Or
$ nice -19 ls –lrt<Enter – Key>
Where - -20 is more priority than -19.
Q) What is renice command ?
Ans – This command will help us in setting the priority of an existing process.
$ renice –n PID<Enter – Key>

No comments:

Post a Comment

Interview Questions: - (UNIX - 0) UNIX: -   Q) How to get inode number of a file/directory? Ans – $ ls –i <File/Directory_Name...