Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script to display last login date/time? Post 11356 by ryaneverett5 on Monday 3rd of December 2001 04:02:18 PM
Old 12-03-2001
I wanted to produce a text file that had each users last login info in it. My script is as follows, but it produces some weird errors. Any obvious mistakes?

#!/sbin/sh
for i in `niscat passwd.org_dir | cut -f1 -d":"`
do
#echo
echo `last $i | head -1 | awk '{print $1" "$4" "$5" "$6}'` >> recentlogin.txt
#echo
done
 

10 More Discussions You Might Find Interesting

1. Solaris

display date n Time

Hi Friends, Can any one guide me regarding 'Display the date and time' command other than the command 'date' thanks n regards SsRrIi (1 Reply)
Discussion started by: SsRrIi
1 Replies

2. AIX

Unable to display the date-time in seconds on AIX

Hi, In unix the command "date +%s" displays the date-time in seconds since â00:00:00 1970-01-01 UTCâ (a GNU extension) when executed on unix: -sh-2.05b$ date +%s 1152092690 I tried with all the format control output but unable to display the date-time in seconds i,e as in unix format. Can... (6 Replies)
Discussion started by: me_haroon
6 Replies

3. Shell Programming and Scripting

date and time to display on the terminal

hi all, am trying to 'grep' some text from a log file and use the 'cut' command to read from that line i just grep'ed to extract date/time and response times. code sniplet i am using is : grep -i 'text to grep' Out.log | while read LINE; do ... (11 Replies)
Discussion started by: cesarNZ
11 Replies

4. UNIX for Dummies Questions & Answers

last login date and time for all users

I need a command that will list all the users and their last login date & time. I was trying the last command and the who command, but can't get exactly what I need. I just need the output to be user name and last login date . Thanks for your help! (3 Replies)
Discussion started by: igidttam
3 Replies

5. UNIX for Dummies Questions & Answers

script to write the last login date and time

I want to make a script to write me in a file the date(format 16-12-2008) and hour(format 15:12:21) of the last login in the system; what can i add to the <last> command in order to be suitable? (4 Replies)
Discussion started by: kalimat
4 Replies

6. Shell Programming and Scripting

script to display time

hey folks, i am stuc in this problem. You all might help me out. I want to write a BASH script to display time every 15 seconds using %r field descriptor. And want to clear the window each time before displaying time using clear command. Please help me out (3 Replies)
Discussion started by: manojrsb
3 Replies

7. UNIX for Dummies Questions & Answers

How to do a login time and date list of users never logged on?

Hello, I'm trying to do a list of user that never connected to a couple of servers. I want to do a diff between the servers lists, and print out only the users that never has logged on each server. Here my first step : SERVER01: # finger `egrep -v -e "^\s*#" /etc/passwd | awk '{ print $1 }' |... (4 Replies)
Discussion started by: gogol_bordello
4 Replies

8. UNIX for Dummies Questions & Answers

How to always display date/time regardless of directory?

I found via Google a way to show the date and time stamp once I log in. However, whenever I cd to another directory it doesn't display the correct path. Here are the relevant parts from my .kshrc : unset _h _m _s eval $(date "+_h=%H ;_m=%M ;_s=%S") ((SECONDS =... (3 Replies)
Discussion started by: Mike F.
3 Replies

9. Shell Programming and Scripting

Display files created on particular date & time

Hi , I have BASH system & i am trying to display the files created on a particular date and time, and after displaying those files I also want to delete all those files.Can anyone of you help me out for this............. Thanx Original post contents restored... Please do not erase the question... (3 Replies)
Discussion started by: rakeshtomar82
3 Replies

10. UNIX for Dummies Questions & Answers

Display Date and Time in GDB

In gdb is there any way we can display date/time in first column while debugging or is there any command which will print date/time? I am asking this just to know when exactly a breakpoint got hit. (6 Replies)
Discussion started by: rupeshkp728
6 Replies
FGETTY(8)						   System Administrator's Manual						 FGETTY(8)

NAME
fgetty - a small getty for linux SYNOPSIS
fgetty tty [--noclear] [--long-hostname] DESCRIPTION
The command fgetty is normally invoked by init(8), opens a tty port, prompts for a login name and invokes the /bin/login command. OPTIONS
--noclear makes fgetty not clear the screen before displaying the login prompt. --long-hostname makes fgetty display the full hostname in the login prompt. FILES
/etc/issue printed before the login prompt /etc/inittab init(8) configuration file /var/run/utmp the system status file ISSUE ESCAPES
The issue-file (/etc/issue or the file may contain certain escape codes to display the system name, date and time etc. All escape codes consist of a backslash () immediately followed by one of the letters explained below. d the current date. (eg: 2002-01-19) s the system name, the name of the operating system. (eg: Linux) l the name of the current tty line. (eg: tty3) m the architecture identifier of the machine (eg: i586) n the nodename of the machine, also known as the hostname. (eg: sirius) o the domainname of the machine. (eg: (none)) r the release number of the OS. (eg: 2.4.3-i) t the current time. (eg: 14:51:51) u the number of current users logged in. (eg: 4) U the string "1 user" or "<n> users", where <n> is the number of current users logged in. (eg: 4 users) v Insert the version of the OS. (eg: #2 Fre Jan 18 23:05:45 CET 2002) ENVIRONMENT VARIABLES
HOST is set to your hostname TERM is set to linux TTY is set to the current tty line RETURN VALUES
1 could not chown/chmod tty device 3 could not open tty device 4 not a typewriter 5 vhangup failed 6 could not open tty (can't happen) 7 dup failed 8 could not exec login 9 read returned an unexpected error 10 unprintable character in login name 11 login name too long (>40) 13 user name started with a dash 23 received SIGQUIT AUTHOR
Felix von Leitner <felix-fgetty@fefe.de> Homepage: http://www.fefe.de/fgetty/ fgetty 2002-01-19 FGETTY(8)
All times are GMT -4. The time now is 12:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy