Вы находитесь на странице: 1из 2

LAB Assignment No.

-2
Operating Systems
(UCS 303)
Faculty: - Dr. Shalini Batra, Mr.Vinay Arora
CSED, TU

1. chown - Change file owner and group

2. chgrp change group owner

3. chown[Option]

4. chmod -Change file access permissions

5. chmod[Option]

6. sort sort line of txt file

a. -I, -f, -g, -r, -k, -o, -t

7. sort k2 file name

8. head output the first part of files

9. Head[option] ,
a. Head n, head c,

10. tail[option], out the last part of files

11. grep: Finds a String


a. The grep (global regular expression print ) utility searches through one or more files to
see whether any contain a specified string of characters. It does not change the file it
searches but simply displays each line that contains the string.

12. uniq removes duplicate lines

13. diff: Compares Two Files


14. file: Tests the Contents of a File
15. passwd: Changing Your Password

A password should meet the following criteria to be relatively secure. Only the first item is
mandatory.

It must be at least six characters long (or longer if the system administrator sets it up that way).
It should not be a word in a dictionary of any language, no matter how seemingly obscure.
It should not be the name of a person, place, pet, or other thing that might be discovered easily.
It should contain at least two letters and one digit.
It should not be your login name, the reverse of your login name, or your login name shifted by
one or more characters.
If you are changing your password, the new password should differ from the old one by at least
three characters. Changing the case of a character does not make it count as a different character

Q3. Create a file name practice. View the contents of this file.

Q4. Remove the file created and check whether the file has been removed or not?
Q5. What command should be give to remove the file in interactive mode?
Q6. Displaying a Text File One Screen at a Time

Q7. Which command is used to Displays the System Name?

Q8. First create the following demo_file that will be used in the examples below to
demonstrate grep command.

$ cat demo_file
THIS LINE IS THE 1ST UPPER CASE LINE IN THIS FILE.
this line is the 1st lower case line in this file.
This Line Has All Its First Character Of The Word With Upper Case.

Two lines above this line is empty.


And this is the last line.

Q8. Search for the given string in a single file

Q9. Checking for the given string in multiple files.

Q10. Is grep case sensitive? How can you get Case insensitive search using grep?

Q11. Checking for full words, not for sub-strings using grep -w

Q12. Is it possible to display a specific number of lines starting from a line having a particular text
using grep command?

e.g. I have a text file with the contents below:

AAA
BBB
CCC
DDD
EEE
FFF

I want to display 3 lines starting with the line having "BBB" to get the result below:

BBB
CCC
DDD

Вам также может понравиться