2010/06/19

Screen hardstatus


Screen is one of the best programs ever made for linux. This is my current hardstatus line, always a work in progress. My .screenrc:

backtick 1 1 1 $HOME/.screen_custom/sys_status.sh

hardstatus on
hardstatus alwayslastline
hardstatus string '%{= kg}[ %{y}%H %{g}][%= %{=kw}%?%-Lw%?%{y}(%{W}%n*%f%t%?(%u)%?%{y})%{g}%?%+Lw%?%?%= %{g}][%{y}%Y-%m-%d %{W}%c %{g}]'
caption always "%{wK} %1`"

As can be seen in the first line, it includes a script I've placed in a custom folder:

#!/bin/sh
uptime | sed 's/.*average: //'

Although, it's a bit redundant with multiple windows open.

I also need to see if there's a way to put the -H 1000000 option I like to use in my .screenrc instead of specifying it when being invoked.

Network Manager applet disappeared!


Usually, I can use the applet in the upper part of the screen to connect to a wireless network. This is the applet for the Network Manager in GNOME. In the above picture the access point labeled "dlink" can be seen. Recently, this useful little applet had completely disappeared.

As embarrassing as this is, it took me several days and many pointless searches until I finally stumbled on a fix:

ps aux|grep nm-applet

I then ran kill -9 on that pid and then issued the following command after hitting ALT-F2.

nm-applet --sm-disable

Fixed! The little applet had been restored to my notification area. Yay! I still have no idea what the --sm-disable option is. I also don't know if it's a problem to have multiple users logged in or if that was the actual cause of the problem.

This had recently disappeared from my login leaving me only with my battery status, bluetooth applet, sound control and such. Logging into another account on my computer, the applet would show up properly; I thought this might be a user account issue or some problem with my gconf preferences, though I no longer believe this to be true.

This was never a big deal since Ubuntu automatically connects to the open (unprotected) Wi-Fi network in my neighbor's house so it's only been more of a nuisance than anything else.

The fun part of this little adventure occurred when I was finally motivated enough to find a fix. While at a friend's house recently and being unable to use the applet (either in my own login where it had disappeared or in the other user account, a guest account, where it did show up but would seem to be unresponsive, even after a reboot) to connect to his Wi-Fi, I had to tether my Droid to my laptop in order to search the web until I found the right command to invoke the Network Manager applet. I had only just recently followed instructions on setting up the tethered link to my phone. (Thank you, Shannon!)

Archiving files

tar - archive utility (Tape ARchive).
  
For faster and more frequent use, gzip (Gnu ZIP) is generally a better choice but bzip2 can create a significantly smaller sized file. Using lzma (Lempel-Ziv-Markov chain Algorithm) provides even more compression but takes even more time than bzip2. Flags -v for verbose to show what is happening and -f for file since we're not actually using a tape drive in the '80s.
 
CREATE
tar cfv archive.tar file1 file2 ...
EXTRACT - Look at TF options below!
tar xvf archive.tar
COMPRESSION (BZIP2)
tar cfvj archive.tar.bz2 file1 file2 ...
COMPRESSION (GZIP)
tar cvfz archive.tar.gz file1 file2 ...
COMPRESSION (LZMA) - Don't forget the leading dash for standard options!
tar --lzma -cvfz archive.tar.lzma file1 file2 ...
LIST - Will indicate extraction paths that will be created!
tar tf archive.tar
PRESERVE - retain file permissions down to unique user and group IDs
tar cfvp archive.tar file1 ...
ABSOLUTE PATHS - Retain leading /
tar cfvP archive.tar /absolute/path/file1 ...
REMOVE FILES - Automatically delete original files after archiving
tar --remove-files -cvfz archive.tar.gz file1 file2 ...
 
There are also some other cool features worth mentioning: Files can be searched for within archives with the -t (or --list) flag by passing a second argument and additional files can be added to archives with the -r (--append or --update) flag and passing the filenames as additional arguments. Files in an archive can be replaced with current versions with -N (--newer), I believe, in the same way as used with -r.
 
This wonderful tool was originally implemented for use with archiving data to magnetic tapes. Appeared in Version 7 of Bell (AT&T?) Unix in 1979 (cool!) and one of my most favorite, often-used tools. Beyond the ability to package a multitude of files into one file, tar can also preserve file permissions, date and time information and directory structures.
 
The usual convention for file extensions for archived files are .tar.gz (.tgz), .tar.bz2 (.tbz or .tbz2 or .tb2) and .tar.lzma (.tlz). The gzip format has replaced the old .z archive (invoked with the -Z flag these days) format usually used by piping to the compress compression utility.

2010/06/07

Installing fonts

To install a font (TrueType only, I believe), copy the font file to the directory below and then rebuild the font cache with the following command. Alternatively, one could copy the font to ~/.fonts (would the font only be available to that user then?).
 
DIRECTORY
/usr/share/fonts/
  
COMMAND
sudo fc-cache -f -v
  
This worked with a TrueType font provided by my company's marketing department, the same font used on all the company's signs and branding. Of course, I had to restart Scribus for it to show up in the list of available fonts.

Starting over

I'm redoing this blog. My goal is to post random notes about Ubuntu linux that are useful to... well... really only myself. My hope is to record all of the random tidbits of information I should save for my own computing life, especially in regards to using Ubuntu, such as...
  • favorite screen hardstatus line
  • quick howtos for samba, vncserver, named
  • useful command line tools
  • needed third-party software, where and how to get them (flash, AdobePDF)
  • why zsh is better than bash
  • bluetooth stuff
  • nagios stuff
  • etc.
A lot of these will undoubtedly apply to any linux flavor, however, since I primarily only use Ubuntu I am titling this blog "Kinji's Ubuntu Notes." A lot of these posts will be specific to Ubuntu. Since this is live and on the web and will probably be crawled by Google spiders, I also hope one or two posts may be helpful to other users out there, other people still just discovering Ubuntu and the wonders of linux, as I am.