You are on page 1of 7

Assignment:-1

Student Name:SANA SACHDEVA UID: 20BCA1658


Branch: UIC

Subject Name:Red hat linux

Ques 1
List the files in the /bin directory. Create a directory dir1 in home directory and enter it. Create file as file1 and
enter your name and uid in it. copy the file1 to file2 which should be located in in /bin. Now append ur class
and section in file2. Now remove directory dir1 with single command even if it is having content inside it
Ans1:
Ques 2 Copy the file /etc/services to /var/tmp/ and configure the "ACL" as: The file /var/tmp/services should
owned by the "user1" and should belongs to the group "group1". It should not be executable by anyone. user1
should able to read and write to the file. group1 can neither read nor write to the file. And others can only be
able to read that

Ans2:

Ques 3 Display the first 12 lines of /etc/services. Display the last line of /etc/passwd. create a file file1 having
10 subject names. now display first five lines and last two lines. then display first 2 and last5 characters of file.
count the number of words and characters in file1 individually and display content along with no of lines then
sort the subject names in dictionary order and save in file name as subjectlist. display content of subjectlist in
upper case alphabets
Ans3:
Ques 4 Write one paragraph then using SED commands printout the line 2 to 5 using sed for file1. Then
replace the word the with a. Then print all the line where the is replace with is. Then search & replace I with is
and the with a for file1. Then, delete the last line and search i and replace with a. In the end delete second line
of the file1.

Ans4:

Ques 5 Write one paragraph then using regular expressions. search lines where character 'a' precedes character
'e'. Then search lines that begins with A and B. search each line which contains either 'is' or 'am' or 'are'.
Checking for full words, not for sub-strings like search ‘the’. display the lines which does not matches have
word ‘the’. show the position where it matches the pattern in the file like ‘the’

Ans5:

You might also like