0% found this document useful (0 votes)
7 views

Unix Assignment1

The document provides instructions to perform various file system operations using Linux commands like mkdir, touch, cat, rm, chmod, vi editor, wc, sort, grep, and uniq. It involves creating directories and files, manipulating file permissions, concatenating files, counting lines and characters, sorting files based on different criteria, and analyzing file contents.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Unix Assignment1

The document provides instructions to perform various file system operations using Linux commands like mkdir, touch, cat, rm, chmod, vi editor, wc, sort, grep, and uniq. It involves creating directories and files, manipulating file permissions, concatenating files, counting lines and characters, sorting files based on different criteria, and analyzing file contents.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment1

(BCAC392)
(mkdir,cd,ls,cat,touch,rm,chmod,vi editor,wc,sort,grep,uniq,pipe)

Q1.Create this above Directory structure using only command, whereas File1, File2, File3, File4 are file.
(Create file1, file2, file3, file4 using a single command.)
file1 contain below text.
Hello! This is File1.
file2 contain below text
Hello! This is File2.

Q2.Create a file called file5 and store your name, age, sex, and address in it
Concatenate the text of file1 and file2 and store it to file5 without replacing the text of file5.

Q3.1Create following files in a Desktop


art
part
part1
part2
part3
part4
mozart
tart
quartz
ab
2. List only those file whose name start with ‘a’.
3. List only those file whose name contain only two characters and first character is ‘a’.
4. List only those file whose name do not begin with a vowel.
5. List only those file whose name do not begin with [aeq].
6. List only those file name contain only 5 characters and first character is in rage [p-q] and
second character is in range [a-b], third character is in range [r-t], fourth character is in range [t-
z], and last character is in range [a-z] or [0-9].

Q5.1. Change the permission for file1 to 666.


2. Change the permission for file2 to rwxrwxrwx and again change the
permission to r_x_w_r_x
3. Change the permission for file2 to r r r and delete this file.
4. Change the permission of file1 to read, and write permission for group
and others and for owner read, write, execute.

Q6.1.Create a file using vi editor file name ‘text.txt’ and write the below lines.

Hi
Hello
Hi Hello
Hello World
Hi
Hello Linux

2. Count the number of characters and store the result to another file.
3. Sort the file with remove duplicates lines and count the number of lines and store the result to
another file.
4. Sort the file and store the result to another files.
5. Count the number of lines which begin with ‘Hi’ (remove duplicate lines) and store the result to
another file.

Q7.1 Create ‘shortlist.txt’ file using vi editor.

2233|charles harris |g.m |sales |12/12/25 |90000


9876|bill johnson |director |productions |03/12/50 |13000
5678|robert dylan |d.g.m |marketing |04/19/43 |85000
2395|john woodcock |director |personnel |05/11/47 |12000
5423|barry wood |chairman |admin |08/30/53 |160000

2. Sort the file based on name.


3. Sort the file based on salary
4. Retrieve only unique designation from the file and store it to another file.
5. Count the number unique designation from the file and store it to another file.
6. Counting the frequency of occurrences of each designation and display it.

You might also like