13:00:31 #startmeeting Fedora classroom 13:00:31 Meeting started Thu Aug 10 13:00:31 2017 UTC. The chair is FranciscoD. Information about MeetBot at http://wiki.debian.org/MeetBot. 13:00:31 Useful Commands: #action #agreed #halp #info #idea #link #topic. 13:00:31 The meeting name has been set to 'fedora_classroom' 13:00:43 #meetingname "Fedora classroom - Command Line 101" 13:00:43 The meeting name has been set to '"fedora_classroom_-_command_line_101"' 13:00:51 #topic Hello! 13:01:02 Hi 13:01:09 Hello 13:01:16 hi 13:01:18 Hi ! 13:01:22 hello 13:01:37 Hello everyone! Welcome to another Fedora Classroom session. While we wait for folks to sign in, please introduce yourselves. Name and timezone will do, and if you have an FAS username, please mention that too so that we can give you a badge! 13:01:58 .hello ankit1997 13:01:59 ankit01ojha: ankit1997 'Ankit Raj Ojha' 13:02:07 .hello ankursinha 13:02:07 FranciscoD: ankursinha 'Ankur Sinha' 13:02:11 .fas linuxmodder 13:02:12 linuxmodder: linuxmodder 'Corey W Sheldon' 13:02:14 I'm Ali from Sarajevo 13:02:18 Note - (This command will only work for Fedora contributors) 13:02:54 to all newcomers and new names WELCOME 13:02:55 Only 3 people here? I thought there were more folks around ;) 13:03:12 #chair linuxmodder ankit01ojha shantorn 13:03:12 Current chairs: FranciscoD ankit01ojha linuxmodder shantorn 13:03:12 two more there FranciscoD 13:03:16 good day all 13:03:20 Dominik CEST FAS skalarock24 13:03:21 I'm Erwan from France 13:03:21 I'm André. I'm in Brazil GMT-3 and I think I'm asch on FAS. Only used it to edit the wiki once. 13:03:22 fatek from so. cal 13:03:25 shantorn, decided to join nice 13:03:30 i am not a chair thank you 13:03:31 .hello asch 13:03:32 FranciscoD: asch 'André Schwarz' 13:03:38 JOIN 13:03:41 shantorn: too late :P 13:03:46 Hi name is Arman +3 13:04:07 asch++ 13:04:07 FranciscoD: Karma for asch changed to 1 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 13:04:09 Hi there. I'm Antonin from Czech Republic. 13:04:12 Its seems there are many people connected to channel but not introduced yet 13:04:17 there's a cookie to get your started asch_ :) 13:04:20 FranciscoD, hello you awnry man 13:04:34 s/your/you 13:04:36 would any newcomers not introduced please give a quick intro ? 13:04:52 we'll begin with the session in another few minutes - no worries 13:04:57 shantorn: hello - long time :) 13:05:03 FranciscoD: ty :) 13:05:06 i'm in the PST time zone 13:05:11 FranciscoD: what is asch ? 13:05:12 it is a pleasure as always old friend 13:05:26 linuxEnthusiast: that's his FAS username - if you sign up for Fedora, you'll get one too 13:05:28 * Southern_Gentlem is here 13:05:35 FranciscoD, i am new to Fedora 13:05:37 FAS = Fedora Account system - https://admin.fedoraproject.org/accounts/ 13:05:39 Southern_Gentlem, morning 13:05:40 .hello jbwilla 13:05:41 Southern_Gentlem: Sorry, but you don't exist 13:05:45 linuxEnthusiast: That's me 13:05:48 Godoshian: got a Fedora username yet? 13:05:49 .hello jbwillia 13:05:50 i don't think I have a FAS account but i have a red hat developer account 13:05:50 Southern_Gentlem: jbwillia 'Ben Williams' 13:06:00 Godoshian, welcome 13:06:01 asch_: aha sorry my bad :) 13:06:19 Godoshian: ah, ok, you'll have to get an FAS account too - all Fedora infrastructure is linked to it 13:06:33 OK, waiting 4 more minutes for any late comers 13:06:40 +1 have a FAS account 13:06:43 .hellomynameis pany 13:06:44 pany: pany 'Pany' 13:06:49 In the meantime, these are the notes I've made for this session: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 13:06:54 .hello hdost 13:06:55 FranciscoD: Sorry, but you don't exist 13:06:58 .hellomynameis hdost 13:06:59 hdost: Sorry, but you don't exist 13:07:00 everything from pagure and WP instance on up Godoshian 13:07:17 hdost: either you've marked your account as private, or you haven't mentioned your IRC nick in FAS 13:07:21 pany++ 13:07:21 FranciscoD: Karma for pany changed to 1 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 13:07:23 FranciscoD: that seems nice 13:07:45 must i do it now 13:07:52 .hellomynameis hdost 13:07:54 hdost: Sorry, but you don't exist 13:07:55 Godoshian: no, no need 13:07:59 boo 13:08:08 but before you wish to touch fedora infra you wil 13:08:13 this session doesn't require you to have an FAS account 13:08:34 * TCMSLP waves 13:09:08 FranciscoD, i will have to leave at the 50min mark from now 13:09:09 hello TCMSLP - welcome to the classroom session 13:09:10 TCMSLP, welcom 13:09:20 shantorn: no worries, you probably know most of this already ;) 13:09:22 welcome TCMSLP 13:09:33 Right, let's get started 13:09:36 welcome meirc 13:09:42 #topic Pre-requisits 13:09:45 thx 13:09:51 welcome mech 13:09:53 #info A linux system - preferably Fedora since that's what I'm using 13:10:04 #info A terminal emulator - any one - running bash 13:10:41 #info The only windows you'll need open will be your IRC client, and the terminal emulator - we'll try and get all our help offline! 13:11:30 #info If you have a question, please use "?" to get a chairs attention - we'll give you turns. If it's a general query, I'd suggest waiting till the end of the session to ask your question. 13:11:41 That way, the session will maintain it's flow :) 13:11:44 .hello baoboa 13:11:45 baoboa: baoboa 'None' 13:11:51 baoboa++ 13:11:51 FranciscoD: Karma for baoboa changed to 1 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 13:11:53 ;) 13:12:10 OK, a bit of background - to set the context up 13:12:15 #topic Introduction 13:12:46 So, you've got all your fancy hardware, and one needs a program to be able to interact with it 13:13:19 This is what the kernel does - you have your drivers and whatnot, and the kernel sends and receives information from your hardware - your input/output devices, all of it 13:13:50 hello to you all, that's CEST+1 for me 13:13:50 Now, for us (users) to be able to tell the kernel what to do, we need some software too - that's where the shell comes in 13:14:23 The shell is a program that provides some basic commands that permit the user to carry out various tasks 13:14:52 There is more than one shell too - we're using bash for this session, which is a pretty commonly used shell, but you also have csh, tcsh, zsh, and other variants. 13:15:14 They're similar but provide different features - please give them all a try to satisfy your curiosity :) 13:15:33 For this session, here are my notes - https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 13:15:46 The most important section there is the "command pool" section 13:16:05 If you have a query, please say "?" 13:16:14 Else, I'll proceed with "builtins" 13:16:34 brezoi, welcome 13:16:36 * FranciscoD waits 13:16:46 notes https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 brezoi 13:17:00 #info Notes for this session - https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 13:17:10 linuxmodder: thanks 13:17:15 OK, let's move then :) 13:17:22 #topic builtins 13:17:37 These are commands that come "with the shell" - as the name says, they're built in 13:17:41 brezoi, we are about to go into built ins if any questions give '?' to get our attentiom 13:17:58 There are lots, and I'll come to them in due course 13:18:10 let's first see how we can get some help 13:18:26 try: man builtins 13:18:46 the manual for builtins should open up - to navigate use your up and down arrows, to quit, press q 13:18:59 this is a page from the Linux manual - most commands will have a manual 13:19:16 similarly, try: man bash 13:19:33 if you run into trouble, let us know using "!" 13:20:24 Man pages are usually quite comprehensive - they give you details on how commands work, what options you can give them, what bugs can be expected, and even examples of usage 13:20:45 And, these are offline - i.e., they're on your computer - there's no need to connect to the internet to view man pages 13:21:03 Of course, please also try: man man ;) 13:21:27 pay attention to syntax in a man page some commands have funny [ ] {} syntax for what is what 13:21:33 +1 13:22:01 if you were able to view the man pages, let us know by saying +1 13:22:09 +1 13:22:10 +1 13:22:13 +1 13:22:14 +1 13:22:17 +1 13:22:26 +1 13:22:27 +1 13:22:29 +1 13:22:32 +1 13:22:34 +1 13:22:35 +1 13:22:38 #info +1 13:22:43 +1 13:22:57 Great, so a quick look at "builtins" then 13:23:17 They're all mentioned in man builtins. Let's begin with some directory related ones 13:23:36 Note, that most linux commands are named so that you easily know what they do 13:23:48 for example, "cd" means "change directory" 13:23:58 so, let's do that then - try cd / 13:24:14 that's "cd" followed by a space and a "/" 13:24:38 you've changed to "/" - which is referred to as "root" 13:24:49 try the following commands and see if they do what you expect: 13:24:59 ls - list directory contents 13:25:02 note: root != /root/ 13:25:11 pwd - present working directory 13:25:20 linuxmodder: +1 13:25:28 linuxmodder: +1 /root/ is the "home folder" for the user called "root" 13:25:54 now, instead of only ls, try: ls -l 13:26:24 also, try: ls -lsh 13:26:49 for hidden files ls- a 13:26:52 "-l" and so on are referred to as "options" or "flags" 13:26:56 ankit01ojha: will come to that ;) 13:27:04 the -l -lsh are known as switches ( adding additional functionality or clarity to the base command) 13:27:20 most commands have a "default behaviour", and additional options can be used by specifying flags 13:27:35 if you're good till now, let me know by going +1 again :) 13:27:47 ls is not technically 'builtin', at least not in the builtin manpage, correct? 13:27:50 +1 13:27:52 +1 13:27:53 brezoi: +1 13:27:56 +1 13:27:57 +1 13:27:58 +1 13:27:59 +1 13:28:00 +1 13:28:01 +1 13:28:11 brezoi: that's correct - it has it's own man page - man ls 13:28:11 +1 13:28:15 +1 13:28:18 trivia: what is ls -lsh showing ? 13:28:32 permissions 13:28:34 and 13:28:39 ? 13:28:48 date 13:28:49 data sizes in human readable format. 13:28:52 open to all to answer 13:28:52 ownerships 13:28:54 +1 13:28:55 +1 13:29:23 also the timestamp, but you can read more on the specifics later 13:29:28 r=read, w=write, x=execute 13:29:33 meirc: +1 13:29:34 trivia 2: how would you show a selinux context with ls ? 13:30:07 linuxmodder: probably not worth going into if we're not going to speak about selinux ;) 13:30:14 ok, here's another great builtin: apropos 13:30:25 try: apropos builtin 13:30:31 what does it give you? 13:30:44 TheKanterist, welcome to our class notes:https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit 13:30:49 simliar commands 13:31:09 brezoi: sort of - it goes through the man page database and lists man pages that may have the term "builtin" in them 13:31:20 that's a list of man pages 13:31:30 so, it's a great way of finding man pages 13:31:39 for instance, try: man ssh 13:31:43 er.. apropos ssh 13:32:05 you'll see a list of man pages related to ssh and then you can read the one you think contains the info you're looking for 13:32:30 If apropos does not work for you, let us know by saying "-1" 13:32:42 (sometimes the mandb needs to be updated - sudo mandb_ 13:32:49 jadupl2, , welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit 13:32:50 (sudo mandb) 13:33:09 ls is the default alias in fedora \ls is from the $PATH 13:33:26 baoboa: we're coming to aliases in a minute ;) 13:33:33 ok 13:33:43 ok, everyone knows "clear" - go ahead and "clear your screen" 13:33:51 hit "cd" again 13:33:58 use "pwd" to see where that gets you ;) 13:34:40 you should be in your user's home directory 13:34:42 Poornima, welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit 13:35:01 if you're there, use +1 to let me know, if you arent, use -1 to let me know 13:35:12 +1 13:35:14 +1 13:35:21 +1 13:35:21 +! 13:35:23 +1 13:35:23 +1 13:35:24 +1 13:35:32 +1 13:35:44 Ok, great 13:35:46 good so far 13:35:49 +1 13:35:49 try another builtin: which 13:35:59 it isn't a built in actually 13:36:01 the two new comers still making sense to you ? 13:36:13 yes 13:36:18 but, try the following - which ls; which pwd; which which; which man 13:36:34 heretical, welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit 13:36:45 +1 13:36:47 heretical, we are at builtins 13:36:59 "which ls; which pwd; which which; which man" - try that in one line - see what you get 13:37:06 without the quotes, of course 13:37:18 you'll learn something about ";" 13:37:35 which tells you where a command is defined 13:37:56 did anyone see an "alias" mentioned in the output of "which ls"? 13:38:05 yes 13:38:05 ye 13:38:06 yes 13:38:08 great 13:38:11 yep 13:38:15 yes 13:38:17 yes 13:38:18 yes 13:38:25 try these two commands: "ls" and "\ls" 13:38:37 see if the output differs - it should 13:39:18 now, try this: "alias ls=ls", and check "ls" and "\ls" again - now the output should be the same ;) 13:39:29 if it is, let us know using +1 13:39:29 r we start yet? is this live? testing 1 . . . 2 . . . 3 ( so whats the topic 4 2day ) linux cli. OK! Question: how come in windows DiskPart "clean all" is taking 1h 30min ( HHD 250GB ) and on Fedora Desktop Utility zero all 2h 27 min ( i'm like what the hell ) 13:39:40 +1 13:39:49 DeathRowRecords: wrong channel, please go to #fedora 13:40:04 -_-? 13:40:08 +1 13:40:09 +1 13:40:09 +1 13:40:13 +1 13:40:17 +1 13:40:28 +1 13:40:32 great! 13:40:32 +1 13:40:35 +1 13:40:43 what alias does is lets you modify the definition of a command 13:40:56 DeathRowRecords, this is a class on cli not a help channel #fedora is 13:41:15 you can go back to the initial definition by using alias ls="ls --color=auto" 13:41:35 aliases come in handy 13:41:52 for instance, usually, rm is aliased as alias rm="rm -i" 13:42:00 quickly look at the rm man page to see what -i does! 13:42:12 class on cli i got ya but there is slight big differences with question ( good manners ) and please help 13:42:14 tip - to search a man page, use /blah 13:42:24 skamath, x3mboy, dominicpg, welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit 13:42:32 DeathRowRecords: please go to the right channel - at present, you're disturbing the class 13:42:41 -i prompt before every removal 13:42:47 brezoi: +1 13:42:53 makes rm safer ;) 13:43:19 Ok, let's go on to other commands then - we'll go through various tasks and learn that way 13:43:20 interactiveness is almost a must with a command like rm 13:43:55 NOTE - as far as possible, never run "rm" with sudo/su - it's extremely dangerous! 13:44:09 #topic Commands, hands-on fun! 13:44:18 is everyone in their home directory? 13:44:23 cd if you aren't 13:44:44 (cd ~) 13:44:45 +1 13:44:48 +1 13:44:52 +1 13:44:56 +1 13:44:58 +1 13:45:00 +1 13:45:09 +1 13:45:10 try: tree -L 1 13:45:10 note: cd can traverse or reverse several directories like cd ../../test 13:45:22 also try: tree -L 2 13:45:24 tree -L 3 13:45:47 brezoi: ~ is optional 13:45:55 +1 13:45:59 now, try: tree -L 1 / 13:46:12 +1 13:46:12 +! 13:46:20 skamath, Dave__ , welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit. We are at commands sections ( hand ons 13:46:21 and, tree -L 1 ../../ 13:46:24 FransicoD: oh yeah 13:46:32 Well all the best and goodbye :D ( i suggest using "man" page for everything in command line :P ) everything i see here i know :( and nothing new 2 learn 13:46:35 aditya_r: is that a stray shift? :) 13:46:47 DeathRowRecords: it's a 101 session ;) 13:46:51 :) 13:47:05 for the last two commands, you'd get the same output 13:47:27 in tree -L 1 /, you specified an "absolute path" - you said exactly what directory you want to see 13:47:56 in the second version, tree -L 1 ../../, you specified a "relative path" - you said what path you wanted relative to where you are now 13:48:01 ".." is the parent directory 13:48:11 so ../../ means parent of parent of this 13:48:30 also if you want to ignore . .. in an ls command ls -A is handy 13:48:56 yea - try this: ls -lAsh 13:49:03 and compare if with ls -l 13:49:15 what extra files/folders do you see? 13:49:24 trivia: ls -lsh shows a . and .. what are they? 13:49:59 you already know what .. is, you can guess what . is ;) 13:50:05 try: tree -L 1 . 13:50:35 did everyone see files/folders who's names start with a "." when using -a/-A? 13:50:49 yes 13:50:51 Hidden files 13:50:51 here, files/folders starting with a "." are "hidden files/folders" 13:50:55 x3mboy: +1 13:50:58 take care all! 13:51:03 +1 13:51:09 +1 13:51:14 yes 13:51:25 +1 13:51:27 +1 13:51:28 Ok, let's do some shakespeare ;) 13:51:48 try: mkdir "20170810-fedora-classroom" 13:52:01 I'll leave you to guess what mkdir does 13:52:21 then run "rmdir 20170810-fedora*" 13:52:38 use ls to confirm that these two worked as expected 13:52:53 all good? :) 13:52:58 +1 13:53:01 +1 13:53:02 +1 13:53:05 +1 13:53:13 yes 13:53:17 +1 :) 13:53:18 Great, make the directory again - just to keep things organised 13:53:30 mkdir "20170810-fedora-classroom" 13:53:37 let's download a play from Gutenburg 13:53:40 try: wget http://www.gutenberg.org/cache/epub/1120/pg1120.txt 13:54:02 +1 13:54:15 Oh, sorry, too much for android 13:54:25 +1 13:54:34 use ls to confirm that a file was downloaded - pg1120.txt 13:54:57 copy it to the directory you created using cp: cp pg1120.txt 20170810-fedora* 13:55:07 then confirm that the copy was successful using ls 20170810-fedora* 13:55:10 +1 13:55:21 TIP - try cp pg11 - it'll autocomplete the name 13:55:45 similarly, after writing 20170810- will complete the name - makes usage much easier, and reduces typo errors 13:55:52 +1 13:56:06 permisssion denied 13:56:09 haha 13:56:19 heretical: er - in your home directory? 13:56:29 ah ok 13:56:47 now, try the rmdir command again 13:56:51 +1 13:56:52 rmdir 20170810* 13:56:55 what does it say? 13:56:57 dir not empty 13:57:07 dominicpg: +1 13:57:07 this should all be in your /home heretical we only once went to / for demo 13:57:19 ok 13:57:24 rmdir is a safe commnd - it will only delete empty directories! 13:57:48 you can remove the copy of the file in your current directory 13:57:54 rm -i pg 13:58:12 then, enter the new directory - we'll try a few things in there 13:58:27 NOTE - looks like we'll overrun our 1 hour mark, you're free to leave whenever you want, of course :) 13:58:31 ( if not in 20170810-fedora-classroom, run that with the path or cd into that directory) 13:59:13 is everyone in the new directory, and does everyone have the downloaded file in there? 13:59:20 +1 13:59:25 yes 13:59:31 +1 13:59:34 +1 13:59:35 yes 13:59:38 I'll wait a minute 13:59:46 +1 13:59:50 +1 13:59:53 +1 14:00:00 +1 14:00:01 so far so good :) 14:00:08 +1 14:00:19 let's create a new alias to make life easier 14:00:28 alias ls="ls -lAsh" 14:00:35 now run ls to see some info on the file 14:00:47 you can even do this 14:00:56 alias lash="ls -lAsh" 14:01:00 and then use "lash" 14:01:08 Poornima, welcome back 14:01:09 that way, ls remains unchanged, and you have a new handy command 14:01:32 +1 14:01:42 Am I the only crazy one that use the sort directories first parameter with ls? 14:02:06 x3mboy: -t? 14:02:11 Yeap 14:02:14 let's try that 14:02:16 ;) 14:02:19 if you wish to keep any of these long term take the alias command we use and add to ~/.bashrc Or wahtever shell you prefers rc file 14:02:28 if you created the lash alias, try this now: lash -t 14:02:46 it runs this: "ls -lAsh -t" 14:03:12 so aliases aren't new commands exactly - they're replaced by whatever you defined them to be 14:03:17 which is eerily similar to tree you'll notice with more info 14:03:36 the advantage of tree is that it gives you a nicely formatted tree diagram 14:03:40 comes in handy sometimes 14:03:53 pany, connection issues? 14:04:01 yeah 14:04:09 And also info about each file or directory can be added with parameters 14:04:21 To the tree command, I meant 14:04:32 +1 14:04:45 let's see if we all have fpaste installed - try: which fpaste 14:05:03 if it says /usr/bin/fpaste, try this: lash | fpaste 14:05:05 -1 not on android 14:05:23 if you get two links in return, let us know using +1 14:05:29 if you don't, let us know using -1 14:05:36 to know what fpaste does, use man fpaste 14:05:49 or fpaste -h 14:05:50 +1 14:05:53 +1 14:05:59 +1 14:06:02 +1 14:06:03 click the link you get to see if it's correct 14:06:08 not installed 14:06:33 fork208: not a fedora system? if you have python installed, you can just fetch the script 14:07:01 :-) sorry, playing on production system... 14:07:05 fork208, #dnf install fpaste 14:07:08 +1 14:07:20 amen 14:07:35 I will note it and try at home. 14:07:40 or you can do wget https://pagure.io/fpaste/raw/master/f/fpaste 14:08:47 it doesn't need admin privs 14:09:00 ok, lets get some more info on our play 14:09:06 wc pg* 14:09:28 wc = word count - tells you words, lines, all of that 14:09:33 wc -l pg* 14:09:39 also try: file pg* 14:09:41 3328 22766 141589 pg1120.txt 14:09:55 aditya_r: +1 14:10:05 everyone should get the same output ;) 14:10:22 +1 14:10:24 yeap 14:10:30 fork208, on fedora ? 14:10:35 +1 14:10:41 try the following commands 14:10:56 fork208, is nc installed ? 14:11:08 head pg; tail pg; more pg; less pg 14:11:13 (one by one) 14:11:14 you can replace | fpaste with | nc termbin 9999 14:11:29 to get out of more and less, you hit "q" 14:11:30 you can replace | fpaste with | nc termbin.com 9999 << proper address 14:11:33 nc + wc is installed. But fpaste not. 14:11:48 less is similar to more, but with added features 14:11:57 ? 14:12:02 so you haven't used a text editor yet! 14:12:07 aditya_r: yes? :) 14:12:07 aditya_r, go ahead 14:12:09 what is nc? 14:12:17 netcat 14:12:22 aditya_r: man nc ;) 14:12:33 linuxmodder: shame on you for telling him! :P 14:12:40 FranciscoD, :( 14:12:53 aditya_r: before you ask, look up the docs :) 14:13:04 did head/tail/more/less work for everyone? :) 14:13:05 ok 14:13:06 man tells how and what I didn't do all his work for him 14:13:17 +1 14:13:25 +1 14:13:30 +1 14:13:40 try: head pg > anewfile.txt 14:14:09 +1 14:14:13 also try: tail pg > anewnewfile.txt 14:14:27 then check if these files contain what you expect 14:14:45 without using editors, of course 14:15:02 try this: cat anewfile.txt 14:15:02 no love for editors ? 14:15:07 linuxmodder: not yet 14:15:29 now, try: cat anew* 14:15:33 Vim next week and emacs the next one to that 14:15:38 ;) 14:15:39 x3mboy: +1 14:15:49 now, try: cat anew* > whatisthis.txt 14:15:57 then try: wc -l * 14:16:04 see if the numbers look right? 14:16:08 good 14:16:27 cat = concatenate 14:16:36 but wait, you also have "tac" 14:16:53 now, try: tac anew* > anothercat.txt 14:17:11 run wc -l * again to see what numbers you get 14:17:17 what did tac do? 14:18:13 where cat goes line by line from top to bottom, tac goes from bottom to top 14:18:25 everyone see that? +1 for yes, -1 for anything else :) 14:18:33 +1 14:18:35 +1 14:18:36 +1 14:18:39 +1 14:18:41 +1 14:18:45 +1 14:18:46 +1 14:19:08 what play is this then? Can you find out and tell me please? 14:19:12 again, no editors 14:19:14 pany, heretical ? still following along? 14:19:17 +1 14:19:23 use more/less 14:19:27 +1 14:19:36 +1 14:19:55 +1 14:20:03 the name is in the first bit - don't scroll down to quickly! 14:20:18 how about we search for the info instead? 14:20:37 try this: grep shakespeare pg 14:20:49 you'll get nothing - if you do, let me know! 14:20:53 brian83, , welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit. We are at commands sections ( hands on section 14:21:20 everyone get nothing? 14:21:31 +1 14:21:38 +1 14:21:39 I got some but used -i switch with grep :) 14:21:45 how about grep Shakespeare pg 14:21:48 with a capital S? 14:21:49 +1 14:22:00 should get something now 14:22:26 +1 14:22:31 +1 14:22:38 but that doesnt tell us the name of the play, does it? 14:22:40 +1 14:22:40 +1 14:22:41 what is grep -i doing there? 14:22:45 trivia^ 14:22:48 linuxmodder: i didn't do -i ;) 14:22:49 +1 14:22:55 but try that now: grep -i shakespeare 14:23:04 dominicpg: +1 14:23:06 FranciscoD, asked as dominicpg mentioned it 14:23:10 +1 14:23:17 -i ignore case 14:23:31 dominicpg: sshh - let them read the man page and find out ;) 14:23:42 \0/ 14:23:44 ok 14:23:46 pnakorn, welcome to our class notes: https://gist.github.com/sanjayankur31/f40070c6925e8885394d2dd750ae4cb8 follow along and '?' for a question "!" for an issue you may hit. We are at commands sections ( hands on section 14:23:48 I must leave. Thanks and bye... 14:24:08 try this: grep -B1 -i shakespeare pg 14:24:17 fork208, thanks for coming the rest of the class will be up later on the same page you found this class on 14:24:48 if the output is more than one screen, pipe it to less! 14:24:51 try this: grep -B1 -i shakespeare pg | less 14:25:13 any luck with the name of the play with this command? 14:25:29 doesn't look like it :/ 14:25:51 how about this now: grep -A1 -i shakespeare pg 14:25:54 any luck now?? 14:26:27 everyone get the name of the play from this? +1 for yes, -1 for no 14:26:38 +1 14:26:44 -1 14:27:18 what about the others? 14:27:27 (if you're still here :P) 14:27:33 -1 14:27:44 I know it is The Tragedy of Julius Caesar, tho. 14:27:46 sorry, silent partner now onward. caring my daughter 14:27:56 dominicpg: no worries :) 14:28:02 grep -A1 -i shakespeare pg1120.txt | head -n 11 | tail -n 1 14:28:07 -B1 does not seem to be enough :) 14:28:27 asch_: yep, gotta use -A 14:28:37 -A1 14:28:44 does everyone understand what this command does: grep -A1 -i shakespeare pg1120.txt | head -n 11 | tail -n 1? 14:28:54 trivia - so what line number was the answer in then?? 14:29:01 based on this command: grep -A1 -i shakespeare pg1120.txt | head -n 11 | tail -n 1 14:29:02 FranciscoD, thanks for the grep -A/-B as much as aI use grep never knew those 14:29:21 linuxmodder: yeh - they come in handy sometimes 14:29:27 11 14:29:40 right - does everyone get how linuxmodder got that too? 14:29:57 again, read the man pages later to see what -A/-B do for grep, and what -n does for head and tail 14:29:59 I didn't use the head | tail tho :P 14:30:01 yup 14:30:05 yes 14:30:25 ok, let's find how many times the term "Caesar" is used in the text 14:30:27 use grep 14:31:04 will "grep -i caesar pg | wc -l" give us the answer? 14:31:47 +1 14:31:50 gives me 272 - is that the number of times "caesar" is mentioned in the text? 14:31:57 +1 if you think yes, -1 if you don't 14:32:08 +1 14:32:16 I didn't use -i and got 233 :) 14:32:38 -1 14:32:49 with a small "c"? 14:32:53 I get 0. 14:32:53 272 14:33:04 I got 0 as well 14:33:19 0 too 14:33:24 now, look at that command: grep -i caesar pg | wc -l 14:33:26 got 0 with lower c 14:33:31 read out to yourself what it's doing 14:33:44 no. Caesar,. Uppercase C 14:33:45 see if you see why this is *not* the number of times "caesar" was mentioned 14:34:14 it actually is the number of lines on which the term "caesar" appears 14:34:21 because the term may appear more than once in certain lines 14:34:24 +1 14:34:36 asch_: well done! 14:34:59 now, look at: grep -io caesar pg | wc -l 14:35:08 do you get 282? 14:35:25 +1 14:36:06 +1 14:36:08 +1 14:36:09 +1 14:36:15 take a minute to read man grep and see what -o does 14:36:17 +1 14:36:22 and see why this is the correct ansewr 14:37:07 lesson - be careful of exactly what you're doing ;) 14:37:20 :) 14:38:08 grep -iE "caesar|cassius|brutus|casca" pg1120.txt 14:38:18 let's look at where some other characters are mentioned 14:38:19 ^ 14:38:54 everyone happy with the output here? ;) 14:39:18 -E enables "extended mode" 14:39:28 the "|" operator works like an "or" operator 14:39:41 note the escape characters ARE REQUIRED for a -E usage 14:39:56 man 7 regex -> more info, but we won't go into regex now 14:40:01 the escapes here are " " 14:40:42 oh, wait, we also need -o, don't we? 14:40:52 grep -iEo "caesar|cassius|brutus|casca" pg1120.txt 14:40:58 -ioE indeed 14:41:11 everyone happier now? +1 for yes, -1 if you have a query 14:41:26 +1 14:41:35 +1 14:41:39 +1 14:41:46 thanks to those who have stuck around beyond the hour time slot 14:41:50 +1 14:41:52 +1 14:41:56 +1 14:41:57 +1 14:41:57 how about -b switch with grep ? more fun 14:42:15 dominicpg: +1 14:42:25 ok, so how do we get a count of all these characters then? 14:42:42 pipeline it with wc ? 14:42:57 linuxEnthusiast: try it out - what do you get 14:43:21 948 everyone? 14:43:51 grep -iEo "caesar|cassius|brutus|casca" pg1120.txt | wc -l 14:43:51 I got this : 948 948 6790 14:44:10 linuxEnthusiast: use -l to only get line counts :) 14:44:14 oh forgot the flag 14:44:22 I got only the 948 once 14:45:07 +1 14:45:09 but I think that is a local issue with another alias 14:45:20 sysadmin life :P 14:45:21 but, what if we want individual counts of all characters? 14:45:33 how would we do that? 14:45:43 wc -c ? 14:45:50 wc -m ??? 14:46:05 try them out, see what you get 14:46:19 you can grep for individual characters, of course 14:46:22 one by one 14:46:24 I got 6790 14:46:31 oddly in this case same value 14:46:38 linuxEnthusiast: it can't be more than 948, can it? 14:46:43 that's the total of all mentions 14:47:00 lol 14:47:01 you said characters 14:47:05 -c count byters, in text files, bytes = characters 14:47:09 man wc to see the difference 14:47:19 gah, sorry, by characters I meant the characters in the play XD 14:47:27 as in caesar, cassius, brutus.. 14:47:28 :D 14:47:31 The only difference should be if you have tabs, no? 14:47:44 not characters in the computers sense XD 14:47:58 or english paper either :P 14:48:42 so, to rephrase, how do we get individual counts of how many times each of these people in the play - caesar, cassius, brutus, casca were mentioned? 14:48:49 linuxmodder: clearer? 14:49:24 sorry for being out for sometime, gone for dinner 14:49:26 https://paste.fedoraproject.org/paste/ArYumuVG8tq53VSSig6BjA/ -> like this (not yet complete) 14:49:36 yes 14:49:55 ankit01ojha, welcome back 14:50:00 gotta run guys 14:50:14 grep -ieo 14:50:16 linuxEnthusiast, ok check the same wiki later for the rest of the logs 14:50:24 thanks for the session 14:50:29 linuxEnthusiast: +1, thanks for coming 14:50:40 approaching 2 hours FranciscoD fyi 14:50:41 we'll finish in 10 minutes 14:50:56 linuxmodder: yeh, 10more minutes - we'll just solve this one and end it 14:51:12 not an issue was more a congrats comment 14:51:19 here's a hint - man sort, man uniq 14:51:21 well, two hints 14:51:30 remember old series ( years ago) being this long nice to see that return) 14:52:01 heretical: asch_: any ideas? ;) 14:52:21 grep -iEo "caesar|cassius|brutus|casca" pg1120.txt | wc -l | sort | uniq 14:52:33 thanks guys, gtg 14:52:41 linuxmodder: with the wc? 14:53:01 stray wc there :) 14:53:04 that gives 948 14:53:18 grep -iEo "caesar|cassius|brutus|casca" pg1120.txt | sort | uniq -c 14:53:22 how about this? 14:53:27 doh brain fart 14:53:55 so, we find all our names, put them on individual lines, then SORT these lines, and then count them using uniq 14:54:08 Ceasar was mentioned more in that tragedy than I remember lordy 14:54:32 linuxmodder: yeh, even after they did him, they kept talking about him :P 14:54:42 asch_: heretical - did the last command work for you? 14:54:52 worked 14:55:52 but there's still a problem - it takes capitals and small letters as two different names :( 14:55:54 kinda. "grep -iEo "caesar|cassius|brutus|casca" pg1120.txt | sort | uniq -c" does not show how many times each of them is mentioned. 14:56:17 asch_: what does it show? 14:56:56 Sorry guys, I gotta go, time for bed in my timezone. 14:57:08 pany: thanks for coming 14:57:16 @FranciscoD: thank you 14:57:19 How does this look asch_ heretical : grep -iEo "caesar|cassius|brutus|casca" pg1120.txt | sort | tr A-Z a-z | uniq -c 14:57:24 now it shows how many times each of them is mentioned. mut differs Brutus from BRUTUS, Caesar from CAESAR, etc 14:57:43 asch_: precisely, try the latest command and see if the numbers add up ;) 14:58:02 Yup, it shows the desired summed results. ty :) 14:58:09 linuxmodder: brutus is your winner ;) 14:58:27 again, man tr to see what we did there 14:58:35 could also have been done using perl or sed 14:58:40 but tr is the simplest utility 14:58:49 Let's conclude here with some takeaways 14:58:55 #topic Conclusions 14:59:02 #info We did not once use a text editor 14:59:03 did we? 14:59:13 no :) 14:59:14 nope 14:59:17 no 14:59:20 #info piping lets one combine lots of tools and get lots of work done 14:59:21 nope 14:59:22 no 14:59:37 #info there are different ways of doing the same task 14:59:45 and increasingly looks creepy/1337 :P 14:59:49 #info read the docs - always read the docs 14:59:56 linuxmodder: XD 15:00:12 any other takeaways? feel free to add them 15:00:18 #ciar heretical bt0 ankit01ojha asch_ 15:00:24 #chair heretical bt0 ankit01ojha asch_ 15:00:24 Current chairs: FranciscoD ankit01ojha asch_ bt0 heretical linuxmodder shantorn 15:00:36 you're all chairs, use the info command like I did :) 15:01:13 There's a lot more that can be done too - may be I'll do a 102 class continuing this one 15:01:35 +1 to a 102 class 15:01:37 #action FranciscoD Try to do a command line 102 class picking up where we left off here 15:01:43 +1 15:01:48 +1 15:01:51 +1 15:01:54 Some commands for you to look into: clear, exit, man, apropos, alias, which, info, echo, env, ls, tree, pwd, cd, pushd/popd, dir, locate, updatedb, find, cp, mv, rename, touch, mkdir, rmdir, rm, free, df, du, history, cat, tac, wc, head, tail, less, more, grep, sed, cut, tr, paste, ps, kill, uniq, sort, wget, bc, rsync, dmesg, lsusb, lspci, dnf, rpm, journalctl, sl, history, ctrl n, awk, 15:02:00 fpaste, watch, for, if, &&, ||, chmod, diff, vimdiff, elinks, mpd, ncmpcpp, htop, iotop, top, nethogs, irssi, vim, emacs, gtypist 15:02:01 #action linuxmodder to offer to assistance and or co-run a 102 15:02:03 #chair sschmidt 15:02:03 Current chairs: FranciscoD ankit01ojha asch_ bt0 heretical linuxmodder shantorn sschmidt 15:02:03 yeah you can take from here on 102 15:02:39 try "sudo dnf install sl; sl" if you have sudo rights 15:02:51 :D 15:03:08 #info resource 1 - man pages 15:03:16 #info resource 2 - man info 15:03:27 #info resource 3 - use the -h switch/flag/option 15:03:35 only then do you need to go online 15:03:47 #info online resource 1 - https://rlworkman.net/howtos/rute/ 15:04:00 #info online resource 2 - http://tldp.org/ 15:04:16 Please try this really fun command line mystery - https://github.com/veltman/clmystery 15:04:29 there's a murder, and you must use command line tools to go through the clues and find who did it! 15:04:39 #info https://linuxjourney.com is also a good overall site for command line or scripting at the line 15:04:45 Great practice - and there are hints to help 15:05:03 OK, if there's nothing else, I'll close the session now 15:05:08 Going in 5 15:05:13 ok I have to go. Thank you. Will this lesson be on the page? 15:05:24 heretical: yes, we'll publish the logs 15:05:26 heretical, yes as are all previosu ones 15:05:42 much like a meeting would be 15:05:43 You can drop your feedback/comments on this page: https://fedoramagazine.org/fedora-classroom-session-3/ 15:05:44 thanks again 15:05:55 Many thanks FranciscoD++ 15:05:55 bt0: Karma for ankursinha changed to 4 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 15:06:07 those classes that use bluejeans or similar with have links to those parts as well 15:06:20 #info you can e-mail us feedback on the ML or me personally: classroom@lists.fedoraproject.org , ankursinha AT fedoraproject DOT org 15:06:23 #info You can drop your feedback/comments on this page: https://fedoramagazine.org/fedora-classroom-session-3/ 15:06:24 FranciscoD: thanks for the session 15:06:33 FranciscoD: Thanks! 15:06:33 FranciscoD++ 15:06:33 ankit01ojha: Karma for ankursinha changed to 5 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 15:06:38 FranciscoD++ ankit01ojha++ pany++ bt0++ 15:06:40 linuxmodder: Karma for ankursinha changed to 6 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 15:06:41 thanks for coming everyone :) 15:06:43 linuxmodder: Karma for ankit1997 changed to 1 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 15:06:43 heretical++ 15:06:46 linuxmodder: Karma for pany changed to 2 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 15:06:49 linuxmodder: Karma for bt0dotninja changed to 9 (for the f26 release cycle): https://badges.fedoraproject.org/tags/cookie/any 15:07:05 sschmidt++ 15:07:10 OK, closing now 15:07:12 #endmeeting