Rik's Treehouse > Babbling in Binary > Tips 'n' Tricks > Unix

Unix

I'm not an expert on Unix but I do use it to run some of my big research jobs when I don't want to tie up my PC. I don't know anything about the different flavours of Unix so all I can tell you is...these ideas worked for me! Since I'm no expert I'm sure I'm not doing anything extravagant so it should work for most varieties of Unix...I hope?!

  1. How to run batch jobs.
  2. Why can't I print this postscript file?
  3. Can I download files while offline?

  1. How to run batch jobs.
  2. Posted: July 25, 1997

    Problem: I want to run a big batch of jobs sequentially on my Unix machine and I don't want to sit around waiting for each job to finish before I start the next one. How can I automate this procedure?

    Solution: Unix was built to handle this kind of problem so it is pretty straight forward (as much as anything is in Unix). Just follow these steps:

    1. Write a batch file, let's call it runme which contains on each line a command to process. For example:
      nice -19 job1 parameters
      job2 more parameters &
      job3
      The nice -19 prefix makes a job run at low priority so it doesn't steal much CPU time if other jobs are running (just good manners).
    2. Make it executable with the command chmod a+x runme.
    3. Run it! Just type runme and each command should start running. Better yet, run it in the background with runme & so you can still work while these jobs are running.
    When you run runme the machine will first run job1 with the command-line parameters parameters at low priority. When done it will run job2 with more parameters in the background. The next job job3 should run immediately because of the & at the end of job2 which tells the computer to run it in the background.

  3. Why can't I print this postscript file?
  4. Posted: January 9, 1998

    Problem: Every time I try to print the postscript file ugh.ps I get the following error message:

    lpr: Fatal error - cannot print 'ugh.ps': unprintable file

    All my other files print just fine. What's going on here?

    Solution: Did you create this file with Microsoft Word? Does it have a long filename? Then this might be the problem: each postcript file has a line near the top which says the title (name) of the file. For some reason, the people at Redmond thought it would be cute for MS-Word to truncate the title if it got too long, so they replace the remainder with an ellipsis (...). The ellipsis is a control character (strange ASCII code) and that's what's causing all the problems. lpr doesn't work if it sees any nonstandard characters in the file. To tell it to ignore this use the -l (literal) command option. Your print command should look something like

    lpr -l ugh.ps

  5. Can I download files while offline?
  6. Posted: July 18, 1998

    Problem: I want to download a bunch of big files to my Unix account but it is too slow! Is there a way to download files without user intervention?

    Solution: Yes, here's an example of how I transfer files while offline (only works with ftp):

    unix% ftp fileserver.com          (connect, give username/password, etc.)
    ftp> cd the/right/directory
    ftp> prompt                       (turn off confirmations)
    ftp> mget *.zip                   (use mget to get multiple files)
    ^Z                                (hit control-z to pause)
    unix% bg                          (resume transfer in the background)
    unix% logout                      (walk away)
    
    If everything works, the next time you log in you should have all the *.zip files on your system. There's probably a smarter way of doing this but I still haven't got the hang of Unix.

Top of page


[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:55pm