Jyothi's Weblog

Main | Printing basics on... »

http://blogs.sun.com/jyothi/date/20070307 Wednesday March 07, 2007

Solaris for newbies

Hello World

Welcome to my first blog on Solaris for newbies. I am a technical writer in the Solaris Developers group at Sun Microsystems. I hope to start writing about Solaris on the Intel platform in the coming weeks and months, but I thought I would first cover some ground on using basic Solaris commands for newbies. I am not entirely clear how "newbie" this blog should be, but if you are a student or a developer who has been mostly on Windows, here are some useful things to help you get started on Solaris.

If you are wondering why you should use Solaris to develop your applications, read Rich Teer's article "Building Software on Solaris" here.

And even if you are not going to develop apps on Solaris, I hope you will find this blog and the forthcoming  ones make it a little bit easier for you to get started on Solaris.

This blog explains the PATH variable and how to set it.

Setting your path variable in sh or bash.

After you have logged in successfully into your system, an initial "environment" is set up by the login program. A shell is automatically started , the command prompt symbol tells you which shell you are using. $ indicates Bourne or bash, % indicates C shell . You can also type

$ echo $SHELL

to find out which shell you are in.

The path is stored in the .login file and the .rc files. These files are located in your home directory. The path is important because every time you type a command at the command prompt, the shell tries to locate the command in a list of directories;the PATH variable speeds up this process for the shell by providing a shortcut list of directories. If you are using bash or sh, type the following at the command prompt, where /home/bin is the path you want to add to your directory list.

$ PATH = /home/bin:$PATH

$ export PATH

You could also type

$ export PATH = /home/bin:$PATH

/home/bin is the path that is added to the existing list of directories in the PATH variable. To check if your path is set correctly, type

$ echo $PATH

If the shell cannot find a command or filename that you typed,  you will get a "command not found" error message. To locate the command or file ,type

$ find . -name filename -print

which will recursively search for filename from the current directory and print out the path if found.

You can then add the path to your path variable. If you do not want to add the path to your path variable, simply type in the full path at the prompt to execute the command.

You can also modify the path in your .bashrc file. A basic .bashrc could look something like this.

umask 022

#When a file or directory is created, it has a default set of permissions.These permissions are determined in the umask setting in your .bashrc or .login file.A umask set to 022 grants read(r),write(w) and execute(x) permission to the user and only read permission for group and others.For more on file security go here .

export PS1="[\u@\h%] "

#Displays username@host at the prompt instead of the just the prompt symbol For instance, js@sun1, where js is the user and sun1 is the host .

export PS1="[\u\h \w]\$ "

#Dsiplays the current directory along with the username and host

set PRINTER printer1

#Sets your default printer to printer1

export MACH=`uname -p`

#Prints the name of the current system.

export EDITOR=vi

stty erase ^H

#The backspace key works!!

export PATH=/usr/bin:$PATH

export MANPATH=/usr/man

export JAVA_HOME=/usr/java

alias rm='rm -i'

#A useful thing to have, the shell will ask you before deleting any files

For the changes to be  effective immediately, source the file by typing

$ . ./.bashrc

For more information on using bash, visit http://www.gnu.org/software/bash

Setting your path in a C shell

% setenv PATH /home/bin:$PATH

This adds /home/bin to the path that was already set. The setenv command displays the environment variables. The path variable is stored in the .cshrc file. Just like .bashrc, you can modify the .cshrc.

To source the .cshrc file, type

% source ~/.cshrc

You can also check out the New to Solaris document on docs.sun.com for more information.

The man pages will provide a detailed list of all options associated with a command. Type

$ man -l command-name

which will list all manual pages matching command-name in the search path.

That's it for my first blog. I look forward to hearing from you, do send in your comments.


Comments:

Thanks a whole bunch. Finally someone @ Sun is doing something sensible.

Posted by W. Wayne Liauh on March 07, 2007 at 01:10 PM PST #

http://www.batterylaptoppower.com/sony/pcga-bp2v.php Rechargeable Battery for Sony PCGA-BP4V PCGA-BP2V laptop battery ,
http://www.batterylaptoppower.com/sony/pcg-x505.php battery fits SONY PCGA-BP505 PCG-X505 P PCG-X505 SP laptop battery ,
http://www.batterylaptoppower.com/sony/vgp-bps2a.php LAPTOP BATTERY SONY VAIO VGP-BPS2 VGP-BPS2B VGP-BPS2A black laptop battery ,

Posted by batteries on November 05, 2008 at 07:57 PM PST #

Post a Comment:
Comments are closed for this entry.

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.