11th meeting

From BLUG

Jump to: navigation, search

Topic: 20 Cool Things You Can Do With Linux
Date: Tuesday, September 13th, 2005
Time: 7-9pm
Location: Monroe County Public Library room 1B

Attendance: 18
Presenter: Mark Krenz


Synopsis

Mark will be showing some very neat things that any of you can do with Linux. From X windows to command line to network services to programming to games. There will be something for everyone and should be inspiring for people who need ideas of what they can with Linux.


This is not just a presentation for beginners. I'm sure that this presentation will show everyone at least two or three new things you can do if not more. If not, you can lynch me after the show. ;-)

Let's continue to break attendance records and try to get over 21 people this time. Bring your friends, colleages, beginners, etc.


Post meeting summary

Well, we came close to 21 people again. 18 is pretty good. I guess that school being in session really does hold people up. This was a good meeting and everyone seemed to learn something new and think it was pretty cool.

Here are is a summary of the topics that I covered:

  • 1. Make ISO image directly from a CD using dd (or floppy or hard drive)
  (Insert CD into drive)
  dd if=/dev/cdrom of=discimage.iso


  • 2. Mount it locally using loopback device (Make sure you have loopback device support in your kernel)
  mkdir mountdir
  mount -o loop discimage.iso mountdir
  cd mountdir

I was also showing how you can create a file of a certain size using dd and /dev/zero and then make it into a onfile ext2 filesystem.

  dd if=/dev/zero of=newfilesystem bs=1k count=50000
  mke2fs -m 0 newfilesystem
  mkdir filesysmount
  mount -o loop newfilesystem filesysmount
  cd filesysmount
  touch file_inside_filesystem

This helps show how everything in Unix/Linux really is treated as a file. Even your filesystem can be on a file, it doesn't have to be on a drive. This is also how certain encrypted filesystems work.


One other way that I've used mounted ISO images before is for sharing via samba. If you're like me, you have lots of software installed and you have the original CDs put up somewhere (okay, so I have lots of Windows boxen). Create an ISO image of the CD and mount it as Mark described. Let's assume, for sake of example, that we mounted ms_office_2003.iso at /mnt/office2k3. Now, in your samba config file, you can set /mnt/office2k3 up as a share that remote boxes (Linux or Windows or <insert OS here>) can access. If you were going to do this, I'd recommend adding the ISO image to /etc/fstab and have it automatically mounted at boot-time. Now, do this for 15 or 20 CDs, and for the price of a free beer, you've just made yourself one of those multiple CD changers that used to be so popular back in the days of the DOS-based BBS. This works out real well on networks with large numbers of Windows machines, mostly. --Jeremy L. Gaddis


  • 3. Send yourself a SMS page to your phone at a certain time.

This is for people whose clock alarm doesn't work.

   sleep 28800 ; echo "wake up" | mail -s wakeup 8125551234@vtext.com


  • 4. Rename files en mass with rename
 rename .htm .html *.htm
 rename foo foo0 foo?               
 rename foo foo0 foo??


  • 5. Do massive text replacements in multiple files with replace

You need to install mysql to use this program (which is kinda silly, this should be a standard Linux program)

 replace from to from2 to2 from3 to3 -- list of files


  • 6. Make a TCP request manually using telnet (web and mail)
  telnet www.cnn.com 80
  (once the connection opens)
  GET / HTTP/1.1
  Host: www.cnn.com
  (now hit enter twice)
  telnet mail.suso.org 25
  (once the connection opens)
  HELO yourmachinename
  MAIL FROM <youremail@address.com>
  RCPT TO: <mark@slugbug.org>
  data
  From: <youremail@address.com>
  To: <mark@slugbug.org>
  Subject: Just testing

  Hi, I'm sending an email message by hand.
  Thanks,
  Your name
  .


The single . at the end signifies that you are closing the message and the mail server can queue it now for delievery. Go ahead and try this, I'll send you a message back letting you know that it worked.


  • 7. Sniff a network with sniffit, tcpdump or ethereal
  tcpdump not host 192.168.204.4
  sniffit -s 192.168.204.4 -l 0

ethereal is a GUI program that offers a lot more options and viewing features than tcpdump and sniffit. I actually had forgotten to install it (whoops) so I couldn't demonstrate it.


  • 8. Monitor your desktop system with gkrellm
  gkrellm2


  • 9. Monitor remote systems using SNMP

I had to skip this to save time, but if you want to try it, setup the snmpd daemon on your system, then use the snmpwalk to run through the tree. I can show this at a future meeting.


  • 10. Remotely access your terminal using screen

Think of screen as a window manager for the terminal. You could also think of it as a kind of VNC connection to the terminal.

  (login to a remote machine)
  screen
  (run some command like pine or mutt)
  (press Ctrl-a c to create a new screen)
  ls -l
  (Go back to the other screen using Ctrl-a p)
  (detach from screen using Ctrl-a d)
  (logout of the machine)
  (now log back in to that machine, could also be from another location)
  screen -x   (this will reattach to the screen process.)

Once reattached, you should see the same programs that you left running in the screen session.

While in screen, you can press Ctrl-a ? for help


  • 11. Explore the galaxy with Celestia (a,z,g,F2-F7,arrow keys and mouse)
 celestia


  • 12. Use a different window manager, like fvwm, amiwm, enlightenment,windowmaker, fluxbox, etc. (twm)

If you have a X session manager running like xdm or gdm (a screen that graphically logs you in), then probably the easiest way to run a different window manager is to select a different session from the session manager, you can choose a custom one and enter the window manager that you want to run instead of running gnome or kde.

Or if you can also modify your .xinitrc file to contain one of the following lines:

  exec fvwm2

or

  exec enlightenment

You actually don't even have to run a window manager, you can simply run a program and it won't have any borders.

  exec firefox


  • 13. Screensaver background (and random ones too.)

First, to understand how this works, you need to understand that all those screensaver visuals that xscreensaver runs are just graphic drawing programs that are capable of drawing to the root window in X (your background). So first, try this:

 /usr/lib/xscreensaver/xmatrix   (Your path may be different, try running 'slocate xmatrix')

You should see the xmatrix visual start running in a window. Now we'll try it in the X root window.

 (If you are running gnome, you'll need to remove nautilus from the current session (Preferences -> Session))
 /usr/lib/xscreensaver/xmatrix -root

You should now see the xmatrix visual running beneath all your other windows and it should be taking up your whole screen. Now you have an animated background.

Other visuals to try (you'll need version 4.22 of xscreensaver for some of these):

 pinion
 glmatrix
 starfish
 crackberg
 blocktube
 ifs
 cynosure
 vermiculate
 popsquares
 flipflop

And I also showed some visuals that are from the rss-glx package of screensavers.

 skyrocket
 lattice
 euphoria  

Some instances of euphoria will give feedback and it will render the whole X screen in real time to the root window with all these visual effects, its really cool)


I also wrote this shell script that will display the visuals randomly for a random period of time. I wrote it for an electronic music concert last spring. You can get it at http://suso.suso.org/programs/display.sh.txt . You will need the num-utils set of programs to run the script.


  • 14. Use ssh-agent to automanage your ssh keys for auto login

Usually if you are running a session manager like gdm or kdm, it will automatically run ssh-agent for you when starting X. What this does is load your keys into the X server and every program inherits the ability to use your ssh keys. This is mainly used to automatically login to remote hosts from an xterm or likewise.

If your session is not starting with ssh-agent (check with ps auxww | grep ssh-agent), then you can start it from .xinitrc

 exec ssh-agent gnome-session

or you can use the window manager of your choice in place of gnome-session.

Once you've logged into X, you can run ssh-add and it will prompt you for your passphrase for your ssh key. Once you've entered that, you will no longer need to type in the passphrase for that key. You can simply ssh to any host with that key in your authorized_keys file on the remote host and it will log you in automatically.


  • 15. ssh tunneling

ssh allows you to create a TCP tunnel over the encrypted ssh session. You can make a local port come go to a remote port on the other side of the connection and vice versa. This is useful if you want to forward your web proxy connection over an encrypted channel or if you are trying to get by a firewall.

 ssh -L 8080:proxyhost:80 yourusername@remoteshellhost.com

Assuming that there is a proxy server called proxyhost, you can then setup Firefox or whatever browser to use locahost port 8080 as an HTTP proxy. You can use multiple -L options to ssh for additional port forwardings.


  • 16. Run an X application remotely.
  ssh -X hostname
  (or)
  ssh -Y hostname

then run the application you want

  gimp
  firefox
  gaim
  • 17. Run two, three or four X Servers at once.

From vt1 or one of the console terminals, you can run one of the commands to start up additional X servers.

  startx -- :1
  startx -- :2
  startx -- :3

This is useful if you have multiple users using a machine and they each want their own X setup and the ability to lock them seperately.


  • 18. Xnest (Could play into multiple X desktops)

While inside X, run

  Xnest :1 -ac  &

This will open a window that is actually a nested X server, You can now run any X application you want inside that X server:

  fvwm2 -display :1 &
  xterm -display :1 &
  gimp --display :1 &

Some applications use --display instead of -display


  • 19. Explore fractals using Xaos

Xaos is a real time fractal viewer that lets you interactively explore many types of fractals. It is a fun little program to try out. And it can also run as a screensaver using -root

 xaos website


  • 20. Play movies in ASCII art mode with mplayer and aalib

You can compile mplayer to use the ASCII Art library (aalib) and then you can use aa as one of the video output modes to display all the video in ascii art like graphics. Its pretty neat and runs at full speed.

 mplayer -vo aa movie.mpg

To wrap things up, I showed everyone Star Wars, done in ASCII graphics, and accessable through a telnet client.

 telnet towel.blinkenlights.nl


Fun stuff, fun times.

Personal tools