Note: I'll make up an active learning exercise about 10 minutes before the end GUI on Linux: Window Manager Desktop Environment Display Manager I'll show you a couple Time for a walk: Some computers with names Name is often in the prompt uname -n Separate the computer in front of you from the one you are using Since you'll probably ask: X11 forwarding over SSH Remote desktop is another way to do this Interlude: Why don't I have to type a password all the time? Cryptographic authentication (is stronger, depending) Let's talk about networks! Enough for the moment, anyway Internet Protocol Addressing with IP Ports Standard ports A bit more about how things work protocols DHCP, briefly, and the MAC address DNS, and 8.8.8.8 Ruining the magic kingdom: Firewalls and NAT Some connections can only be initiated from one end Port forwarding (for NAT) A relay point on the outside - ssh can do this Text editing, and nano text file compared to word processors - Word processors are for printers - So is .pdf - Not .html - You can eat cake with a spoon (MS Word for code is worse than this) - Source code is normally stored in a text file nano: Easy to learn, syntax highlight, generally ok gedit: Easy to learn, syntax highlighting, generally ok, needs GUI vim: Not as easy to learn, LOTS of features, has a graphical version emacs: Medium learning difficulty, LOTS of features, has graphical version code: A bit different way to work, but avoids editing in remote terminals You need to know how to use a text editor to be competent on Linux I use vim, but that doesn't mean you should We talked about the file tree a bit yesterday But now a tour! Slash direction is opposite DOS/Windows Case matters! /tmp /etc /home /dev and /proc /root (and who is root?) /bin, /usr, /opt, /sbin, /sys, /lib, /lib64 /var and /var/log /usr/share/doc Special characters in filenames: Spaces / - (not special) . (not special) Linux does not require file extensions They are commonly omitted on regular text files ~ (your home directory, if it is first) cd with no parameters Note: This next part is important for lab Let's learn another command: grep grep and files grep and pipes If we get this far: Writing a program with C We'll use the text editor again Finally: pipes (combining grep and who) Warm-up (not really review): Which set of notes was longest? What processors are on systems I can ssh into? Standard Input, Standard Output, and Standard Error Redirection operators on the command line Ok, time to look at the inside By understanding the inside, you will understand the outside too When you get a new car, don't you take it to bits first thing? C brief intro Came before C++ It's the language Linux is written in Standard programming language for *nix I'll assume you know the first 3 chapters of the C++ text Differences from C++: header files end with .h No namespaces No classes (including cin and cout) And string No standard template library Nested functions are ok C++ is nearly a proper superset of C No nested functions, unless you use lambda Struct initialization is more verbose Casting rules produce more warnings C++ has become very popular for *nix programming K desktop environment, for example It's like C, but has more features I'll use actual C for all examples in this class In CS430, you will too, because the kernel is not in C++ You're welcome to use C++ in this class if you like! Less confusing if you're in CS211 at the same time I'll also try to make sure the examples all work in C++ File descriptors, and read/write write system call (what is a system call?) We'll open a file and write to it How about just using 1 as the file descriptor? 0, 1, and 2, and write How about changing the file descriptor a program writes to? >, and file redirection 2> redirects standard error Parallel for standard in: It's file descriptor 0 We can use the read system call to read from it Let's make a program that just passes things through, and then redirect a file into it! Infinite loop, read, then write cat can do this. Maybe do something trivial, like capitalize all letters A very useful program: grep Searches through standard input or files Permissions User, Group, Other All, which is different from other All is used with letters for chmod setuid root for programs Demo, with c program and system sticky bit and /tmp Undo sticky and see what happens!