Vous êtes sur la page 1sur 3

UNIX ASSIGNMENT----1

1. Write a command to list all the files inside a folder i.e. if there is a folder inside a folder then
it should list all files inside the sub-folder which is inside the folder to be listed.
2. How will you copy a directory structure dir1 to dir2 ? (with all the subdirectories)
3. How can you find out if you have the permission to send a message?
5. What is the command for printing the current time in 24-hour format?
6. What is the command for printing the year, month, and date with a horizontal tab between the
fields?
7. Create the following files: chapa, chapb, chapc, chapd, chape, chapA, chapB, chapC, chapD,
chapE, chap01, chap02, chap03, chap04, chap05, chap11, chap12, chap13, chap14, and chap15.
8. With reference to question 7, What is the command for listing all files ending in small letters?
9. With reference to question 7, What is the command for listing all files ending in capitals?
10. With reference to question 7, What is the command for listing all files whose last but one
character is 0?
11.With reference to question 7, What is the command for listing all files which end in small
letters but not a and c?

12. Assuming you have a directory containing the following files:


sprite,cola,choco,orange,book,lemon,lotus,apple Use the ls command to list only those files that
a)consist of four letters
b) begin with the letter c
c) end with the letter e
d) have the second letter o

13. For a file named myfile in the working directory, do the following:
a) give everyone permission to read myfile. No other privilege is to be changed
b) allow the owner and group members to read and write the file. All privileges are to be
removed for everyone else.

c) remove write privileges from everyone except the owner


d) allow the owner and group members to execute myfile and give only the owner permission to
read or write to it.
4. For a directory myfolder in your working directory, do the following:
a) allow everyone to list files in myfolder. No other privileges are to be changed.
b) allow the owner to and group members to list, remove or add files. All privileges are to be
removed from everyone else.
c) give write privileges to everyone except the owner
d) allow the owner and group members to execute myfolder. Only the owner gets read or write
permission.
14.What is a filter? Where does a filter get its input from?
15. List the users logged in more than once.
16.Can you create a file whose filename is . or ..? Will mv bar1 bar2 work if bar1 and bar2 are
directories?Give both questions a short explanation.
17.How can you show a complete listing of all files, directories,and those files and directories
under these directories in your home directory?
18. How will you list the files of the parent directory?
19.How do you noniteractively and globally replace Basic with Java in all lines of a file in vi?
20.Name three ways of quitting vi and saving the file.
21.Name three major differences between UNIX commands and Windows programs.
22. How is the current directory indicated in the value of PATH?
23.Use the type command with the arguments-cd,date pwd and ls.which are the internal
commands in the list?
24. What is difference between an argument and an option?
25.If a command doesnt seem to complete,which ley will you press to interrupt it?
26. State two reasons for not having a filename beginning with a hyphen?
27. What is the one thing that is common to directories, devices, terminals, and printer?
28. Can the files note and Note coexist in the same directory?
29.If rmdir c_progs fails,what could be the possible reasons?
30. How do you run ls to (i)make directories and executables separately,(ii)display also hidden
files?

31. What will cat foo foo foo display?


32. How will you remove a directory tree even when its not empty and witout using rmdir
33. How will you display only the lines common to two files?
34. The command cmp foo1 foo2 displays nothing.what does it include
35. Show the octal representations of these permissions (i)rwxr-xrw-(ii)rw-r-----(iii)x-w-r
36. What will the permissions string look like for these octal values (i)567 (ii)623 (ii)421
37. If a files permissions are 000 can the superuser still read and write the file?
38. If the owner doesnt have write permissions on a file but her group has,can she edit it?
39. In the current line,how do you take cursor to (i)the 40 th character (ii)the beginning (iii) the
end?
40. You wrongly entered the word Comptuer.how will you correct it to computer?
41. How do you combine five lines into a single line?
42.How will you search for a pattern printf and then repeat the search in the opposite direction
the orginal search was made?
43. How do you link foo1 to foo2 using (i)hard link (ii)a symbolic link?if you delte foo2 does it
make difference?
44.How can you make out whether two files are copies or links?
45.State whether true or false: (i)the rm command removes only a hard link but not symbolic
link. (ii)A symbolic link has the same inode number as the file it is linked to
46. ls l foo the access time of foo changes?true or false
47. use find to locate in /bin and /usr/bin all the filenames that (i)begin with z (ii)have
extension .html or .java.

Vous aimerez peut-être aussi