1.Execute the following
i.) mkdir a b c
ii.)mkdir dir1 dir1/dir2 dir1/dir3
iii.) rmdir a b c
iv.) rmdir dir1/dir2 dir1/dir3 dir1
2.If mkdir test fails, What could be the possible
reasons(any two)?
3.If rmdir test fails, What could be the possible reasons(any two)?
4.Execute ls with following options: -t, -a, -r, -l, -i,-F.
5.Execute the following
3.If rmdir test fails, What could be the possible reasons(any two)?
4.Execute ls with following options: -t, -a, -r, -l, -i,-F.
5.Execute the following
(1) cp f1 f2
(2)
cp f1 os/f2 (os is a directory)
(3)
cp f1 os
(4)
cp f1 f2 f3 os
(5)
cp f* os
6.What is the use of –i option with cp?
7.What is the difference between cat foo and cat > foo? Why do you have to use [Ctrl-d] in one and not in the other?
8.What is the difference between listing the contents of directory play with ls -l and ls -L?9.Execute the following:
7.What is the difference between cat foo and cat > foo? Why do you have to use [Ctrl-d] in one and not in the other?
8.What is the difference between listing the contents of directory play with ls -l and ls -L?9.Execute the following:
(1)
mv f1 f2
(2)
mv f1 f2 f3 os/
(3)
mv os/ unix/ (Does it make any difference if unix/
exists?Solutions
Q2.Ans: See as we know mkdir is used to make a directory, so if that directory is already available at that place that it is obvious that it gives an error that file or directory already exists until and unless we are using -p with it. And the second reason could be permission denied i.e we are not authorised to create a particular directory at that place.
Q3.Ans: rmdir test fails if that particular directory is already had been removed so it gives error that no such directory exists. And the second reason of failure is that we are not allowed to do that task i.e permission denied.
Q6.Ans: -i with cp is used for prompt before overwrite This will open a prompt before overwriting a particulas file.
Q7.Ans: cat command is used to read the content of a particulas file. In cat foo it will open up the content of the file named foo but in cat > foo it will open with blank space with cursor, if we write anything to it then the original content of foo is overwrited with those written things then to close that editing part we need to press ctrl + d and it will close saving all the changes. We can check after that using cat foo that content is changed from the original.
Q8.Ans: ls -L lists only the names of the files or directories, nothing else but ls -l lists files or directories with their complete information. It lists it's creation date, time,who created that file,file index number,where file is saved i.e inshort everything about that file.
Note:- To know how to create or delete a file please refer to the Basics of UNIX Programming Post.
Snapshot For 1,4,5,9
Q.9
1 comments:
Write commentsYour intelligence on the post could be giving us new knowledge. Write more, that's all I have to say. Free live chat with girls
ReplyEmoticonEmoticon