2010/09/22

Alien packages, installing .deb

alien - Converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, Solaris pkg, and lsb packages (from man page).

CONVERT
alien [--to-deb] package.rpm
INSTALL
dpkg -i package.deb

Without specifying --to-deb or any other output type, it should default to the .deb format.

Startup services

To deactivate a service at boot, for example, apache2: 'sudo update-rc.d -f
apache2 remove'. To activate it: 'sudo update-rc.d apache2 install
defaults'. (From debian-hints, fortune.)
  
    ENABLE
    update-rc.d -f apache2 remove
    DISABLE
    update-rc.d apache2 install defaults

2010/09/20

Save changes when not editing as root


Thanks to Kate Pauls for this one!

:w !sudo tee %


Sometimes you end up editing a file when not root. Some people are always logged in as root but, if you're a sudoer as I try to be most of the time, sometimes you forget you didn't intend to make changes before opening a root owned file in vi just to view it and end up wanting to make changes.

2010/09/14

GNOME


GNOME GNU Network Object Model Environment. An alternative to KDE. I love it. Below I'm merely listing things I need in gnome and can't imagine functioning without (or without knowing). Well... gksu doesn't come up very often.

CUSTOMIZE - menus, prefs, compiz settings
alacarte
gconf-editor (see ~/.gconf and ~/.gconfd)
ccsm
QUICKSILVER - Just like on my Mac
gnome-launch-box
ROOT GUI
gksu command

2010/09/10

Automated text editing


Well, sort of automated; there's no decision-making being made for the human.

Batch Replace, Text Replace in each file from forums.devshed.com
For every file of type f in certain directory [what's type f?]:
find /path/to/start/from/ -type f | xargs perl -pi -e 's/applicationX/applicationY/g'
For every file in current working directory:
ls -1|xargs perl -pi -e 's/10.200.8.6/10.200.8.21/'

Batch Add to end of line from unix.derkeiler.com
I needed to add (the "-a" string") to a specific line in each file, this did the trick! The $ indicates the end of line, but I don't know how it works beyond that... Obviously, I need to spend more time learning sed!
cat branchoperations.selectstaffing.com.cfg|sed '/service_description/s/$/-a/'
Adapted to:
ls -1|xargs sed -i '/service_description/s/$/ SelectIIS6-A/'

Text editing with vi


vi VIsual mode in ex. Today's letter d in the below (ex?) commands is brought to you by the word delete. I still haven't really checked out emacs, though I suppose I should.

GLOBAL DELETE - Search and destroy lines matching pattern
:g/pattern/d 
INVERSE GLOBAL DELETE - Search and destroy lines not matching pattern
:v/pattern/d
SED - Sed substitute
:%s/old/new/g
READ - Read in output from command
:r!command
OPTIONS
:set all


There are also some things left for me to play with involving global commands. Thanks to this post and the associated comments, Christopher Suter suggets using commands and macros:

:%g/.../normal O//

:%g/.../normal @q