Search This Blog

Friday, February 17, 2012

Restore point in Linux

Do we have any feature in BOSS O.S.such that we can make some restore point of the system and all the installed softwares come automatically such as Recovery point in windows?

Ans: You can get some idea from here 

http://superuser.com/questions/163716/is-there-a-restore-point-in-linux-debian-ubuntu-like-windows


Wednesday, February 8, 2012

Friday, December 2, 2011

Display or print UNIX / Linux path ~ $PATH variable

In UNIX / Linux file systems, the human-readable address of a resource is defined by PATH. On Unix / Linux like operating systems, (as well as on DOS / Windows and its descendants), PATH is an environment variable listing a set of paths to directories where executables may be found.
Display current PATH

Use echo command:
$ echo $PATH
Output:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games

Modify current PATH

Use export command to add /opt/games to PATH, enter:
export PATH=$PATH:/opt/games

To format your PATH variable for easy viewing, add following code to your bash startup file (such as ~/.bashrc or ~/.bash_profile) :

function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}

(Function credit: usenet archive)

Now just run path:
$ path
Output:

/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/bin/X11
/usr/games

Source: http://www.cyberciti.biz/faq/howto-print-path-variable/

Thursday, December 1, 2011

How to Find the JAVA HOME Directory in ubuntu linux

Code:

$ whereis java
java: /usr/bin/java /etc/java /usr/share/java

That tells the command java resides in /usr/bin/java.

Dig again:

Code:

$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2009-01-15 18:34 /usr/bin/java -> /etc/alternatives/java

So, now we know that /usr/bin/java is actually a symbolic link to /etc/alternatives/java.

Dig deeper using the same method above:
Code:

$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 31 2009-01-15 18:34 /etc/alternatives/java -> /usr/local/jre1.6.0_07/bin/java

So, thats the actual location of java: /usr/local/jre.....
You could still dig deeper to find other symbolic links.

Source: http://ubuntuforums.org/showthread.php?t=1054731

How to set JAVA HOME path in Linux

~/.bash_profile is a startup script which generally runs once. This particular file is used for commands which run when the normal user logs in. Common uses for .bash_profile are to set environment variables such as PATH, JAVA_HOME, to create aliases for shell commands, and to set the default permissions for newly created files.
Set JAVA_HOME / PATH for single user

Login to your account and open .bash_profile file
$ vi ~/.bash_profile
Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
Set PATH as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file. Just logout and login back to see new changes:
$ echo $JAVA_HOME
$ echo $PATH
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
$ which java

Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.
Set JAVA_HOME / PATH for all user

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:
# vi /etc/profile
Next setup PATH / JAVA_PATH variables as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin


Source: http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/

Wednesday, November 30, 2011

How to Install Java in Linux

1. Use following command to know the current jdk version available in apt-get
sudo apt-cache search jdk

2. Use following command to install JDK and JRE
apt-get install sun-java6-jdk sun-java6-jre

Friday, November 25, 2011

Error: gzip: stdin: not in gzip format

# gzip -d xxxxxx.x.tar.gz
# tar -zxvf xxxxxx.x.x.tar

It gives following error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors

Solution:
You used "tar -zxvf" for the second command. the 'z' option tells tar to use gzip to uncompress the file. Since you already uncompressed it in the first command, gzip doesn't know what to do with it, and it consequently croaks. Tar stops because gzip encountered a problem. So, with the file you have now, you would extract it with:
tar -xvf xxxxxx.x.x.tar

I would go back and re-gzip the tar file though (to save space):
gzip xxxxxx.x.x.tar
tar -zxvf xxxxxx.x.x.tar.gz

Source: http://www.linuxquestions.org/questions/linux-newbie-8/tar-error-child-returned-status-1-a-208083/