OSGeo Live on virtual box

Osgeolive_wordle

For those of you who still wants to keep windows as their main operating system but wants to try the goodies of Free and Open Source software for Geo (FOSS4Geo), OSGeo has many options like live DVD and virtual box VMs. All you have to do is to install Virtual Box and download OSGeo virtual machine (plus 7zip for extracting zipped file). Follow the instruction below

http://live.osgeo.org/en/quickstart/virtualization_quickstart.html

Download will take time as it is around 3GB (I downlaoded vdkm), extratct using the following command (if you are on windows, use 7zip GUI)

7z x software-backup/osgeo-live-vm-8.0.7z

When you will run command sudo apt-get update, password is require and it is “user” (on desktop, there is a file named passwords.txt, contains all the passwords e.g. OS-user ‘user’ has password ‘user’)

One more thing, to set screen to a reasonable size, at the end of OSGeo blog there are some commands, if they do not work (like in my case) go to  start -> System Tools -> Synaptic Package Manager and install the following packages (read my old blog about it Resize virtual machine’s desktop in VirtualBox)

apt-get install virtualbox-guest-dkms
virtualbox-guest-utils
virtualbox-guest-x11

The first package will install second package as dependencies however you have to install third package. If successful with installation, you should see a desktop like below

OSGeoLive

What it contains

  1. Libraries with paths configured (this is what you need the most e.g. gdal)
  2. Programming languages like python (with packages installed)
  3. QGIS, GRASS GIS, gvSIG, OpenJump, SAGA GIS and uDig
  4. R Statistics
  5. and many more 🙂

Trust me, for new users, the first two are very important as they reduce complexities and frustration (a big thanks to OSGeo of course ).

 

Advertisements

Essential Linux commands, version 1.0

I have horrible memory when it comes to names and numbers, same is true for Linux commands. I use and then quickly forget useful commands or switches. I always promises my self to note down these commands but its not working. This blog entry (and the future versions) will serve as personal manual.

Package Information

Show installed packages (all)

dpkg -l

Search for a specific package e.g. gdal

dpkg -l | grep gdal

What if I want to know if  a package is installed or not.

dpkg-query -l 

for example, package gdal is installed or not (Note you have to provide full package name, its not like grep)

dpkg-query -l libgdal-dev

or just the -S switch

dpkg -S libgdal-dev

and if you want to know dependencies of a package, run the following command

apt-cache showpkg package_name

e.g. 

apt-cache showpkg libgdal-dev

Note: Not only the above command shows package dependencies for libgdal-dev package but will also show packages depending on libgdal-dev,see section Reverse Depends in the output.

Folders

List files, sorted by creation date and time

ls -ltrh

Sort by file size

ls -lhS

List hidden folders

ls -ld .?*

List folder with permissions

ls -ld */

Locate command is dependent on a DB, thus, it is necessary to run the following command from time to time (use sudo)

updatedb

Locate command is perfect but some times I want to find folder under a specific path

find /path -name "name" -type d

e.g.

find /var -name "apache2" -type d

-type d is for directory

and to find out folder size

du -hs

switch h is for human readable format and s is summarized. 

Create multiple folders with one command (the command below will create folder 1990, 1991….2010)

mkdir {1990..2010}

Delete folders (and files in them)

rm -rf foldername
or 
rmdir foldername

-f is for force (you will not be asked again and again for ‘yes’)

Files

File size using the following command

ls -sh

h is for human readable format.

Copy files from one location into other

cp -v file*.html /var/www/website

Note: Use -r switch to copy directories.

copy all files from one folder to an other

cp Folder1/* Folder2/

Move files

mv filename folder_name

Example:

 mv test.png /var/www/images

or for folder 

mv -r /home/user/folder /location/to/cop

Rename files

mv original.txt renamed.txt

sudo might be required

Cat command is one of Linux powerful commands. It sequentially concatenates multiple files and can be redirected into a file or pipe for an other command.

cat *.txt > merged-file.txt

or

cat *.txt > grep "some search string"

In a console, how to create files (no mouse to right click and select “create new file” 🙂 ). Use the touch command

touch newfile.txt

ls command can tell a lot about file and folders e.g. if file/folder permission information is require then use

ls -l

It show  user, group, date and time of creation and type of permission on a file and folder. How to understand permission information e.g

drwxrwxr-x Tony:stark ...............

Lets break it down

directory  owner   group  others
d          rwx     rwx    r-x 

it shows owner, group and others permission information e.g. the above item is a folder and owner “Tony” has read, write and execute permissions. user belong to group “stark” have read, write and execute on this item and all other users have read and execute permissions but they cannot write to this item.

What if a user wants to have permissions to read, write or execute. Here comes change mode command

chmod a=rwx file/foler 

e.g

chmod a=rwx Iron-man.txt

sudo is required.

If item is a folder and contains sub-folders and files, the recursive switch can help to set the same permissions for files/sub-folders inside the parent folder

chmod -R a=rwx file/folder

a=rwx means that all owner, group and others will have read, write and execution permission.

If just one type of user is to be given permissions then use the following versions

Give owner read and write permissions
chmod u+rw file/folder
Give group read and execute permissions
chmod g+rx file/folder
Give others read and execute permissions
chmod o+rw file/folders

or combine user and group in one command

chmod u+r,g+x file/folder

Similarly,  permission can be revoked using change mode command e.g. disallow others the permissions of read and write

chmod o-rw file/folder

Find a string in file (in specific folder)

grep -nr yourString* .

-r will enable grep to search in sub folders

Remove files

rm file

remove folder

rmdir foldername

Remove files and folders recursively

rm -rf foldername