0% found this document useful (0 votes)
118 views11 pages

Ex-2 Odt

This document provides instructions for exploring the Linux filesystem and practicing basic Linux commands like cd, ls, pwd, cat, cp, mv, rm, and echo. The tasks include navigating the filesystem hierarchy, examining system devices and files, managing files and directories, creating symbolic links, copying and moving files, and experimenting with options for the ls command.

Uploaded by

Kapasi Tejas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views11 pages

Ex-2 Odt

This document provides instructions for exploring the Linux filesystem and practicing basic Linux commands like cd, ls, pwd, cat, cp, mv, rm, and echo. The tasks include navigating the filesystem hierarchy, examining system devices and files, managing files and directories, creating symbolic links, copying and moving files, and experimenting with options for the ls command.

Uploaded by

Kapasi Tejas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 11

LINUX Assignment EX-2

Try the following command sequence:

cd pwd ls al cd . pwd (where did that get you?) cd .. pwd ls al cd .. pwd ls al cd .. pwd (what happens now) cd /etc ls al |more cat passwd cd

pwd

2. Continue to e plore the filesystem tree using cd! ls! pwd and cat. "oo# in /$in!
/usr/$in! /s$in! /tmp and /$oot. %hat do you see?

3. & plore /de'. Can you identify what de'ices are a'aila$le? %hich are character oriented and which are $loc#oriented? Can you identify your tty (terminal) de'ice (typing who am i might help)( who is the owner of your tty (use ls l)? Answer: cd / ls /dev who ls -l )loc# oriented means allocation of memory in manner of $loc# !in storage de'ices li#e hard dis# and apart from these are character oriented . %e can find out this in ls *l command also $y seeing permission there is mention a$out c and $ for character and $loc# oriented respecti'ely.

+. & plore /proc. ,isplay the contents of the files interrupts! de'ices! cpuinfo!
meminfo and uptime using cat. Can you see why we say /proc is a pseudo filesystem which allows access to #ernel data structures?

5. Change to the home directory of another ser directly! " sername# Answer:

sing cd

cd "g est

6. Change $ac% into yo r home directory#

Answer:

cd /home/te&as

7. 'a%e s $directories called wor% and (lay#

Answer:

m%dir wor% (lay

8. )elete the s $directory called wor%#

9. Co(y the file /etc/(asswd into yo r home directory# Answer: c( *r /etc/(asswd /home/te&as

-.. 'ove it into the s $directory (lay#


Answer: mv *r /home/te&as/etc /home/te&as/(lay

--. Change into s $directory (lay and create a sym$olic lin% called terminal
that (oints to yo r tty device# +hat ha((ens if yo try to ma%e a hard lin% to the tty device,

12. +hat is the difference $etween listing the contents of directory (lay with ls l and ls L, Answer: ls -l shows yo h ge amo nts of information li%e (ermissions! owners! si-e! and when last modified# And ls -L list the file or directory the lin% references rather than the lin% itself#

13.

Create a file called hello.t t that contains the words /hello world/. Can you use /cp/ using /terminal/ as the source file to achie'e the same effect?

0nswer: yes. Command c( /home/te&as/)es%to(/hello#t.t /dev/tty2

14. Copy hello.t t to terminal. %hat happens?

Answer: content of hello#t.t file will $e shown on to the terminal window# c( hello#t.t /dev/ sr/tty2

15. 1magine you were wor#ing on a system and someone accidentally deleted the ls command (/$in/ls). 2ow could you get a list of the files in the current directory?

Answer: we can se dir command as s ((osed we want to show doc ment directory then dir /home/te&as/)oc ments

-3. 2ow would you create and then delete a file called /452&""/? Try it.
Answer: cat / 01234ELL5 rm 01234ELL5

-6. 2ow would you create and then delete a file that $egins with the sym$ol 7?
Try it. Answer: 18. it. Answer: cat / 06te&as#t.t5 rm 06te&as#t.t5 2ow would you create and then delete a file that $egins with the sym$ol ? Try cat / 0-hell#t.t5 rm -f #/-hell#t.t

19. %hat is the output of the command: echo 8con!pre98sent!fer98s!ed9? :ow! from your home directory! copy /etc/passwd and /etc/group into your home directory in one command gi'en that you can only type /etc once. Answer: c( /etc/7(asswd!gro (8 /home/te&as 20. 5till in your home dircectory! copy the entire directory play to a directory called wor#! preser'ing the sym$olic lin#. c( -rf /home/te&as/(lay /home/te&as/wor% 2-. ,elete the wor# directory and its contents with one command. 0ccept no complaints or queries. Answer: rm *r /home/te&as/wor% 22. Change into a directory that does not $elong to you and try to delete all the files (a'oid /proc or /de'! ;ust in case<)

2=. & periment with the options on the ls command. %hat do the d! i! > and ?
options do?

You might also like