Skip to content. | Skip to navigation

Sections
You are here: Home thumper Categories Remember This
Personal tools
  • Log in
Document Actions

Remember This

Up one level Remember This
Posts designed to store knowledge, so that I don't forget it.

Document Actions

Useful Ubuntu Things to Remember

  • To open a terminal in Ubuntu, go to Applications > Accessories > Terminal
  • To add shortcuts from the applications listing to your desktop or top/bottom panel, browse to the location of the program under applications, click on it DON'T LET GO, and drag it to the bar at the top, or onto you desktop. Let go.
  • To run a unattended upgrade on an (K/X/U)buntu machine use the following command in a terminal:
apt-get update; apt-get upgrade -y
  • If you only want the upgrades to be downloaded, and not installed as well, then use this one (I think, this hasn't been tested, and you could probably do it a bit more neatly with -dy):
apt-get update; apt-get upgrade -d -y
  • Most linux variants store their programs (e.g. lspci) under /usr/sbin
  • To force evolution (linux version of MS Outlook) to close completely, open a terminal, and run the following command:
evolution --force-shutdown

How to turn a Ubuntu Box Brainless


Effectively, by this tutorial, we will be disabling logins on the ubuntu box, and just using gdm and the x-server to talk to a server on the local network using XDMCP. This means, that you'll actually login to the remote server, and use the remote servers' data and processing power.

WARNING: This will disable GUI access to your computer! 
DON'T do this to a machine which you want to use without having to
play around with the X configuration files in command line.

In ubuntu, you can switch all logins to XDMCP quite simply. Here is the Howto:

  • Click on System > Administration > Login Window
  • Enter your password (if requested)
  • Click on the security tab
  • Click on the "Configure X Server" button in the bottom right hand corner of the window. This pops up:
  • Change the "Launch" value from "Greeter" to "Chooser"
  • Click close twice, and log off
  • Hit CTRL - ALT - BACKSPACE together, to restart GDM. You should now have a XDMCP host searching window, which will locate any computers which have had XDMCP logins activated. If you want a howto for setting up a server for that, please comment!
Document Actions

How to Configure or Disable Predictive Text In Open Office

Open Office keeps automatically trying to guess what you're typing? Sometimes it can be useful, especially if you're doing something quite repetitive. However, it can also be a bit dumb at times.

Now, Open Office predictive text, actually comes under auto-complete. Don't ask me why, as to my mind at least, that's a completely illogical place to put it. Also, Open Office call it "Word Completion"

Configure Open Office Predictive Text

Here are a couple of things you can try to make it more useful.
Click on "Tools" > "AutoCorrect..." > Click on the "Word Completion" tab.

  • Increase the minimum word length.

OpenOffice AutoCorrect Minimum Word Length        Make sure that the minimum word length is at least 8. Less than that, and you're going to get it trying to auto complete too-short words, and get confused. More than 8, it will trigger less often. Tweak this for how much you want to use the predictive system.

  • Delete False PositivesOpenOffice - AutoCorrect - Delete Word.png

        Sometimes, the predictive system just gets confused. An example of this, is if you have used "Disneyland" in a document, and then want to type "Disney" Open Office will keep auto-completing to "Disneyland". Really, not helpful.

To fix this the only response, is to find and delete the offending word from the predictive system. Click on the word you want to remove (In this case, Disneyland), and click the "Delete Entry" button.

Note: The image has been cropped to make it fit. The dialogue box is longer than this.


Disable Open Office Predictive Text

If you just can't get it quite to work how you want, then your last resort is to disable the feature. Click on "Tools" > "AutoCorrect..." > Click on the "Word Completion" tab.

Now, untick the box that says "Enable Word Completion". Your Open Office will no longer automatically try to predict what you're typing.

Note: if you leave "collect words" ticked, the system will still collect words to Auto Complete, but Won't actually use them. If you're just turning the feature off for a little while, leave it ticked. Otherwise, untick it, to save memory, and a little bit of processor power whilst you're working.




Document Actions

Useful Linux (Ubuntu) Tidbits

Here are just some morsels of information about the Linux Command line, and more specifically, Ubuntu Linux Command line / system.


Users can be added to a group with the command:
sudo adduser <username> <groupname>


In ubuntu, the default system shell is "Dash". That does speed up your system boot, but it also introduces problems with those scripts which are designed to run in bash, but use /bin/sh to execute. (Which is a surprising amount... this has solved many problems for me. Especially with Asterisk and freePBX.)

To set Ubuntu back to using bash from dash, run the following command...

cd /bin && sudo rm sh && sudo ln -s /bin/bash /bin/sh


To add a user to the sudoer list (the list that controls who can use "sudo") use the command
sudo visudo
Add a user underneath the "# User privalage specification" comment. If you want just a bog standard sudo user, able to do all on the system, add the line:
<username>    ALL=(ALL) ALL
?Fun? tip: add "insults" to the end of the list of "Defaults" in visudo, so it will look like:
Defaults        !lecture,tty_tickets,!fqdn,insults
The system will insult you every time you enter your sudo password wrongly. For a random example, it just gave me this when I deliberately triggered it:
You speak an infinite deal of nothing


In Firefox, select the address bar quickly by hitting the "F6" key.


Type "pwd" to get the full path to your current directory. e.g.:
kirrus@asus:~$ pwd
/home/kirrus


Monit is a useful program, that gives you a good way of keeping an eye on your servers, making sure they don't run out of harddisk space, or get a high CPU load. It can either perform some function (like stopping a program from running) during high CPU, or send you a warning email.

http://debianhelp.co.uk/monit.htm (useful howto/basic guide)
http://www.tildeslash.com/monit/ (main website)

Monit is in the ubuntu repositories:

aptitude install monit


...

Regarding the Storm worm, I do plan a follow up. But I'm just at the basic "read lots" stage...


Re:Useful Linux (Ubuntu) Tidbits

Posted by elwoodicious at 12 Sep 2007 15:46

I'll second the Monit suggestion. We implemented it last month to manage our Mongrel clusters and the difference has been night and day with regards to recovering from memory leaks and instituting rolling restarts of the cluster while doing deploys. Next on the list is to examine the best way we can use it to monitor the MySQL cluster we are building... :-D

Re:Useful Linux (Ubuntu) Tidbits

Posted by gazzat at 13 Sep 2007 19:06

Another usefull tip which should work in *nix systems is if you screw up and make it crash, wait - don't go presing the reset button!
Hold down Alt+Print Screen and type REISUB . It Kills all processes unmounts the drives nicely etc.

Re:Useful Linux (Ubuntu) Tidbits

Posted by Kirrus at 14 Sep 2007 21:35

Elwood: Aye, Monit is useful... alerts us to problems caused by using Gambas unstable to write code... Only tricky bit is, we get alerts every night, as the box does some intensive mysql database cleanups (deletes lots of fields, and optimises tables) nightly.
Might have solved that one... we'll see tomorrow, if I get any more false-alarms..

Hi Gazzat :D
Crashes, if you have crashed your GUI, you can get into a command line, by hitting CTRL-ALT-<FUNCTION KEY> . Generally, function keys F1-F6. F7 (at least, in Ubuntu) is the GUI.
Also, if you can't recover from that, CTRL-ALT-BACKSPACE will restart your X server, which should kill everything GUI wise, and reload the login page..

Document Actions

Ubuntu Gutsy


I upgraded to Ubuntu Gutsy last weekend. Its quite good, the upgrade went without a hitch, if still with annoying (and newbie confusing) questions about configuration files. Still, all seemed to be ok. Till I loaded up rhythmbox, and started listening to some of my music.

Gutsy's rhythmbox has problems with sound glitches. I thought that my headphones were broken, till I looked it up, and found a launchpad bug. Quick fix is to turn on crossfading. I hope that this isn't in gusty final. (8 days till release at the moment. Although, to be fair, I've not had a day since I installed without at least 5 updates...)

The URL to Trackback this entry is:
http://trollstomper.org.uk/Members/thumper/the-kirrus-blog/ubuntu-gutsy/tbping

Re:Ubuntu Gutsy

Posted by elwoodicious at 11 Oct 2007 02:05

I've had some trepidation with doing the upgrade probably just for the the silly reason that I'm finally happy with how I have things working and heading off to Gutsy means I'll want to get back to tinkering and not being productive... ;-)

Document Actions

Xen Gutsy Links

Category(s)
Remember This Remember This

A post full of links and unsorted info about using Xen on Ubuntu Gutsy Gibbon, so that I don't forget. (This lot has taken ~2 days to collect...) May make a full howto sometime... probably not though, as my boss knows this stuff better than I. Xen is pretty cool though...

https://help.ubuntu.com/community/Xen (useless for gutsy...)

The Xen console doesn't work (xm console <domU>), network works once, and then never again... Going to paste this here as its in a pastebin, not sure when it will expire... (Have tweaked slightly, snipped a couple of things out, added couple of things in)
http://rafb.net/p/49Ku5e10.html

>> OK, I have made a little progress on this.  I mounted my VM image on a
>> loopback and chroot'd to it. I opened /etc/init.d/hwclock.sh
>> and /etc/init.d/hwclockfirst.sh and added the following to the top of each
>> file:
>>
>> exit 0
 
ALSO SEE: http://lists.cvsrepository.org/xen-tools/Jul07/0332.html
 
sudo xm create -c </path/to/config/file>
 
-----------------
 
# Ever-increasing network device names?
 

# Just disable the correspondent udev rules by deleting/renaming your
/etc/udev/rules.d/<NUMBER>persistant-net.rules. (number was 70 for us...)
 
guest# mv /etc/udev/rules.d/{,.}z25_persistent-net.rules

# And then make sure your vif (in your instance config file) contains your mac
# address like:
vif = ['ip=192.168.0.45,mac=<random valid mac addy>']

Just be sure to stop the instance (domU), and then restart (re-create) it again when needs be...

Also, when in the Xen console, try hitting enter before using the escape sequence (CTL +]) if it's not working. Sometimes it enters into the console after the "login:" prompt has been printed, and doesn't seem to pick up that its just had a new connection...


The ALSO SEE link: http://lists.cvsrepository.org/xen-tools/Jul07/0332.html

Using Serial console & xen console (serial console conflicts with xen console):
http://phaq.phunsites.net/2007/06/30/xen-console-grabbded-devttys0



/boot/grub/menu.lst stuff, to enable us to use a serial console as well as xen:

serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=2 serial console
Goes in the top of your menu.lst, outside the automagic sections...

## additional options to use with the default boot option, but not with the
## alternatives (These options are not used with the Xen Kernel!)
# defoptions=quiet splash console=ttyS0,115200n8
For the default kernel, (NOT the xen kernel).
    Goes inside the AUTOMAGIC section of your menu.lst, adding to the options already there.

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0 console=ttyS0,115200n8 xencons=ttyS9
Note the xencons=ttyS9. Use a serial port (ttyS<No.>) that doesn't already exist.


Your Xen kernel definition should look something like this, after you've run "update-grub":

title           Xen 3.1 / Ubuntu 7.10, kernel 2.6.22-14-xen
root            (hd0,0)
kernel          /xen-3.1.gz
module          /vmlinuz-2.6.22-14-xen root=/dev/mapper/volume-root ro console=tty0 console=ttyS0,115200n8 xencons=ttyS9
module          /initrd.img-2.6.22-14-xen
quiet



The guys on irc ##xen @ freenode are really helpful...


The URL to Trackback this entry is:
http://trollstomper.org.uk/Members/thumper/the-kirrus-blog/xen-gutsy-links/tbping
Document Actions

Notes / mySQL Transactions

Why should you not use your notepad as a coaster? This is why:

Notes


The notes did say this, before my lovely hot black coffee destroyed them:

"begin" == Start transaction
"commit"
== End transaction, saving all changes
"rollback"
== Undo all changes that you've made in the transaction

What are they? In mySQL 5, with a table storage type of "innodb" you can use transactions. This means, that you can make a set of changes together, like recording the removal of a credit, and the adding of an advert to a website, at one instance, even if it's multiple mysql transactions within one connection.

You do that, by sending the command (literally "BEGIN;" or "begin;") to start a transaction, run all the queries you need to run, and then run the commit if you want the all the changes to take, or rollback if you don't. If any one of the sql queries fails after you've made a begin, and it shouldn't have, you can rollback *all* the changes you've made to the database. Obviously, this needs one mySQL connection, but if you're using more than one each run of the program you're using, I'd be very surprised.

The URL to Trackback this entry is:
http://trollstomper.org.uk/Members/thumper/the-kirrus-blog/notes-mysql-transactions/tbping
Document Actions

Handy Gedit Features.

Gedit. Not the first program you'd think of when putting together programs. However, second only to vim on the command line (configuration files etc) and givm for zope external editing (easy way to learn vi commands ;))  its fast becoming my favoured program for working on python scripts at work.

So, here are a couple of useful things I do with my gedit, that you might not know of.


Open and work on a file over ssh

Our first task, is opening a file over ssh. I use gedit to edit python scripts on our servers, whilst I'm putting it together. Upside, the script runs on a beefy machine with a large pipe to our database server. (Which is what most of the scripts use, for some task or other.)

My example here, is opening a file called "bob.py" on my machine, over ssh and gedit. I'll be ssh'ing to myself, but you can ssh to anywhere.

So, to start, we open Gedit. Go to "Applications" > "Accessories" > "Text Editor".Handy Gedit Features - Open Location

Now, we need top open the file. Quick way to open the "Open Location" dialogue we'll use is to hit Ctrl - L, or just click on "File" > "Open Location".

You should now have a box up that looks like this. (Click image for larger version).

Now, we tell it we want to use ssh, and where the file is. The syntax for this is:

<format>://<user>@<machine>/file/location

For this task, I want to use ssh, so I enter:

ssh://jtinsley@localhost/home/jtinsley/Desktop/bob.py

Handy Gedit Features - Authentication Required

and click open. It asks us for our password. Now, it depends on what you want to do as to which option you pick. Personally, I save permanently. The password is stored in your gnome-keyring, which asks you for your password the first time you use it. This way, auto-save works. Choose your option, enter your password, hit enter, or click "connect".





And bobs your uncle: We're working on our file (that can be stored on a hard-drive 300 miles away...)!

Handy Gedit Features - bob.py

Heh.. You know that lame joke is the only reason I called it bob.py, right? Grin Smiliy Icon


Autosave

Handy Gedit Features - autosave preferencesThis has saved me 10 minutes of work once. You know the times when you're so focused at what you're working on, you forget to keep hitting Ctrl - S to save? It can be a slight pain whilst you're working on a file remotely, because gedit will pause slightly if there's any lag on the line as you upload the file to the remote server, but I don't notice it that often.

Using the same gedit window we opened for bob.py, click on "Edit" > "Preferences". Click on the "Editor" Tab.

At the bottom, under "File Saving" Theres a greyed out tickbox, "Autosave files every N minutes". Click it, and then set the number of minutes. I tend to set it at 5 or two, depending how paranoid I am about my machines' stability at the time ;)



Python Console Plugin

Handy Gedit Features - Preferences plugins tabIf you're coding python, this is the one for you. Open up the preferences window ("Edit" > "Preferences") and click on the "Plugins" tab. Find, and tick the box next to "Python Console".

Click Close. Now, you might be wondering, "So where is this python console?"

We need to alter our toolbars. Click on "View". You have a set of bars you can activate (or deactivate) across the interface. I will sometimes turn off the "Toolbar", as I don't use it that much... I use the keyboard shortcuts more. Click on "Bottom Pane". A python console will immediatly spawn at the bottom of the window. I use this sometimes if I'm working on a script, and want to look up something quickly, or try out a snippit of code to make sure it runs. You can also use this console to alter/run python on gedit. I've not played with that much, but looks pretty smart.



Note: I've edited a lot of these images to make them smaller.

If you have any comments, feel free to email me them and I'll add them to the site. Still haven't got round to sorting out a captcha, sorry.
The URL to Trackback this entry is:
http://trollstomper.org.uk/Members/thumper/the-kirrus-blog/handy-gedit-features/tbping
« August 2008 »
Su Mo Tu We Th Fr Sa
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Recent entries
Move Pending 27 Apr
General Update Ramble 25 Apr
Centos 09 Apr
Away 04 Apr
Redunancy 03 Apr
Life, Earth and Philoso 29 Mar
Handy Gedit Features. 01 Mar
TAG Cloud
computer ink
Looking for good computer ink? We are specialists in printer ink. We provide a massive range of ink cartridges at great prices…
Duracell batteries
Order Duracell batteries from buyabattery.co.uk. We pride ourselves on our great service and competitive prices.
Website Designers
Our professional website designers can make websites that you update yourself! Add text and images whenever you need to. See online!
Small business IT >>
Connect's bill won't surprise you. Their rates are fixed. And so's your IT troubles, if you use them.
About this blog
Kirrus's web log about web design, the internet, linux/ubuntu, plone, and life in general.
 
(no ads)
computer ink
Looking for good computer ink? We are specialists in printer ink. We provide a massive range of ink cartridges at great prices…
Duracell batteries
Order Duracell batteries from buyabattery.co.uk. We pride ourselves on our great service and competitive prices.
Website Designers
Our professional website designers can make websites that you update yourself! Add text and images whenever you need to. See online!
Small business IT >
Connect's bill won't surprise you. Their rates are fixed. And so's your IT troubles, if you use them.