Showing posts with label Command Line. Show all posts
Showing posts with label Command Line. Show all posts

Friday, August 15, 2008

Uninstall CISCO VPN client OSX

If you have the joy of running the Cisco VPN client on your Mac, you will rejoice the day you can remove it. Actually that could be unfair.

Whatever. There is no uninstaller, so you need to use to following command from the terminal:

sudo /usr/local/bin/vpn_uninstall

You are prompted to remove all profiles and certificates.

If you answer yes, all binaries, startup scripts, certificates, profiles, and any directories that were created during the installation process are removed.

If you answer no, all binaries and startup scripts are removed, but certificates, profiles, and the vpnclient.ini file remain.

Sunday, July 13, 2008

Kill / force quit a program / process in OSX

Sometimes a program or process gets into an unresponsive or other undesirable state and you cannot quit it from the GUI.

What you can do is to force quit, or kill it, from the command line. You can either do this locally or by SSHing in.

First run 'top' and see if you can find the culprit. If the process is consuming too much CPU you can find it using 'top -o cpu'.

Make a note of the PID (process ID), so if the PID is 1292, then you do

kill -9 1292

and it'll be gone.

If you get a no permission error then it could be that the process is owned by root or another user, n which case you can do

sudo kill -9 1292

put in the root password, and its killed.

Thursday, May 8, 2008

OSX Server: servermgrd CPU ramps and consumes the system

I had a problem with my OSX Server box running 10.4.x where the daemon servermgrd would take ever greater amounts of CPU.

It seems this can be a problem even on very recent builds.

To fix I ran

killall -HUP

This kills and restarts the process.

To get the process ID you can of course do a 'top'

Saturday, April 19, 2008

Mac OSX X11 application - turning off the 'sure you want to quite notice'

I run Open Office on my Macbook Pro, which because it doesn't have its own windowing, requires X11. When you quit X11 you get an alert asking "are you sure you want to quit X11' and giving the dire warning that all X11 applications will also be stopped.

If you want to turn this warning off you do (from the command line)

defaults write org.x.x11 no_quit_alert true

If you want to go back run it again - just swap true with false.

Tuesday, April 8, 2008

What lens do I need? How to use EXIFTOOL to find out

My trusty Nikon D70 and two lenses (kit 18-70 and Tokina 12-24) have been plenty of places with me, and I'm curious to know if I should continue using them when I get my D300, or if I should consider getting a different lens, say the fabulous Nikon 17-55.

To do this, we can use EXIFTool to extract camera model and focal length information for lots of photos, and then apply some analysis to the result.

First you need to see which EXIF fields you need. To do this run (NB lines may wrap)

exiftool -a -G1 -s 'IMG_4107_Wheat_&_Olives.jpg' >all_tags.txt

from which I can see that I need to extract '
FocalLength' and 'Mode'

so my next command to check is

exiftool -FocalLength -Model DSC_2671_Salt_Flats_2.jpg

gives

Focal Length : 44.0 mm
Camera Model Name : NIKON D70

An alternative field would be 'FocalLength35efl' which gives the 35mm equivalent. Handily this field seems to be present in both my Canon files and my Nikon files.

exiftool -FocalLength -Model -FocalLength35efl DSC_2671_Salt_Flats_2.jpg

gives

Focal Length : 44.0 mm

Camera Model Name : NIKON D70
Focal Length : 44.0 mm (35 mm equivalent: 66.0 mm)

So now I need to run this on a directory, and recurse through the various folders and put the result into a file.

exiftool -FocalLength -Model -FocalLength35efl -r ~/pictures >big_extract.txt

Now I can take this file, put the fields onto the same line for each photo, grep out pictures not taken by me, cameras I'm not interested in eg my Nokia N73 and Olympus C2020Z, and separate the fields I want with commas.

After that I will put the file into OpenOffice and run the analysis. Thats the next tutorial.

Thursday, April 3, 2008

Apple OSX and SSH Tunnel Manager

If you're using an Intel Mac and you use SSH tunnels, and you like an easy life then you should use SSH Tunnel Manager.

You can of course use syntax like

ssh user@server.address -L localport:127.0.0.1:remoteport

but if you have quite a few ports to tunnel, this gets tedious.

SSH Tunnel Manager is the answer, but the original authors version is not Universal Binary. Now a Universal Binary has been compiled which you get from here.

Great work - thanks!

Saturday, March 29, 2008

Picasaweb - automating inserting EXIF data into the Caption

I am mid building project, and its nice to use Picasaweb to show progress. What I want is that the time lapse sequence will have the EXIF Date as its Caption, because when you upload the taken data gets hidden on the right hand side of the album window.

To solve this I used iPhoto and EXIFTool from Phil Harvey.

First I imported into iPhoto, rotated and enhanced etc. Then I exported a month at a time into a named folder - each month would be its own album in Picasaweb.

Then I installed EXIFTool and ran the following command

exiftool "-exif:createdate>caption-abstract" *

Then I drag into the Picasaweb uploader, and upload to the correct album.

Job done!

Monday, February 18, 2008

Apple OSX - how to tar files

tar is included in the default install of OSX.


You can use it to bundle up files:

$ tar -cvf archive.tar *.gz

will add all files (its clever enough not to try to tar itself!) with a .gz suffix into the file archive.tar

$ tar -cvf archive.tar *

will add all files in the current directory apart from archive.tar into the file archive.tar

Saturday, January 26, 2008

Apple Mac OSX and wget

A kind sole has compiled wget and made it available as a package for OSX.

I needed it to get some Quicktime movies, which you can read about here.

You can get it from here.

Thank you!

Friday, January 25, 2008

Apple Mac OSX - locate command fails

On my new MacMini I needed to use the 'locate' command but I got

'locate: `/var/db/locate.database': No such file or directory'.

To fix this is to manually run the weekly CRON job:

$ sudo periodic weekly

or, you can run

$ sudo /usr/libexec/locate.updatedb

and then locate should work OK.

Update: On a Leopard machine you will get a warning if you run the latter command:

">>> WARNING
>>> Executing updatedb as root. This WILL reveal all filenames
>>> on your machine to all login users, which is a security risk."

If you are the sole user of the machine, this will be OK. If you are not, consider your options. On OSX pre-Leopard you don't get this warning of course.

Saturday, January 12, 2008

Apple Mac OSX, Commandline Eject

A previous nugget detailed an issue I have wih SMB and AFP mounts in Leopard not showing on the desktop, and how to get to them usng symlinks through /Volumes.

So if you cannot see them n the desktop, how to gracefully unmount / eject them.

One way is to use a commandline:

umount /Volumes/SMB_Mount

You should not use this to unmount an actual device eg USB drive!

Tuesday, January 8, 2008

Apple Mac OSX, Leopard, SMB / AFP Mounts not showing up on he desktop

Well the good news is I have brand new MacBookPro. It came with Leopard.

But for some reason the SMB and AFP mounts I need do not show up on the desktop.

They are in /volumes but /volumes is invisible, so thats not much use!

One workaround is to use a symlink so you can get to it from your home folder

For my home server I created a folder at my root level and then created symlinks to the shares on the server:

$ mkdir server
$ cd server
$ ln -s /volumes/server_docs

and this creates a symlink to the remote location from my home folder.

This assumes you mounted them first eg from the finder using apple - k

Update: another nugget shows how to eject / unmount items from /Volumes ie when you cannot see them on the desktop.

Update: Turns out this is a change of behvaiour from 10.4 to 10.5. Now you go to finder>preferences and select 'connected servers' from the 'show these items on the desktop' list.

 

www.hutsby.net

templates borrowed from here, modified by me - IFTU