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:
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.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.
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.
Unix Tutorials :
4.Create File in Unix using multiple ways
12.paste Command
If you like this article on Process Commands or if any suggestion dont forget to comment in comment section.
Introduction Cryptocurrencies took the world by storm, setting up a new financial system and breaking…
In my previous article I have given Top 20 technical support interview questions with its…
In my previous articles I have given 15 most asked desktop support interview questions with…
A business analyst is someone who is versed in processes of data analysis used for…
In my previous article I have already given top questions and answers for Desktop support…
In my previous article I have given unix production support interview questions and answers. In…