You are on page 1of 3

UNIX excercise1 : Log into UNIX system as per your user_id and password.

Change your password to your account.

Find out the users who have logged currently into the system Find out the name of your terminal. Create your own directory (mydir) Move to the newly created directory (mydir) Create 3 empty files. Store your details like id, name, address in the first file ( mydetails1.txt) Store your educational details in the second file (mydetails2.txt) Store your opinion about the role of youth in politics (any topic) in the file (myopinion.txt) display the content of mydetails1.txt Combine the files mydetails1 and mydetails2 into a single file mydetails.txt Create one more link for the file mydetails1 Remove mydetails1 file. Copy the contents of mydetails file to mynewdetails file. Give all permissions for the file opinion.txt Give only the read permissions for group and others for the file mydetails List all the files in the current directory List the files and along with their permissions List all files along with hidden files List all the files which starts with my List the files whose primary names are of size exactly 3. List only cpp files List the files which end with a digit List the files which ends with a letter 's' Create a new directory opinions

Move the file myopinion to opinions directory Rename the directory opinion with opinions Create another new directory training Move to your new directory Move to the parent directory Move to the root directory Move to your home directory. Find out the Square root of 25. Find out the factors of 25 Evaluate the expression 20+3*4 How to you terminate your Unix Session

UNIX excercise2 : Find out the directory where you are currently placed.
Display the system date

Create a directory structure as follows under your home directory. HRD HR OFFICE

HRAG TRNG FIN MFG

From your home directory list the directory structure that is under the root. Create 3 empty files empty1, empty2 and empty3 under your home directory.
List all the names of the files in your whole account that start with empty.

Create a file text under HR and type a few lines. Display the contents of text. 3. Make a copy of text into another file copytext under TRNG Create a file matter under HRD and input a few sentences for it Combine the contents of the files text and matter into the file empty1.

Compare text and copytext, matter and empty1 using cmp and comm.
Display the first 5 lines of the file empty1 Display the last 3 lines of the file empty1

Create a link tmp under FIN for matter. Get inode numbers for both files? Change the permissions for copytext to rwxrw_rw_. Delete the file text. Rename copytext to mytext. Copy mytext and matter under OFFICE directory and then move both files under MFG directory. Copy OFFICE directory structure under HRAG directory in one shot.
Test to walk upwards and downwards in mytext file using more command List all the files created or modified during last 24 hours

Identify all empty files created earlier and delete them interactively. List the directory structure under your home directory and then delete the same in one shot. Use vi editor to create a file student under your home directory. Input 12 lines for the name, age, roll number and sex. Use | as the field separator. Search some pattern using the editors internal commands. (a) Use cut and paste commands to alter the field ordering in student. (b) Sort student: major key age, minor key sex; store sorted output in std. Get all users currently logged on to your system with column headers for the multi-column output and get the complete pathname of your terminal device. Try the command: $ who | tee file1 | wc l | tee file2 How to use tee such that the list of the logged users as well as their count is displayed only on the terminal and the same is not stored in any file.

You might also like