Categories: Unix Tutorials

What are Process Commands in Unix | Unix Filter commands

Process Commands in Unix :

In previous articles i have explained about the unix filter commands as well as file commands in unix.You can look in to unix directory commands also.In this article i will explain the process commands in unix.  These process commands are used to filter the data in the file. In this article i will try  to explain all the commands related to process with real life exmaples:

  1. Touch
  2.  PS
  3. Kill

Touch Command :

If user wants to change the timestamp , or create or modify timestamp Touch command is used. Touch command is used to work with server Operating system timestamp.Following are some important options of Touch command :

Syntax :

$touch [options] Filename….

  1. -t  : This option is used to create a file in specified time
  2. -r  :This option is used to access and modify the time
  3. -m : This option is used to change the modification time
  4. -a : This option is used to change access time only
  5. -c : If file does not exist do not create it.
  6. -d : This option is used to access and modification time

1.1.Create Empty File / Files:

Syntax :

$touch File1…File2…File N

Touch command is used to create single empty file or multiple empty files.

Example :

$touch Amit Radha

1.2.Change File access time :

Touch command is used to change access and modification time.User can use -a option to change the access time and modification time in touch command.-a option of touch command will set the current date and time to the file.

Syntax :

$touch -a Filename

Example :

$touch -a Radha

The above command will set current date and time to the file named Radha. You can check the file date time modified by using ls command:

LS -ltr

Output :

Radha 03-may-2017 09 : 46 : 45

1.3.Change the modification time :

If user wants to change only modification time of file and access time remains as it is then user needs to use touch command with -m option.

Syntax :

$touch -m Filename

Example :

$touch -m Radha

The above command will change the modification time of file named ‘Radha’.

1.4 . Avoid Creating new file :

To avoid creating a new file if it does not exist user can use -c option of touch command.

Syntax :

$touch -c Filename

Example :

$touch -c Radha

The above command will avoid creating a new file if file ‘Radha’ does not exist.

1.5.Explicitly Set Access and Modification Time :

User can explicitly set access and modification time with specified date format.

Syntax :

$touch -c -t [Format needed] Filename

Example :

$touch -c -t YYDDHHMM Radha

$touch -c -t 17101010 Radha

If you want to see the time format of the same file :

$ls -i

Output:

Radha May 03 10:10

1.6. Use the Format from other file :

User can copy the timestamp format of other file and set it to his own file also by using -r option.

Syntax :

$Touch -r File1 File2

Example :

$Touch -r Amit Radha

The Access time/modification time format of Amit has been assigned to the file named Radha.

2.ps Command :

Process is nothing but program in execution. To manage and to see the active processes on unix operating system ps Process Commands is used. ps basically stands for Process Status’ which is used to display currently running processes in unix operating system. ps command provides the real time view of running processes.

Useful Options of PS Command :

1.-a : This option shows all running processes on terminal with exception of group leaders.

2.-u : This options fetches the information of user and what user is doing.

3.-c : It displays Scheduler data

4.-d : This option displays all processes with exception of session leaders.

5.-f : It displays full listing of processes.

6.-e :It gives the every process running on that terminal

7.-j : It is used to display group id and session ids of the process

8.-l : This option displays long listing

Real Life Exampes with Syntax :

2.1.To Find processes running on to your terminal :

Syntax :

$ ps

Is the command to shows the processes which are running.

Output :

Pid       tty      time   command

2269     3a       0.05      sh

396       3a       0.00      ps

ps is designed to display only the processes that are running at your terminal.

2.2.To Find The other user processes :

Syntax :

$ ps –a

The above command is used to find out which processes are running for the other users who have logged in.

Output:

Pid      ppid   pgid  winpid     tty      time   command

2269      1        147    4444       3a       0.05      sh

396         2      148     7445      3a       0.00      ps

2.3.To see what particular user is doing :

Syntax :

$ ps – u

user1 to see what a particular user is doing. u stands for user and user1 is the username.

Output :

Pid       tty      time   command

2269     3a       0.05      sh

The process in the output is process run by user 1.

2.4. Processes from particular terminal :

Syntax :

$ ps –t

The ps -t  the command used to find out the processes that have been launched from a particular terminal.

2.5. To Find out additional process information :

$ ps –f gives additional information about process such as Parent process ID start time, name of process running. The sched is the father of all processes and this gets launched when the machine is booted.

2.6. To know process running at instance:

$ ps –e is the command to know about every process running at that instance.

3.Kill:

 $ kill Pid:  When invoked kill command sends a termination signal to the process being killed. We can employ sure kill signal to forcibly terminate a process. Signal number for sure kill is 9

Syntax :

$ kill Option

Example :

$ kill -9 2398

Note: System processes like sched and vhand cannot be killed using the sure kill signal.

Click on Topic You want to learn:

  1. History of SQL
  2. SQL Create Table(DDL in SQL)
  3. SQL DML Statements(INSERT,UPDATE,DELETE)
  4. SQL Select Statement Execution
  5. Operators in SQL
  6. Views in SQL
  7. Materialized View in SQL
  8. Joins in SQL
  9. Inner Join / Outer Join
  10. Full Outer Join / Cartesian Join
  11. Union and Union ALL
  12. Intersect and Minus
  13. Indexing in SQL
  14. Rank and Dense Rank
  15. SubQueries and Correlated Subqueries
  16. Parser and Optimizer
  17. Oracle 11 G new Features
  18. SQL Functions List
  19. Constraints in SQL
  20. Database Normalization
  21. Table Partitioning
  22. Pivot in SQL
  23. Difference Between Truncate,Delete and drop
  24. Oracle System Tables

Unix Tutorials :

1.What is unix?

2.Basic unix commands

3.File Commands in unix

4.Create File in Unix using multiple ways

5.Cat Command

6.Touch Command

7.Mkdir command

8.rmdir Command

9.pwd command

10.Cd Command

11.cut Command

12.paste Command

13.tr Command

14.Cp Command

15.wc command

16.cmp command

17.Rm Command

18.Grep Command

19.Egrep Command

20.FGrep Command

If you like this article on Process Commands or if any suggestion dont forget to comment in comment section.

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Share
Published by
Amit S

Recent Posts

What is Root Cause Analysis (RCA) With real examples

In my previous article I have given details about application support engineer day to day…

4 weeks ago

Application Support Engineer Day to day responsibilities

In my previous articles I have given the roles and responsibilities of L1,L2 and L3…

4 weeks ago

What is mean by SLA ( Service Level Agreement) with Examples?

In my previous articles i have given the hierarchy of production support in real company…

1 month ago

What is Production support Hierarchy in organization?

In this article i would like to provide information about production support organization structure or…

1 month ago

What are roles and responsibilities for L3 Support Engineer?

In my previous article I have given roles for L1 and L2 support engineer with…

1 month ago

What are roles and responsibilities of L2 Engineer?

I have started this new series of how to become application support engineer. This article…

1 month ago