1. <-------------- Beginning of class --------------> 2. * Debashree_ is now known as Debashree 3. * ChanServ gives channel operator status to kushal 4. * kushal gives channel operator status to debarshi 5. * kushal has changed the topic to: Welcome to Linux User's Group of Durgapur | Mailing list at http://lists.dgplug.org/listinfo.cgi/users-dgplug.org | How to write "Hello World!" in gcc http://tv.dgplug.org/ | <-- CLASS STARTED --> 6. So today we will look at the basic Unix shell. 7. So all those who are using Unix (or GNU/Linux) right now, do you have your terminals ready? 8. * mobilesuit_num_2 (i=partha@61.2.2.114) has joined #dgplug 9. debarshi, yes 10. ! yes 11. yeah 12. Ok. 13. ! yeah 14. yup 15. Yes 16. GUYS STOP 17. that is just another me on dial-up modem on xp in lappy 18. ! 19. please type ! only 20. if we say , then only speak 21. incase power goes out 22. ! 23. ok 24. So what is a shell? Why do we need it at all? 25. Lets try to answer these questions before getting any further. 26. Any guesses from anyone? 27. for ease of user to interact with the kernel 28. The classic textbook answer is "shell is the interface between kernel and userspace programs" 29. which in turn interacts with the hardware 30. shell is the mediator between user and kernel. 31. Its an interface between usr and kernel 32. TanmayaT, before that type ! , and wait for chance 33. ! 34. Ok. Ok. 35. * Soumya (n=Soumya@117.192.9.239) has joined #dgplug 36. interface between kernel of the OS and user prog+hardware 37. You are more or less right. 38. Soumya, tell your full name to all 39. * samar (n=samar-ad@220.226.14.178) has joined #dgplug 40. For those who did not know, a shell is an interface between a human being and the rest of the operating system. 41. Hi this is Soumya Kanti Chakraborty joining in 42. Soory a bit late , was at office 43. hi All 44. So obviously without a shell, the rest of the OS is almost useless. 45. Soumya: Hello 46. * Kishan (n=Kishan@117.194.96.39) has joined #dgplug 47. hi all 48. Kishan, samar just tell your name 49. hi all I am Samarjit 50. kushal, hi kushal...I am Kishan Goyal. 51. debarshi, please continue 52. Now the Unix shells are quite sophisticated, in that they can be used in a way similar to a programming language. 53. * mavu (n=satya@59.178.170.223) has joined #dgplug 54. eg., if you want to copy all the MP3s on your system to a CD/DVD quite often,... 55. ... you can combine all the instructions that you would normally give in the form of a 'shell script'. 56. So everytime you invoke the script your CD is ready. 57. Any doubts till now? 58. ! 59. susenj: ? 60. susenj, tell 61. ! 62. i want to kno that wat we write in to the console is a shell by the way 63. *shell command 64. * n9986 (n=n9986@59.176.80.223) has joined #dgplug 65. * n9986 (n=n9986@59.176.80.223) has left #dgplug 66. susenj: Ok. 67. rtnpro: Tell. 68. 69. What is that script 70. ! 71. rtnpro, ? 72. Is it a collection of commands 73. sorry ----------------------------------------I missed the middle part ------------------------------------------------------- Debarshi: I am currently using Windows and using Cygwin to run unix environment, can please suggest me how use GCC there?? quit SDey: No. Use Google. Ok, thanks,I am searching * samar (n=samar-ad@220.226.50.76) has joined #dgplug So the most elementary commands are cd, cp, mv, rm, pwd and ls. pls let the study be continued on one topic.Sorry for interruption * partha_ (n=partha@59.93.246.223) has joined #dgplug Now Unix provides some documentation about every shell command present in the system. * nandy_lost (n=chatzill@59.178.189.146) has joined #dgplug The standard way to access the documentation about a particular command is 'man'. sorry 4 being late! So you type: $ man ls to quit when you are done with the documentation. 'man' here stands for manual. You can do: $ man man to read the manual of 'man' itself. Yeah, its showing anme, Synopsis and Description I want everyone to try 'man'. *Name * Amit_ (n=chatzill@118.95.37.230) has joined #dgplug SDey, please type ! , and then wait, when asked then only speak while the class is going on What about the others? i tried man debarshi ! * roshan (n=roshan@117.99.50.195) has joined #dgplug TanmayaT, speak * roshan is now known as _roshan debarshi , its working as you did mention above . tried Ok. Fine then. tried #man man ! SDey, yes SDey: ?? What about the -C option ? ! Many commands have a configuration file... ...to control their behaviour. ! Soumya, yes 'man' also has a configuration file which mentions where the documentation is stored on the system, how to format the man pages, etc.. debarshi, can you tell me about the man manual sections Soumya, do a $man man Soumya: Ok. i did it kushal from seeing there only i am telling , kushal Soumya: Ok. * samar has quit (Read error: 60 (Operation timed out)) Soumya, ? debarshi, A bit about $man - k ...... apropos ?? * mbuf (n=shakthim@59.92.53.17) has joined #dgplug q * rishi (n=rishi@gnu-india/supporter/debarshi) has joined #dgplug * rishi got disconnected debarshi, A bit about $man - k ...... apropos ?? Soumya: Did kushal answer your question? no debarshi So when one does: $ man ls Soumya:#man -k is it working? ... the man command looks for a man page whos name starts with 'ls'. susenj, please don't interrupt ! what is man -k? Now what happens if there are multiple pages starting with the same string? susenj, i am answering, let me first hear from debarshi ! * kamudhar has quit ("will join later") In those cases, the pages are divided into sections. Each section is identified by a natural number. eg., 1, 2, etc.. For example there are multiple pages having the prefix 'open'. So to see all the pages that are available in all the sections, do: man -a open $ man -a open let me try rishi Pressing q will take you to the page in the next section. * debarshi is now known as Guest55874 ok i got you rishi ! * samar (n=samar-ad@220.226.18.79) has joined #dgplug Soumya: But if you know which section you want, you can do: $ man 2 open Isn't q used for quiting ... to see the page in the second section. rtnpro: Yes. * Guest55874 has quit (Read error: 60 (Operation timed out)) $ man 3 open ok rishi , i got you ... to see the page in the third section, etc.. Merely doing: $ man open ...will only show the page found in the smallest numbered section. * kamudhar (i=kamudhar@117.200.16.9) has joined #dgplug roni, your question after this What about the others -- coolpyro, Debashree, kamudhar ? roni, your question roni: Ask. * nandy_lost_ (n=chatzill@59.178.189.146) has joined #dgplug asking * mobilesuit_num_2 has quit (Read error: 113 (No route to host)) i also had a question before kushal ? man -k .. apropos ? , rishi $ man ls, when page is opened at top its showing ls(1), what that indicates is it the number of pages opened roni: (1) is the section number * Amit has quit (Read error: 110 (Connection timed out)) Debashree: I was offline for a while; messed up irssi config file; so logged in back using chatzilla Soumya: Will come to that. oks ria oks rishi ok susenj, man - k is working So lets move to man's cousins. yep ,but it shows a linr only and stops *line Soumya, what does man -k does? susenj, rtnpro STOP do $man - k open rtnpro: Did you look at $ man man ? Soumya, STOP oks stop * rishi wants everyone to look up rtnpro rishi, continue sorry for interrupting you kushal, sorry Now that you know about 'man', it will be assumed that you have looked at the manual (wherever applicable) before asking any question. rtnpro, k - Equivalent to apropos. * chacha_chaudhry (n=dev@gnu-india/supporter/rakeshpandit) has joined #dgplug So lets move to man's cousins. I will look when I log into Linux rtnpro: They are available on the Internet too. ok I will do a google search * Amit_ has quit (Read error: 110 (Connection timed out)) If you are completely new to Unix, then it is highly unlikely that you will know any command. And if you don't know any command, then you can not use man because you can not tell man which manual to show. Isn't this a common situation for you? This where one can use 'apropos'. So if you want to do something which involves manipulating files, you can do: $ apropos file ... which will search all the manual pages and return those that document commands which manipulate files. Similarly if you want to do something with a directory, you could have done: $ apropos directory * _roshan (n=roshan@117.99.50.195) has left #dgplug ("Konversation terminated!") * kushal has quit (Read error: 60 (Operation timed out)) Soumya: Any queries regarding this? let me see it ! TanmayaT: Ask. Debashree: apropos chat; apropos browser; apropos editor; apropos mail.... a few more examples sorry, query answered by google kamudhar: Any problems with them? * Soumya_ (n=Soumya@117.192.8.84) has joined #dgplug nope; just gave a few examples to clarify kamudhar: Ok. rishi, i had a power cut let me check Soumya_: Can you read the older messages? no :( * SDey has quit (Read error: 110 (Connection timed out)) * nandy_lost_ has quit ("ChatZilla 0.9.83 [Firefox 1.5.0.12/2007050813]") rishi, apropos seems clear * kushal (n=kd@122.167.37.101) has joined #dgplug The third second cousin is "whatis". it mainly searches for all the commands which contains what i give in the apropos Soumya_: Yes. A brief look at 'man whatis' should be enough. * nandy_lost_ (n=chatzill@59.178.189.146) has joined #dgplug Now if you are using a GNU system (ie. GNU/Linux) you will also have 'info'. * nandy_lost has quit (Read error: 110 (Connection timed out)) * nandy_lost_ is now known as nandy_lost Usually the info pages are much more detailed than the man pages, but you might not get an info page for all the commands. 'info' is used in a way similar to man: $ info ls ! susenj: Ask. is it just the instruction ,not the whole manual,i saw # info gcc ? susenj: As I said info pages are very detailed. Almost like a book. So what you see in 'info gcc' is the contents page. ! susenj: Take your cursor to a specific topic (marked by *) and hit enter. there is a menu containing features of it * samar has quit ("Ex-Chat") susenj: Anything more? oh,fine!it was not known to me earlier thnx mobilesuit: Ask. is info a link between various pages ? mobilesuit: No. Info pages are different from man pages. * Soumya has quit (Nick collision from services.) ! * shrink has quit ("ChatZilla 0.9.83 [Firefox 3.0/2008052906]") mobilesuit, yes * Soumya_ is now known as Soumya Info pages are generally generated from Texinfo files. The same Texinfo file which generated an info page can generate a PDF containing the same information. man pages are much smaller and concise and use Troff. Read about Texinfo and Troff if you are interested. To all: If you have any question regarding what the trainer is telling ASK, or else you will only suffer rishi: any good resources on Texinfo and Troff http://www.gnu.org/software/texinfo/ * Kishan_ (n=Kishan@117.194.96.39) has joined #dgplug sorry...got disconnected.. ! Soumya, ? For Troff rishi can you explain it a bit then suggest a resource $ info emacs HTML version of Emacs' info page: http://www.gnu.org/software/emacs/manual/html_mono/emacs.html rishi, please go ahead to the next section we will take questions later So you see the same info page can be in HTML, PDF, txt, etc. too. kushal: Ok. * rtnpro has quit (Read error: 104 (Connection reset by peer)) * rtnpro (n=rtnpro@121.241.211.243) has joined #dgplug Enough of learning about how to "read the fine manual" or RTFM. Time to move on to the real stuff. :-) F => Friendly, Fine, Famous. chacha_chaudhry: Right. hi all * t4num0y_cs3 has quit ("Bye Bye..") chacha_chaudhry: Keep quiet. Class is on. ok. :) chacha_chaudhry: :) We will first see how to navigate in and out of different directories using the CLI shell. cd, pwd, basename, dirname <-- these are the relevants commands we will see. * partha__ (n=partha@59.93.246.223) has joined #dgplug Everyone please read the documentation of these commands before we proceed. arpita, please ask ! TanmayaT, yes * makghosh has quit (Read error: 110 (Connection timed out)) man cd only shows the bash builtin commands * Kishan has quit (Read error: 110 (Connection timed out)) TanmayaT, go down :p TanmayaT, or do /cd ok ! TanmayaT: $ man -a cd * partha_ has quit (Read error: 110 (Connection timed out)) i did that, thank you mobilesuit: Ask. arpita: You had a query? i read the man of basename and dirname arpita, Debashree please ask your queries but what is the actual use of these two commands ? mobilesuit: Will come to that later. mobilesuit, we will see Ok, we will move on. * kamudhar has quit ("Will rejoin in a while") ! roni, ? presenly i am unable to get the differences between the two commands roni: Will come to that. ok So once you start a shell, you are located within some directory on your system. Usually this will be your home directory, represented as $HOME or ~, but may be some other location too. $ pwd The 'pwd' command is how you find your current location. To change to someother location: $ cd /dir1/dir2/dir3 Remember in Unix paths use forward slash ('/') and not backward slash ('\'). To return to the location you were in before giving the cd command, do: $ cd - So '-' represents your old working directory. * ChanServ gives channel operator status to kushal * kushal gives channel operator status to Soumya * kushal gives channel operator status to rishi Any doubts? * kushal has changed the topic to: Welcome to Linux User's Group of Durgapur | Mailing list at http://lists.dgplug.org/listinfo.cgi/users-dgplug.org | How to write "Hello World!" in gcc http://tv.dgplug.org/ | Vi from 10:45pm By Kushal | <-- CLASS STARTED --> ! mobilesuit: Ask. what's the diff betwwen absolute and relative pathname ? ! A pathname which starts with '/' is an absolute path. Absolute paths are always interpreted with respect to the root directory. ! Any pathname not starting with '/' is a relative path. They are interpreted with respect to the current working directory, ie. the one shown by pwd. so /home/fre is absolute and when i am in /usr Yes. * Kishan_ has quit ("Leaving") ../ is relative path ? Yes. like when i am /usr/bin if i want to change to local i write ../local /usr/local sorry i write cd ../local ? mobilesuit: Yes. If you have access to a Unix shell, then try it out. mobilesuit: Anything else? ! no..i was just a bit confused rtnpro: Ask. ,EOF> I had the same doubt about absolute and relative paths Ok, It got cleared There are a few shortcuts to represent some commnonly used locations in Unix. Some of these are: (i) ~ --> home directory of user that had invoked the shell (ii) ~foo --> fome directory of user 'foo', if user 'foo' has an account on the system ( $HOME is same as ~) (iii) .. --> parent directory of current directory (iv) . --> current directory as shown by pwd So if we are currently working under /devel/gengetopt/fedora/gengetopt/F-9 ... we have: ! [rishi@ginger F-9]$ pwd [rishi@ginger F-9]$ dirname /devel/gengetopt/fedora/gengetopt/F-9 [rishi@ginger F-9]$ basename /devel/gengetopt/fedora/gengetopt/F-9 F-9 [rishi@ginger F-9]$ susenj: Ask. is there a difference between cd.. and cd.. ?? what i did is: susenj: A world of difference. 'cd..' means you are trying to invoke a command named 'cd..', which is usually not present. 'cd ..' means you are invoking the cd command with .. as its argument. ! susenj: Anything else? but sometimes both works same and sometimes differ both works ?? roni: 'cd..' will not work if you did not create a command named 'cd..'. i used this [aritra@desktop ~]$ pwd [root@localhost ~]# cd D* roni, let rishi finish [root@localhost Desktop]# cd.. bash: cd..: command not found [root@localhost Desktop]# cd .. [root@localhost ~]# i tried this cd.. (You already got the answer by the bash shell, as COMMAND NOT FOUND) it gave /home/aritra but then i did [aritra@desktop ~]$ cd .. [aritra@desktop home]$ pwd it gave /home now when home and ~ are same then why home is being shown suddenly? rishi, ! ! * amrita (n=amrita@117.201.96.141) has joined #dgplug roni, type 'pwd' in /home roni, and also in '~' roni by home rishi meant roni, and see if both are same or not so when you see ~ it means /home/roni when you do cd .. it means you went to the folder /home which is common for all the users in a unix/linux enviornment thus /home doesnt mean its /home/roni got it ?? then how to come back to [aritra@desktop ~]$ roni, cd got the previous thing whats user name you are using ? aritra@desktop not cd kushal it would be cd - yeah i got you you do cd /home/aritra Soumya, his question is how to come to ~ which is home, so the command is only 'cd' i think your machine name is aritra sorry desktop yes kushal da s solution worked you may type in cd root also ya then do that btw, whoever never typed their names, please do so I think rishi is offline for some reason both does same kushal oks roni yes Soumya, only in that situation Soumya, 'cd' is to go back to your home folder from any location 'cd -' is to go back to last directory ya that i know kushal is the class on.. of can i ask a little offtrack but a path related query? s/of/or i was telling going to ~ you can do 'cd' also you can do cd /home/username mavu_, class is on , but still ask :) by class not being on.. i meant rishi not being here.. thanks .. what i wantes to know is... if i have a software that i meed to manually install .. which also needs me to compile a few java programs... so.. when i give absolute names pathnames taht is in javac.. it does not work if i give a javac from an intermediate directory in the path it works kushal, Hello but i want it to work from the place that i want to install it mavu_, thats a problem with your classpath mavu_, use classpath -cp kushal, Its boring not trying these commands in the terminal Soumya, ping ria, pong mavu_, it depends what you have set as classpath okay... i figured that out for my comp.. but when i package the software up kushal, the lsusb command shows the modem and someone else installs then how do i set the classpath mavu_, in that case use rpm packaging rules kushal, but wvdial does not detect it mavu_, export $CLASSPATH okay mavu_: edit ur path env var. What can I do? :) thanks rtnpro, don't know, come to ##linux-india adn ask there mavu_, search the fedora wiki for the same mavu_: add da path of ur javac to that variable hmm yes ,coolpyro ,you are right!