Unix Tutorial

 
 
 

Basic Programming

Name,size of file in dir exceeding 1000 byte Display ls -l command result for inputted file Calculate 3+4+5+6 Combine file in file horizontally and vertically Show msg “Good Morning/Good afternoon on time Count no.of lines in file abc Addition on two operands dec, bin, oct, hex Display all user name, or user of group Display time in word Enhance calendar to accept any month Find lines containing number in file

File Programs

Split large file into small files Display alternate digit in 7 digit number Users currently working Find position of substring in given string Sort numeric file Create and remove more than one dir together Check inputted dir is in current directory or not Find value of number raised to power of another Display name of files having multiple links Display message, user name, terminal name etc Display file in column format Menu driven calculator using case Ask your name, program name, enrolement number Perform string replacement in file Delete zero sized files from dir, sub-dir Calendar of 2007 Convert file to lower case or upper case

Mathematical Program

List all hidden files in current directory Display digit which are odd position in 5 digit no Display login name,terminal name,date,time Count length of user input string Find out difference between two files Remove entire directory structure Count and report no of entries in subdirectory Calculate sum of its digits Copy, rename, delete, edit file Binary search method Copy abc.txt into xyz Find avg of no entered in command line Broadcast msg to specified user when loged on Find lines in file with words longer than 4 char Search files and rename Morning, afternoon, Evening wish based on time List of file have read, write, execute permission

String Programs

Rename file from first1.txt to first2.txt Print first 5 odd numbers Prepare marksheet of the student Name of users who are login Compare two files List hidden files in current directory Separate colon from given item Print name of sub-dir present in current dir Calculate area & perimeter of rectangle DB operation like view, add, delete records Bubble sort Change permission of file Find smallest of three numbers Change term, prompt and user list of unix sys Count char, lines and words in particular file Check every argument is file or dir Display exit status search string from string Receive list of file name which are wordfile

Sorting Programs

List all files start with a or A Calculate 9/5 Receive log name, obtain info from /etc/passswd Count number of words, lines and char of file Count no.of words in file abc Subtraction on operands dec, bin, oct, hex Create pyramid of number Identify directory and executable file Calculate the gross salary Cconcatenate contents of 2 files

General Programs

Combine two files to single file Find gcd for 2 given numbers Command work as spelling checker Check whether string is palindrome or not Check dir if it exists then change the path Check two file contents are same or not Prime numbers from 1 to 300 Check file is ordinary or not Display message, user name, terminal name etc Identify directory and executable file Find out sum of numbers using command line arg Find sum, avg and product of four integers Compare string, concat, length, occurrence of word Make file,dir display cur dir,list,make,change dir Get today\’s date Menu driven script for Copy, Remove, Move file

Directory Programs

Sort file abc.txt and save sorted file in xyz.txt Find largest among 3 given numbers Information about all current program running Concate two string find length of resultent string Change permission of file as 644 Create directory and remove directory Display Current dir, List dir, Make, Change dir Calculate factorial of number Spell cmd on file, Collect list - spelling error Echo suitable message if less then ten char Append abc.txt, xyz .txt Display digit are in odd position in 5 digit no Exchange values of two variables Find position of substring in given string Delete file from every dir above present dir Calendar of December 2006 Reverse the contents of file

Date, time, year Program

Convert first1.txt file to hidden file Find sum, avg and product of four integers Take Logname,UID find terminal this user logged in Machine\’s name in the network Find out common lines between two files Display current working directory Check dir directory if it exists then change path Menu driven calculator Measure size of a file Sort file See content of the file Add, sub and mul 2 no passed as command line arg Reverse number supplied by user Count no of words, char, space, symbols Check whether such files already exist Leap year or not Copy first file to second, third to four

Searching Programs

Count number of words, lines and char of file Find sum of digits of number Find total no. of user and currently loggedin Print message shown in description Count no of character in file Names of all sub-directory in current directory Hard Link, Soft Link, Counting each of links Delete directory with files Convert distance in meters,feet,inches,centimeter Change extension of an existing file Sort Numeric file Create file with 10 lines, display from 5 to 8 Find sum of series sum=1+1/2+...+1/n Functionality of “mv” command with example Convert contents into uppercase in particular file Renaming each files in dir
 
 
echo  \"\\t\\t\\tMenu\\n
    1]  Display Current dirctory\\n
    2]  List Directory\\n
    3]  Make Directory\\n
    4]  Change Directory\\n
    5]  Copy A File\\n
    6]  Rename A File\\n
    7] Delete A File\\n
    8] Edit a file\\n
    Enter Your Choice:- \\c\"
    read choice

case \"$choice\" in
    1) pwd ;;
    2) ls ;;
    3) echo \"Enter the Name Of Directory :-\\c\"
       read dir 
       if [-z $dir]; then
           echo \"you have not enter the dir\" 
       else if [ ! -e $dir]; then
        mkdir $dir
       else 
        echo \"Dir Already Exists\"
       if;;
    4) echo \"Enter the Name Of Directory :-\\c\"
       read dir 
       if [-z $dir]; then
           echo \"you have not enter the dir\" 
       else if [ ! -e $dir ];then
          echo \"Dir Not Found\"
       else
        cd $dir
       if;;     
    5) echo \"Enter Soures File:-\\c\"
       read sfile
       if [-z $sfile];then
           Echo \"Enter the Destination file\"
           read dfile
           if [-z $dfile];then
                cp -i $sfile $dfiile
           else
                echo \"You have not Enter Destination\"
           if
      else
        echo \"You have not entered Sorce File\"
      if ;;
    6)echo \"Enter Soures File:-\\c\"
       read sfile
       if [-z $sfile];then
           Echo \"Enter the Destination file\"
           read dfile
           if [-z $dfile];then
                mv -i $sfile $dfiile
           else
                echo \"You have not Enter Destination\"
           if
      else
        echo \"You have not entered Sorce File\"
      if ;;    
    7)echo \"Enter the File\"
      read delfile
      if [-z $delfile] ; then
          echo \"you have not Entered File\"
       else if [ ! -e $delfile]
             echo \"File Does not Exist\"
      else
         echo \"Confirm Delete [y/n] :- \\c\"
           read  delans
            if [$delans -e y -o delans -e Y];then
               rm $delfile
           if 
     if;;
    8)exit
esac

    Related Post:
  1. Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links

  2. Remove entire directory structure

  3. Write a shell script to find the sum, the average and the product of the four integers entered

  4. Write a shell program to exchange the values of two variables

  5. How would u get today\’s date?

  6. List all files start with a or A

  7. Rename a file from first1.txt to first2.txt

  8. Execute the command which display login name, the name of your terminal and date and time of since user logged in

  9. Write shell script that takes a file name as an argument and deletes this file from every directory above the pwd

  10. Shell Script to find out the sum of the given numbers using command line argument

  11. menu driven shell program which have the options change the term, change the prompt and user list of unix system.

  12. Unix Commands and description of ls,logout,mkdir,rmdir,rm,cd,man,talk,write,pico,pine,more,sz,rz,telnel,ftp,archie,irc,lynx,gopher,tin,trn,passwd etc

  13. Write a shell script to convert a file to lower case or upper case as specified by user.

  14. Count no.of words in file abc?

  15. How to find out common lines between two files?

  16. Write a shell scripts that finds total no. of users and finds out how many of them are currently logged in.

  17. Write a shell script to sort the given numbers in descending order using Bubble sort

  18. Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal)

  19. Shell script to display the name of those files (in the given directory) which are having multiple links

  20. Prepare the marksheet of the student