Linuxx Assignment Tycs
Linuxx Assignment Tycs
1
i) Create three empty files with name a1, b2, c3.
ii)
Create three files with names f6 , g7 , h8 using cat command with some meaningful contents with at least five lines each.
v) Copy the files a1 and b2 to the directories dd1. Copy the files f6 and g7 to the directories dd2
Viii .Display the login name of all users currently logged in the system.
Assignment 1.1.2:
1) Add at least 5 records in product1<seatno>. Fields are separated by || . Make a copy of product1<seatno> into product2<seatno>.
2)
Create a subdirectory COMP1<seatno>. Change to this directory & copy two files product1<seatno> and product2<seatno>.
3)
Make a copy of file product1<seatno> into file product3<seatno>. Display their inode numbers.
4)
Assignment 1.1.3:
A) Write and execute the commands for the following: 1) Create a copy of file item1<seatno> into file item2<seatno>.
B) Write and execute the commands to change the directory to /bin and do the following: 1) List all filenames.
6) List all filenames with exactly three characters in which the second character is a vowel
Assignment 1.1.4
Write and execute the commands to change the directory to /etc and do the following: i)List the contents of the directory.
2) List the contents of the directory along with all hidden files.
Assignment 1.2.1 :
Write and execute the commands for the following: 1) Display /usr/sbin one screen at a time
4) Display and count all the lines in the file /etc/mime.types 5) Display the last 10 lines of /etc/mime.types
Assignment 1.2.2:
Construct the commands and execute them to 1) Create a file named fsp<seat_no> having the listing of atleast 50 lines (e.g, listing of /usr/sbin or /usr/bin or /etc or can create your own).
2) Display first 2 lines of fsp<seat_no> and convert all the characters into capital letters. 3) 3) Display the last 15 lines of fsp<seat_no>.
5) Split the file fsp<seat_no> into subparts each having at most 20 lines and display the contents of these subparts and count the number of lines in them.
Assignmenmt 1.2.3:
Write and execute the commands for following: Create a subdirectory new<seatno>. Change to this directory & create two files new1<seatno> and new2<seatno> with two different contents with atleast five lines each.
2) Append the contents of new1<seat_no> to new2<seat_no>. Redirect the output to the file new3<seat_no>.
Assignment 1.2.4 :
Write and execute the commands to create a file with the name Stud<roll_no> with the following fields separated by a blank space having the below mentioned values: 1) Insert at least five appropriate records and do the following:
2) Sort the data on first names only. 3) Sort the data on the Marks only
Assignment 1.2.6.:
Write and execute commands to create a file named name<roll_no> with fields (first name, second name, last name, salary) separated by : .Insert at least five appropriate records in above file. Perform following sort operations: 1 Sort on first names only. 2 Display only those records whose first names start with a vowel.
Assignment 1.2.9
A) Write and execute commands for the following: Create a file item1<seatno> with following fields having the mentioned type of values
Item code Item name Unit of measure Numeric Character Character Price Quantity Numeric Numeric
1) Add at least five records in item1<seatno>. Fields are separated by : . 2) Sort them according to their prices.
B ) Create a file named student<seatno> with fields (Rollno, Student name, Marks). Fields are separated by colon (:).
Write a shell script to perform the following options on that file: Print the content of the file. Rename the file. Delete the given file. If above three are not then print error message.
Assignment 1.2.10 : Write down the commands and execute them for the following: 1) Create a file called test<seat_no>. Create a hard link called h_test and a symbolic links_test. Find out the inode number of the files. 2) Remove the original file test. Can you still get the contents of the original file?
3)
Display the contents of the two files h_test and s_test. Justify the output.
Assignment 2.1.1 :
Write and execute commands 1) To create a file named fod1 with some contents having the following contents and display it in 1) octal form only 2) octal form along with its text contents.
2) To create two files named fcmp1 and fcmp2 which consists of at least five lines with two or three similar lines. Construct the commands using cmp 1) to check whether the files differ 2) to compare the two files byte by byte.
Assignment 2.1.2 : Create two files named fcmp1 and fcmp2 which consists of at least five lines with two or three similar lines. Construct the commands 1.using diff : -(i) to display the lines which are common to both ,the lines which are not common to both . (ii) to display the difference in context output format. iii) to display the unified output format.
2) Using comm. : i)to compare the files fcmp1 and fcmp2 ii) to display the lines which are unique to fcmp1 and fcmp2 . iii) to display the lines which are common to the fcmp1 and fcmp2
Assignment 2.1.3: Create two files named fcmp1 and fcmp2 which consists of at least five lines with two or three similar lines. Construct the commands
1) Using nl to give the line numbers to lines in fcmp1. 2) Using cat to append the fcmp1 to fcmp2 and sort this appended fcmp2 and store it in a file
named funiq1.
3) Using uniq : 1) to remove the duplicate lines in funiq1. 2) to count the duplications and prepend number to each line 3) to display the duplicate lines only
Assignment 2.1.4: Write and execute the commands to 1) Create a file fcmp1<seat_no> with six lines containing six names 2) Add two more names and save the contents in fcmp2<seat_no>.
3) Sort the contents of file fcmp1<seat_no> . 4) Display the names, which are common to fcmp1 <seat_no>, and fcmp2<seat_no>.
5) Append the contents of fcmp1 <seat_no> to fcmp2<seat_no> and store it in the file fcmp3<seat_no>.
Assignments 2.1.5 : Create two files with at least three fields(columns) each with the names fcut1, fcut2 and do the following: 1) Cut first two columns from fcut1 and store the contents in the file cutlist1 and cut the second and the third column from the fcut2 and store it in cutlist2.
3)
Translate the first three lines into capital letters using tr command.
Assignment 2.1.6
Create the file with the name gre2 and the following contents: The grep is an acronym for globally search a regular expression and print it. The command searches the specified input globally for a match with the specified pattern and displays it. While forming the pattern to be searched we can use shell metacharacters, or regular expressions as professional unix users call them. 1) Search for the word line and display the lines containing it. 2) Search for the word the or The in both the files gre1 and gre2 and display the lines containing it.
3)Display the lines, which end with the characters from s to z from gre1 and gre2.
Assignment 2.2.1:
Create a file with the name fvi1 with atleast ten lines.Perform the vi commands to the following cursor movements: -3 words to the right
Bottom of screen
Assignment 2.2.2 :
Create a file course<seat_no> with following fields and the values of corresponding type: Course code Course name Batch code Duration (in days) Fees Character Numeric Numeric Character Character
Fields are separated by ":" (colon). Open a file course using vi editor. Write and execute vi commands for the following: 1) Move three lines down at a time.
Go to line number 10
Assignment 2.2.3 :
Use sed editor for the following: Create a file with five records with the name fsed1and do the following using sed command: 1) Display first three lines. 2) Display the last line.
3) Display the third and fourth line. 4) Insert two more records and save the new file as newsed.
Assignment 3.1 :