OS Commands
OS Commands
OS Commands
1.mkdir Mike
== create new folder in linux
2.cat >abc.txt
== concatenate file and print on the standard output
3.sort abc.txt
== sort lines of text
4.ls -l
== lists the file inside the folder
10.ps
11.ps aux
== a:prints running processes from all user
u:shows user columns
x:prints processes those have not been executed
17.cd FAMT
== to change the current working directory in various operating systems
18.cd ..
== this command is used to move to the parent directory of current directory
PRACTICAL 2
PRACTICAL 3
5. ls -lh :This command will show you the file sizes in human readable format.
10.ls -n :It is used to print group ID and owner ID instead of their names.
12.ls -g :This allows you to exclude the owner and group information columns.
PRACTICAL 4
Q1. Create a child process in linux using the fork system call from child process
obtain process id of both child
and parents by using get pid and get ppid system call.
==
#include<stdio.h>
#include<unistd.h>
int main()
{
int pid;
pid = fork();
if(pid==0)
{
printf("\n After Fork");
printf("\n The new child process is created by fork system call
%d \n",getpid());
}
else
{
printf("\n Before fork");
printf("\n The parent process id is: %d",getppid());
printf("\n parent process executed successfully");
}
return 0;
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
int main()
{
pid_t cpid;
if(fork==0)
{
exit(0);
}
else
{
cpid = wait(NULL);
}
printf("\n parent pid: %d \n ",getpid());
printf("\n child pid: %d", cpid);
return 0;
}