Wednesday, 29 July 2015

PR(05): Create a program for Display Operating System Details Like Name of OS, Login Name, Host name etc.......



while true
do
echo "1.Display Operating System Name";
echo "2.Disply Login Name";
echo "3.Display Host Name";
echo "4.Exit";
echo "Enter Your Choice";
read ch;
case $ch in
1)
uname -o
;;
2)
who
;;
3) uname -n
;;
4)
exit
                ;;
esac
done

Tuesday, 28 July 2015

PR(04): Create a program for display list of active processes, display the information of Process, Display the global priority of the process, Change the priority of process, & kill the process.



while true
do
                echo "1.Display active process in shell.";
                echo "2.Display information about process";
                echo "3.Display the Global priority of process";
                echo "4.Change the priority of process.";
                echo "5.kill the process";
                echo "6.Exit.";
                echo "Enter your choice";
                read ch;
                case $ch in
                1)
                                ps
                                ;;
                2)
                                ps -ef
                                ;;
                3)
                                ps -axl | more
                                ;;
                4)
                echo "Enter the pid of open process";
                read pid
                ps -axl | grep $pid
                echo "Enter the prioity for the process";
                read pr
                renice $pr $pid
                ;;
                5)
                echo "Enter the pid  to kill process";
                read pid
                kill $pid
                ;;
                6)
                exit
                ;;
esac
done

PR(03): Implementation of Create/Rename/Delete a Directory using Unix/Linux Command



while true
do
echo "1.Creation of directory";
echo "2.Deletion of Directory";
echo "3.Change Directory & Display  Node Details";
echo "4.Exit";
echo "Enter Your Choice :";
read ch;
case $ch in
1)
  echo "Enter The Directory Name to Be Created ";
  read dir;
  if [ -d $dir ]
  then
     echo "Directory Laready Existing!!!";
  else
     mkdir $dir;
     echo "Directory Created Successfully!!!";
     echo "Created Directory Can be Checked From the Following Table";
     ls -t | head -n 15
  fi
  ;;
2)
  echo "Enter The name Of the Directory to be Deleted";
  read dir;
  if [ -d $dir ]
  then
     rmdir $dir;
     echo "Directory deleted Successfully!!!";
     echo "Deleted Directory Can be Checked from the following table";
     ls -t | head -n 15
  else
     echo "No such Directory Exists!!!";
  fi
  ;;
3)
  echo "Changing Current Working Directory To:";
  cd /home/redhat/dm/a
  pwd
  echo "The Node Details Of Each File In The Working Directory Is As Follows:";
  ls -i
  ;;
4)
  exit;
  ;;

esac
done