Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux beyond ls and cd HARVARD COMPUTER SOCIETY. HARVARD COMPUTER SOCIETY What is Linux?

Similar presentations


Presentation on theme: "Linux beyond ls and cd HARVARD COMPUTER SOCIETY. HARVARD COMPUTER SOCIETY What is Linux?"— Presentation transcript:

1 Linux beyond ls and cd HARVARD COMPUTER SOCIETY

2 HARVARD COMPUTER SOCIETY What is Linux?

3 HARVARD COMPUTER SOCIETY NO! n Richard Stallman

4 HARVARD COMPUTER SOCIETY What is GNU/Linux?

5 HARVARD COMPUTER SOCIETY GNU’s Not Unix It’s recursive… get it The Free Software Foundation

6 HARVARD COMPUTER SOCIETY Linux is: Free Software

7 HARVARD COMPUTER SOCIETY Linux is: $0.00

8 HARVARD COMPUTER SOCIETY Available in many distributions on many platforms

9 HARVARD COMPUTER SOCIETY Ultimate flexibility and control

10 HARVARD COMPUTER SOCIETY Linux is for HAXX0RS!!1

11 HARVARD COMPUTER SOCIETY Movies with bad hacking

12 HARVARD COMPUTER SOCIETY the internets is going down

13 HARVARD COMPUTER SOCIETY lol hacking??

14 HARVARD COMPUTER SOCIETY Movies with good hacking

15 HARVARD COMPUTER SOCIETY Trinity uses Linux.

16 HARVARD COMPUTER SOCIETY

17 Linux General Principles

18 HARVARD COMPUTER SOCIETY General Principles n Less is more (no news is good news) n Small programs that do one thing really well n (Almost) everything is open-source n Input and output to programs is plain-text: easy to see what programs do

19 HARVARD COMPUTER SOCIETY Principles cont. n Multi-user computing environment with permissions n Everything is a file. Everything. n Ctrl-Z, Ctrl-D, Ctrl-C – typical ways to get out of something n If you don’t know, RTFM: man

20 HARVARD COMPUTER SOCIETY Where is everything? bin/ etc/ lib/ misc/ oracle@ scratch@ tmp/ boot/ home@ local/ mnt/ proc/ shells/ usr/ cdrom@ initrd/ lost+found/ nfs/ root/ srv/ var/ dev/ initrd.img@ media/ opt/ sbin/ sys/ vmlinuz@

21 HARVARD COMPUTER SOCIETY

22 Your Home Directory ~/

23 HARVARD COMPUTER SOCIETY The Linux filetree is flexible. /./../ symlinks

24 HARVARD COMPUTER SOCIETY User configurations Hidden files : /.hiddenstuff

25 HARVARD COMPUTER SOCIETY Useful programs

26 HARVARD COMPUTER SOCIETY Useful Linux Programs n finger, write n find, which, whereis n grep n ps, kill, killall, top n jobs, fg, screen n quota, du, df n ln n dig –trace n ping, wget, curl n emacs, vi n echo, cat n head, tail, less, more n chown, chmod

27 HARVARD COMPUTER SOCIETY Daemons n Programs that serve stuff all the time. n Common services: –Apache ( httpd ) –OpenSSH ( sshd ) –LDAP ( flapd ) –SAMBA-Windows Networking ( smbd ) –Cron-Scheduled Tasks ( cron ) –Others: inetd, xinetd, xvnc

28 HARVARD COMPUTER SOCIETY So how do I do anything useful? PIPE > >> |

29 HARVARD COMPUTER SOCIETY Getting to know your shell tcsh bash zsh

30 HARVARD COMPUTER SOCIETY Environment variables n Control the characteristics of the shell –View them with [set]env, or $VARIABLE –Set them with export –Change up your prompt! export PS1=“myCOOLprompt: ” n But these have to be declared every time you use your shell. –Solution: ~/.profile, ~/.bash_profile, etc.

31 HARVARD COMPUTER SOCIETY But if we have variables… n And we have all these nifty little programs that can be strung together… n Can we make our own programs?? n YES. n Linux is beautiful.

32 HARVARD COMPUTER SOCIETY Shell Scripts n Shell scripts are “programs” that are completely uncompiled, but read and executed by the shell line by line. n Typically end in.sh n Must be chmod’ed executable. n Start with a “shabang” – tells the shell what to use to interpret it. e.g., –#! /bin/bash for a bash script.

33 HARVARD COMPUTER SOCIETY Quick overview of BASH scripting n We can solve most of the problems presented in PS#1 with BASH scripts. n For instance, here’s a demo that relates to the hacker edition: –Interlocked diamonds (sorry, don’t want to give it totally away!)

34 HARVARD COMPUTER SOCIETY BASH vs. C #! /bin/bash number=3 name=“bob” echo “$name is your chosen name, $number your chosen number.” let “inc=number+1” if [ “$inc” –eq “4” ] then echo “Addition works like a charm.” fi #include #include int number = 3; string name = “bob”; printf(“%s is your chosen name, %d your chosen number.\n”, number, name); int inc = number++; if ( inc == 4 ) { printf(“Addition works like a charm.\n”); }

35 HARVARD COMPUTER SOCIETY BASH vs. C n All variables are strings n Variables are accessed with $VAR n Runs other Linux programs to do its work n Spacing usually matters. n No line endings n Multiple types, must be declared n Variables do not have prefixes n Runs subroutines or functions from libraries to do work n Spacing matters a lot less. n Lines end in ;

36 HARVARD COMPUTER SOCIETY BASH vs. C #! /bin/bash number=0 while [ “$number” –lt “5” ] do echo “You want something greater than 5.” echo –n “Enter a number: ” read number done echo “$number is greater than 5!” #include #include int number = 0; while (number < 5) { printf(“You want something greater than 5.\nEnter a number: ”); number = GetInt(); } printf(“%d is greater than 5!”, number);

37 HARVARD COMPUTER SOCIETY As you can see there are many similarities… BASH is a programming language in and of itself. You put all the little pieces of Linux together in the ways that suit you best. It’s your computer to control.

38 HARVARD COMPUTER SOCIETY got graphix? n So far we’ve been staring a lot at text consoles. n Linux does allow for the display of graphics: –X11 on nice – demo it! –Window managers: Gnome, KDE –You can see these on the SC Lab computers, or in most desktop Linux distros, e.g., Ubuntu, Suse, Red Hat, etc.

39 HARVARD COMPUTER SOCIETY Till next time... http://hcs.harvard.edu/~powerpak for a copy of this presentation Come to HCS weekly meetings Wednesdays at 8pm, SOCH 307 Free Pizza courtesy of Google. http://hcs.harvard.edu/~powerpak


Download ppt "Linux beyond ls and cd HARVARD COMPUTER SOCIETY. HARVARD COMPUTER SOCIETY What is Linux?"

Similar presentations


Ads by Google