Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

last(1) [minix man page]

LAST(1) 						      General Commands Manual							   LAST(1)

NAME
last - display recent on-line session records SYNOPSIS
last [-f file] [-r] [-n] [name] [tty] ... OPTIONS
-f Use file instead of /usr/adm/wtmp -r Search backwards only to last reboot -n Print a maximum of n lines EXAMPLES
last reboot # When was the system last rebooted? last ast # When was the last login for ast? last -10 tty00 tty01 # Display last 10 logins on tty00 or tty01 DESCRIPTION
Last Searches backward through the login administration file (default is /usr/adm/wtmp), printing information about previous logins and reboots. During a long search, the SIGQUIT signal (CTRL-) causes last to display how far back it has gone; it then continues. SEE ALSO
login(1). LAST(1)

Check Out this Related Man Page

UTMP(5) 							File Formats Manual							   UTMP(5)

NAME
utmp, wtmp - logged in users, login and logout history SYNOPSIS
#include <sys/types.h> #include <utmp.h> DESCRIPTION
The files /etc/utmp and /usr/adm/wtmp respectively contain the currently logged in users, and the history of logins and logouts. Each file is an array of the following structure defined in <utmp.h>: struct utmp { char ut_user[8]; /* user name */ char ut_line[12]; /* terminal name */ char ut_host[16]; /* host name, when remote */ time_t ut_time; /* login/logout time */ }; #define ut_name ut_user/* for compatibility with other systems */ The structure contains more fields than those listed, but they are only of interest to init and login. Note that the ut_name field is a compatibility alias for ut_user, it is actually better to use it. A login entry is completely specified. A logout entry has a null string for ut_name. A shutdown or reboot entry has an ut_line field con- taining a "~" (tilde). The ut_name field is usually the name of the program that did the shutdown, or "reboot" at reboot. This is a bit confusing, but note that there should always be two such entries. If you see just one entry then the system has crashed, if you see two entries then the system was properly shut down and later rebooted. FILES
/etc/utmp Currently logged in users. /usr/adm/wtmp History of logins and logouts. SEE ALSO
who(1), ttyslot(3). AUTHOR
Kees J. Bot (kjb@cs.vu.nl) UTMP(5)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print last 4 columns (variable column #)

I have rows of data with variable number of columns. Is there an easy way to print out the last 4 columns or rather the 4th and 3rd last column? data looks like this: 24 20:51 N 9 10.00 Overcast OVC110 27 11 30.04 1017.7 24 19:51 N 7 10.00 Mostly Cloudy BKN110 28 15... (19 Replies)
Discussion started by: Da_Duck
19 Replies

2. Shell Programming and Scripting

How can I identify the last saved log?

Our system produce logs when a script is run which may not be daily, the logs have a format: name_YYMMDD.log - both name and .log are consistent, date changes as per the day the script is run. Is there a way of finding the last saved log? (20 Replies)
Discussion started by: gugs
20 Replies

3. Shell Programming and Scripting

using sed but want to drop last line

Howdy all. I have some scripts that read a text file looking for a keyword, then returning all the text until another keyword and puts it into a new file. Problem is, sed returns the entire last line that contains the 2nd keyword, and I don't want it! Here's an example of the sed script line: ... (21 Replies)
Discussion started by: atc98092
21 Replies

4. Shell Programming and Scripting

Recursive FTP -- here at last.

Over the past few weeks, I saw a couple of threads requesting recursive ftp: Copying files between 2 Unix server ftp from NT to UNIX I decided to try to write a script to accommodate these requests. The result is HardFeed. Here are a few examples of what it can do. HardFeed ftpserver... (52 Replies)
Discussion started by: Perderabo
52 Replies

5. Shell Programming and Scripting

find the last digits of a string

print out 201 in following string, Please note the chars before 201 are random, no fixed format. ua07app201 (20 Replies)
Discussion started by: honglus
20 Replies

6. Shell Programming and Scripting

Replacing the last character for each line in a file

Hello, I have a csv file and will like to replace the last character of each line in the file with Z (20 Replies)
Discussion started by: 123script
20 Replies

7. Shell Programming and Scripting

Split file - Include first and last row in each file.

Hi All, We have file structure as following. (Coma ';' delimiter file) Header 1;... 1;... 1;... 2;... 2;... 2;... Trailer We need to split this file as following. (for each change in first field, after header, we need to create new file with Header and Trailer line) Header... (21 Replies)
Discussion started by: meetmedude
21 Replies

8. Shell Programming and Scripting

Select everything between first and last occurrence of same pattern

Greetings, I am writing a script which requires as a part, selecting all the lines between the first and last occurrence of a pattern. I have an nawk alternative that is working. But thre should be a generic script that should run on all os viz, linux, sun , aix. The awk script that i... (25 Replies)
Discussion started by: usha rao
25 Replies

9. Shell Programming and Scripting

The last argument contains spaces, how do I get it into a variable?

Gooday I have an argument string that contains 15 arguments. The first 14 arguments are easy to handle because they are separated by spaces ARG14=`echo ${ARGSTRING} | awk '{print $14}'` The last argument is a text that may be empty or contain spaces. So any ideas on how I get the last... (23 Replies)
Discussion started by: zagga
23 Replies

10. Shell Programming and Scripting

Want to remove the last characters from each row of csv using shell script

Hi, I've a csv file seperated by '|' from which I'm trying to remove the excess '|' characters more than the existing fields. My CSV looks like as below. HRLOAD|Service|AddChange|EN PERSONID|STATUS|LASTNAME|FIRSTNAME|ITDCLIENTUSERID|ADDRESSLINE1 10000001|ACTIVE|Testazar1|Testore1|20041|||... (24 Replies)
Discussion started by: rajak.net
24 Replies

11. Shell Programming and Scripting

Last occurrence of code between two tags

Hi, I am new to linux and have a challenge while I am debugging my application logs n linux boxes. our log file xxx.log will have different responses coming in its way while an user logs in. Each response might be of 2000 lines or more. Many users do login at a time and our log file goes big... (24 Replies)
Discussion started by: nariwithu
24 Replies

12. Shell Programming and Scripting

How to remove the last 3 lines from many files?

Hello, I need to run a command or shell script that will remove the last 3 lines from every .js file that is under the directory /var/ww/vhost/ Can you please help ? thank you. (22 Replies)
Discussion started by: MaRiOsGR
22 Replies

13. Shell Programming and Scripting

[Solved] Fetching logs of last few days from logfile

Hi All, I have a requirement to fetch logs of last 'N' days. I am trying the following command which is working fine if it finds the date of that day in logfile. START=`TZ="GMT+$((24*N))" date +"%Y %b %d"` this is being used to fetch 'N'th day's date and awk '/'"$START"'/{p=1}... (24 Replies)
Discussion started by: KDMishra
24 Replies

14. Shell Programming and Scripting

Print filename and last line using awk

Hi, using awk command I want to print filenames and the last line of each file, in a single command line statement. I want to use 'awk', because I want to add more functionality to this logic later. I tried the following on *.sh files in the current directory find . -type f -name "*.sh"... (26 Replies)
Discussion started by: ysrini
26 Replies

15. Shell Programming and Scripting

awk last n lines of file

Just my second week working on awk I need a hint for the following tasks. I want to limit my logfile from the very outset to 200 lines. All I do until now is head -c 10K >> /home/uplog.txt | awk 'END{print NR " swap " NF$5; exit}' /home/uplog.txt; After being read it shall print the very... (27 Replies)
Discussion started by: 1in10
27 Replies