Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-11-2013, 03:32 PM   #1
LQ Newbie
Registered: Sep 2003
Location: India
Posts: 26

Rep: Reputation: 0
Need help with who -b command

I am using who -b command to find out last reboot (host) date/time and insert data into Oracle. However when I issue this command directly in shell prompt it is giving in different format and when the same script is called through Java (front end) it is giving different format. However when I say which who both resolves to same "who". Please help me to resolve the same.

From Unix prompt:
who -b
system boot 2012-12-07 02:22
which who

From Program log file (using set -x):
+ which who
+ who -b
system boot Dec 7 02:22

Old 06-11-2013, 04:03 PM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Too my knowledge, the output of the who command is influenced by the locale setting.

$ echo $LC_TIME
$ who -b
         system boot  2013-06-11 07:48
$ who -b
         system boot  Jun 11 07:48
I make it a habit of setting the locale to POSIX in my scripts (export LC_ALL=POSIX). This might not be preferable in some cases, though. Something similar could probably be done with java.

Last edited by druuna; 06-11-2013 at 04:09 PM. Reason: Fixed post
1 members found this post helpful.
Old 06-11-2013, 07:35 PM   #3
LQ Newbie
Registered: Sep 2003
Location: India
Posts: 26

Original Poster
Rep: Reputation: 0
Thanks for the hint. Setting LOCALE did resolve the issue.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Command/Script required to send an email alert in case command will not respond rajaniyer123 Linux - General 1 05-19-2012 02:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 04:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 02:31 PM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 03:14 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration