Unix Tutorial

 
 
 

Basic Programming

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

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 Display exit status search string from string Receive list of file name which are wordfile 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 Identify directory and executable file 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 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 Delete directory with files 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 Name,size of file in dir exceeding 1000 byte 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
 
 
DATA SEGMENT
A DB 10
B DB 20
C DB ?

A1 DB 10H
B1 DB 20H

A2 DB 10O
B2 DB 20O

A3 DB 10B
B3 DB 10B
DATA ENDS
CODE SEGMENT
     ASSUME DS:DATA,CS:CODE
START:
      MOV AX,DATA
      MOV DS,AX
      MOV AH,00

      MOV AL,A
      ADD AL,B
      MOV C,AL

      MOV AL,A1
      ADD AL,B1
      MOV C,AL

      MOV AL,A2
      ADD AL,B2
      MOV C,AL

      MOV AL,A3
      ADD AL,B3
      MOV C,AL

      MOV AH,4CH
      INT 21H
CODE ENDS
END START

;OUTPUT:->
;-r
;AX=0000  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0B98  ES=0B98  SS=0BA8  CS=0BA9  IP=0000   NV UP EI PL NZ NA PO NC
;0BA9:0000 B8A80B        MOV     AX,0BA8
;-t
;
;AX=0BA8  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0B98  ES=0B98  SS=0BA8  CS=0BA9  IP=0003   NV UP EI PL NZ NA PO NC
;0BA9:0003 8ED8          MOV     DS,AX
;-t
;
;AX=0BA8  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0005   NV UP EI PL NZ NA PO NC
;0BA9:0005 B400          MOV     AH,00
;-t
;
;AX=00A8  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0007   NV UP EI PL NZ NA PO NC
;0BA9:0007 A00000        MOV     AL,[0000]                          DS:0000=0A
;-t
;
;AX=000A  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=000A   NV UP EI PL NZ NA PO NC
;0BA9:000A 02060100      ADD     AL,[0001]                          DS:0001=14
;-t
;
;AX=001E  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=000E   NV UP EI PL NZ NA PE NC
;0BA9:000E A20200        MOV     [0002],AL                          DS:0002=00
;-t
;
;AX=001E  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0011   NV UP EI PL NZ NA PE NC
;0BA9:0011 A00300        MOV     AL,[0003]                          DS:0003=10
;-t
;
;AX=0010  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0014   NV UP EI PL NZ NA PE NC
;0BA9:0014 02060400      ADD     AL,[0004]                          DS:0004=20
;-t
;
;AX=0030  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0018   NV UP EI PL NZ NA PE NC
;0BA9:0018 A20200        MOV     [0002],AL                          DS:0002=1E
;
;-t
;
;AX=0030  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=001B   NV UP EI PL NZ NA PE NC
;0BA9:001B A00500        MOV     AL,[0005]                          DS:0005=08
;-t
;
;AX=0008  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=001E   NV UP EI PL NZ NA PE NC
;0BA9:001E 02060600      ADD     AL,[0006]                          DS:0006=10
;-t
;
;AX=0018  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0022   NV UP EI PL NZ NA PE NC
;0BA9:0022 A20200        MOV     [0002],AL                          DS:0002=30
;-t
;
;AX=0018  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0025   NV UP EI PL NZ NA PE NC
;0BA9:0025 A00700        MOV     AL,[0007]                          DS:0007=02
;-t
;
;AX=0002  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0028   NV UP EI PL NZ NA PE NC
;0BA9:0028 02060800      ADD     AL,[0008]                          DS:0008=02
;-t
;
;AX=0004  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=002C   NV UP EI PL NZ NA PO NC
;0BA9:002C A20200        MOV     [0002],AL                          DS:0002=18
;-t
;
;AX=0004  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=002F   NV UP EI PL NZ NA PO NC
;0BA9:002F B44C          MOV     AH,4C
;-t
;
;AX=4C04  BX=0000  CX=0043  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0031   NV UP EI PL NZ NA PO NC
;0BA9:0031 CD21          INT     21

    Related Post:
  1. Program to calculate the gross salary

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

  3. Shell script to perform string replacement in a file and view the content of file

  4. Shell Script to delete the zero sized file using if and for

  5. Print the calendar of December 2006

  6. Shell script to check dir directory if it exists then change the path, if not then create dir with that name and also check for file name not exists

  7. Write a shell program to concatinate two strings and find the length of the resultent string

  8. Shell script to perform operations like compare string, concatenate, find length, occurrence of word in a string and reverse a string

  9. Write a shell program to concatenate the contents of 2 files

  10. Count no.of character in file abc?

  11. Write a shell scripts which works similar to the Unix commands Head Tail

  12. Convert first1.txt file to hidden file

  13. Script to count and report the number of entries present in each subdirectory mentioned in the path, which is supplied as a command-line argument

  14. Copy abc.txt into xyz

  15. Shell script which takes year as an input and displays whether it is leap year or not. If year is not provided then take current year as an input

  16. Shell Script to create a pyramid of number

  17. Write s shell script, which will receive any number of filenames as arguments. The shell script should check whether every argument is a file or a dir

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

  19. How would you count the number of words, lines and character of a file?

  20. Program to calculate the sum of its digits