Banner

Current Reading: JSP, Servlets, and MySQL
Switch to SpeakEasy.net DSL


/usr/ucb/install. just do it.

Home

Software

Screenshots

Blog

Unix Tips

/misc


Unix Tips

  • Motif Window Manager
    1. Want to tell MWM to keep the root menu sticky?
    2. Want to run my retro MWM desktop like you see in the newest screenshots?
  • NetBSD
  • Debian GNU/Linux
    1. Want to tell tcsh to autocomplete apt-get, apt-cache, and dpkg? - Applies to Conectiva/etc as well
  • Solaris
    1. What's with /usr/ucb?
    2. Want to make Solaris more BSD-like?
  • Commands
    1. Search and Replace in a Directory: grep -r -l SearchTerm /Directory | xargs -l sed -i "s/SearchTerm/ReplaceTerm/g"
    2. Backup Partition to 10GB Multi-Tape Archive: find / -xdev | pax -w -B 10240m -x ustar -f /dev/tape
    3. Extract Above Multi-Tape Archive: cd /somewhere; tar xMvf /dev/tape
    4. Copy Data to new Drive: find /path | cpio -pudvm /newpath
    5. Find software packages in Debian: apt-cache search ftp
    6. Find 30 Biggest Files [in /tmp]: find /tmp -ls | sort -n +6 | tail -n 30
    7. Find 20 Biggest Directories: du -Sm | sort -n | tail -n 20
    8. Indent Modified K&R C Source Files: indent -kr -br -nce -nut -st *.c *.h
    9. Obtain a list of IPs showing repetitive (>=2) ssh attacks (root or unknown users): zcat -c -f /var/log/messages* | grep 'sshd\[' | egrep "(Failed password for root|Illegal user)" | awk '{print $10 $11}' | sed 's/[[:alpha:] :]//g' | sort | uniq -d
    10. Get list of next 7 days (BSD): setenv start `date +%s`; seq -f %f $start 86400 `echo $start + 86400\*7 | bc` | xargs -n 1 date -r
    11. Change permissions of certain file type: find /path -name "*.jpg" | xargs -l chmod 640

Motif Window Manager

Want to tell MWM to keep the root menu sticky?
Edit your ~/.mwmrc file and change the mouse event that does the root menu from Btn3Down to Btn3Up.

Want to run my retro MWM desktop like you see in the newest screenshots?
You will need OpenMotif MWM, Gkrellm, osd_clock, xtoolwait, chameleon, xscreensaver. I am also using pterm as my terminal emulator. I have packaged all the relevant files (xsession, xdefaults, wallpaper, etc..) available here. Be sure to move the tzosdclock file that is extracted to the appropriate place (like /usr/local/bin).


Debian GNU/Linux

Want to tell tcsh to autocomplete apt-get, apt-cache, and dpkg?
You should install sudo or modify this for root to use it. If you'd like to run this on Conectiva, comment out the three lines dealing with dpkg. Put this in your ~/.tcshrc file:

    ## debian
    if ( -f /etc/debian_version ) then
        alias apt-get "sudo apt-get"
        alias dpkg "sudo dpkg"
        alias alien "sudo alien"
        set ipackages = `dpkg --get-selections | awk '{print $1}'`
        set apackages = `apt-cache search '' | awk '{print $1}'`
        complete dpkg 'n/-L/$ipackages/'
        complete apt-cache 'n/{show,search,depends}/$apackages/' 'p/*/(show search pkgnames depends)/'
        complete apt-get 'n/{install,remove}/$apackages/' 'p/*/(update install remove upgrade dist-upgrade clean)/'
    endif

Solaris

What's with /usr/ucb?
You will find /usr/ucb on many SysV-compatible systems as a generic directory for duplicate programs that are compatible with the syntax of BSD commands. Just think of it as "/usr/university of california at berkeley" if you have trouble . Interesting fact: on Tru64, /usr/ucb is a symlink to /usr/bin. Tru64's commands can automatically tell which syntax they've been run under. It's sad to see the last real commercial UNIX die.

Solaris/BSD

  1. Disable Sun Print Server
  2. Install a current NetBSD pkgsrc tree and bootstrap it
  3. `scp user@netbsd:/etc/rc.subr /etc` on the host, change first line to #!/bin/bash. Solaris sh/ksh have issue with some NetBSD scripts.
  4. touch /etc/rc.conf
  5. mkdir /etc/rc.d
  6. cat > /etc/init.d/netbsdrc <<EOF
    #!/bin/ksh
    cd /usr/pkg
    if [ "$1" != "start" -a "$1" != "stop" ]; then
      echo Usage: $0 start \| stop
      exit
    fi
    for each in /etc/rc.d/*; do
      $each $1
    done
    EOF
    
  7. chmod 755 /etc/init.d/netbsdrc
  8. ln -s ../init.d/netbsdrc /etc/rc3.d/S10netbsdrc
  9. ln -s ../init.d/netbsdrc /etc/rc3.d/K60netbsdrc
  10. Manage rc.conf and rc.d as usual, but you may need to modify rc.d scripts to use /bin/bash as well
  11. Install print/LPRng, misc/watch, etc.. from /usr/pkgsrc
  12. Modify user and system shell PATHs to include /usr/pkg/bin, etc..
  13. Alias ps, df, du and others to /usr/ucb equivilant just for your interactive shells


online or not Powered by Sun
AIM:Idle Resonance
Yahoo:idle_resonance
ICQ:57800324
Valid HTML 4.01! Valid CSS!