Quick Tips

Hello blogosphere! As I’m working on putting my bash scripts together, here’s a few quick tips that one may use in everyday life.
Background Command
Ever started a program in the terminal because it doesn’t have a menu listing, or need to see it’s error output and then realize later that you need the terminal? Opening another tab is simple enough but you really don’t need the program hogging the terminal anymore. Well, there is a way to do this.
Previously, people may have viewed my bash script that can start programs in the terminal in the background. Already running applications can be backgrounded as well. First type ctrl-Z to release the application, then using the bg program will background it’s output.

Gnome’s Middle-Click, Title-Bar Trick
For the long time I’ve been using Gnome and just learned about this one. A quick way to look at a window below the current on is to middle-click on title bar. Voila! The current window izzz lowered. More tricks can be found on Gnome Tip’s and Tricks page.
Firefox Hunt
I have the tendency that once I’m on the keyboard, I like to stay on the keyboard, so doing a search in Firefox by going to the mouse selecting the search engine, and typing in the field seems like extra legwork to me. To do a fast search in Firefox on the keyboard is as easy as: ctrl-K to move to the search box and alt-up/down to select the search engine.
Grep Two Search Terms
On the occasion that a grep search needs to look for two words, egrep it:
egrep -w 'word1|word2' /path/to/file
Fox in Hounds Teeth
This is personal advice, but take it from me – worth it. Don’t use Foxmarks Bookmarks Synchronizing Service. I used this service as I sold my old computer when I got the new. I trusted this service to hold my web bookmarks and… it didn’t. It errored with the line, “Can’t synchronize bookmarks, transfer error.” I asked about the error and only got the explanation that, “…this sometimes happens”. Also I got no explanation on why or what happened to their backup service.
There’s another Bookmark Synchronizer out there but for the life of me can’t remember the name of it. Anyone?
Thunar Custom Actions
Thunar has the ability to create custom scripts built directly into it. For the most part it’s self explanatory. For greater degree of difficultly scripts, here’s the documentation.
Have a Good Day! :)
Gentoo Scripts… as promised.
Has a bit of a Yogi Bear thing, don’t ya think?

I tried to sleep a few nights back and my ears just wouldn’t leave me alone, so I thought lets boot my computer and see if there is anything still useful on it. So I began to look through my ~/.bin/ directory and dug up a few things. I’ll post a few of these in the next few days..
Gentoo scripts
I’m not a typical Gentooee where: while, if, and C daemons are popular but I have a couple hat tricks that did what I needed them to do.
Archive and Delete
This computer has a 5GB hard drive for which is about the bare min to run a Linux desktop with (even trickier with Portage). So often I try a program and say, “Ok, I can use that but I won’t be very often.” So this script I made to archive the package and back it up to my flash drive:
archive-wipe
#!/bin/bash
# archive-wipe - create archive of package and remove from system
PACKAGE=$1
#ARCHIVEDPACKAGECHECK=/media/disk/portage-packages/All/${PACKAGE.*}
#ARCHIVEDPACKAGENAME=${ls /media/disk/portage-packages/All | grep $PACKAGE}
# -CAT/PACAGE
if [[ -z $PACKAGE ]]; then
echo "archive-wipe "
exit;
fi
# Gnome volume manager will at times put the drive on disk-[1-10]
if grep "/dev/uba1.*/media/disk-.*" /etc/mtab; then
echo " * Drive mounted incorrectly. Exiting."
exit; else
echo " * Archiving $PACKAGE"
sudo quickpkg --include-config=y "$PACKAGE" && echo " * '$PACKAGE' archived, unmerging from portage." && sudo emerge -C "$PACKAGE"
# if [ -z ARCHIVEDPACKAGECHECK ]; then
# if "$ARCHIVEDPACKAGEDNAME"; then
# if ls /media/disk/portage-packages/All | grep "$PACKAGE"; then
# if [ -z "/media/disk/portage-package/All/${PACKAGE%.*}" ]; then
# echo " * '$ARCHIVEDPACKAGENAME' archived, unmerging from portage."
# echo " *** "$PACKAGE" has not been archived. Exiting"
# exit;
# fi
fi
ebuild2overlay
I’ve wrote before about ebuild2overlay. I find myself using this quite a bit. When a program I need/want isnt’ in Portage, someone if often good enough to have written an ebuild for in and put it in Gentoo’s Bugzilla.
I’ve made a few small updates to the script and updated the post.
For any that change of modify this script, please let me know about it. I also would enjoy hearing any thoughts.
unblock-package
This one I got from the Gentoo wiki and it altered slightly it use quickpkg so the blocker doesn’t have to be recompiled:
#!/bin/bash
BLOCKER=$1
BLOCKED=$2
if [[ -z $BLOCKED ]]; then
echo " unblock-package "
echo " * Use category/package."
exit;
fi
#sudo emerge --buildpkgonly --nodeps $BLOCKED && i
sudo quickpkg $BLOCKER && sudo emerge -C $BLOCKER && sudo emerge -K --nodeps $BLOCKED
# Possible?
# emerge --resume
gentoo-update
This is my Gentoo update world script. It asks if it should start with a pretend emerge, emerges, revdep-rebuilds, and dep-cleans. I’ve seen a better one on the forums but I was never able to find it again.
#!/bin/bash
# gentoo-update - world update and configure
TXT_YL="tput setaf 3" #
TXT_RESET="tput sgr0"
sleep 1 && echo " * Gentoo world update starting."
sleep 2 && echo " * Does the Portage tree need updated? (y/N)"
read SYNCPORTAGE
if [ "$SYNCPORTAGE" == y ]; then
sleep 2
echo " * Please wait and as the Portage tree is updated."
sudo eix-sync && sudo pmaint sync
sleep 2 && echo " * Portage tree updated."
fi
sleep 1 && echo " * Standard or tree view to display pretend information? (s/t/Neither)"
read PRETEND
if [ $PRETEND == s ]; then
sleep 2 && echo " * Running pretend infomation."
sleep 2 && echo " * This can take awhile, please be patient."
emerge --update --newuse --deep -pv --color y world | less -R
#pmerge --upgrade --deep --pretend --set world | less -R
sleep 2 && echo " * Review the infomation, if anything needs changed now's the time to do it."
fi
if [ $PRETEND == t ]; then
sleep 2 && echo " * Running pretend infomation."
sleep 2 && echo " * This can take awhile, please be patient."
sleep 2 && echo " * Review the infomation, if anything needs changed now's the time to do it."
# emerge --update --newuse --deep --tree -pv --color y world | less -R
emerge --update --newuse --deep --tree -pv --color y world | ansi2html > /tmp/gentoo-update-tree.html
epiphany --new-tab /tmp/gentoo-update-tree.html
fi
sleep 1
echo " * Update Gentoo? (y/N)"
read UPDATEGENTOO
if [ "$UPDATEGENTOO" == y ];then
# sudo pmerge --upgrade --deep --set world &&
sudo emerge --update --newuse --deep world && sudo dispatch-conf && sudo emerge --depclean && sudo revdep-rebuild -pv; else
exit
fi
Have fingers, will post…
Dirk has bumped into a mild setback as beasty laptop seems to have failed on him. Actually the laptop is perfectly fine but the network (both ethernet and wifi) have complete gone. Currently obligations hold me liable, obscuring a new beasty, so I reach out to the net so see if any help is avail.
I’d like a basic laptop. Any day or age will probably do. As long as it’s able to connect to the internet and run linux. If anyone has such, I’d appreciate the help. Address is:
T.R.
816 MacFarlane Rd.
Portage, WI 53901
I miss blogging greatly and hope there someone out there that can help. I may be able to help with P.O. cost.

