- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Better last[b] command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 04:45 AM
тАО08-13-2009 04:45 AM
Better last[b] command
(1) The year is not displayed in the output.
(2) Only the logout "time" is displayed, not the "date" (you have to calculate it from the duration given in parentheses).
(3) It is not possible to select a portion of the output (let's say, I want only the information between December 1st 2008 - January 31st 2009).
Are there better versions of these commands, or has anybody written a program to display the data in /var/adm/*tmp* files in a more "script-friendly" way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 05:07 AM
тАО08-13-2009 05:07 AM
Re: Better last[b] command
# /usr/sbin/acct/fwtmp < /var/adm/wtmp|
...will convert the binary database into an ASCII stream which includes not only the year but the Epoch value of the human-readable date.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 06:30 AM
тАО08-13-2009 06:30 AM
Re: Better last[b] command
# /usr/sbin/acct/fwtmp < /var/adm/wtmp| tail
J├Г┬д 0 0 0000 0000 0 Jan 1 02:00:00 1970
0 0 0000 0000 0 Jan 1 02:00:00 1970 100.101.118.47
0 0 0000 45203 0 Jan 1 02:00:00 1970
dev/ 27403 8 0000 0000 0 Jan 1 02:00:00 1970
1886679855 13824 0000 0000 4879 Jan 1 03:21:19 1970 74.132.6.191
0 0 0000 32000 1886679855 Oct 14 16:44:15 2029
J
├Г┬╗ 0 0 0000 0000 0 Jan 1 02:00:00 1970
0 0 0000 0000 0 Jan 1 02:00:00 1970 100.101.118.47
0 0 0000 45204 0 Jan 1 02:00:00 1970
dev/ 16163 8 0000 0000 0 Jan 1 02:00:00 1970
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 06:42 AM
тАО08-13-2009 06:42 AM
Re: Better last[b] command
Sorry, try this:
# /usr/sbin/acct/fwtmp -X < /var/adm/wtmps|
You will have to filter the ASCII output based on the file layout.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 06:44 AM
тАО08-13-2009 06:44 AM
Re: Better last[b] command
...and of course the command should look like:
# /usr/sbin/acct/fwtmp -X < /var/adm/wtmps
...I keep appending the trailing pipe :-(
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 06:52 AM
тАО08-13-2009 06:52 AM
Re: Better last[b] command
This is better; but, with this command the logins and logouts are displayed on separate lines and it is difficult to correlate them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2009 06:59 AM
тАО08-13-2009 06:59 AM
Re: Better last[b] command
> This is better; but, with this command the logins and logouts are displayed on separate lines and it is difficult to correlate them.
Yes, that's true. However, if you look at the the record types I think you will see that with a little scripting you can filter what you need:
http://docs.hp.com/en/B2355-60130/utmp.4.html
Regards!
...JRF...