Vous êtes sur la page 1sur 3

In Unix, how do I check who else is logged into the same

computer as I am?
You can use any one of several Unix commands to see who is logged into the same computer as
you. Each command yields different amounts of information:
y You can obtain a list of information about current users by entering the finger command
with no options:
finger
y For a list of usernames currently logged in, presented in a condensed, single-line format,
enter:
users
y For more information, including each login of a username, the terminal users are attached
to, the date and time that login began, and possibly the computer from which they are
making the connection, enter:
who
y For extensive information, including username, terminal, IP number of the source
computer, the time the login began, any idle time, process CPU cycles, job CPU cycles,
and the currently running command, enter:
w


Common Linux log files name and usage
y /var/log/message: General message and system related stuff
y /var/log/auth.log: Authenication logs
y /var/log/kern.log: Kernel logs
y /var/log/cron.log: Crond logs (cron job)
y /var/log/maillog: Mail server logs
y /var/log/qmail/ : Qmail log directory (more files inside this directory)
y /var/log/httpd/: Apache access and error logs directory
y /var/log/lighttpd: Lighttpd access and error logs directory
y /var/log/boot.log : System boot log
y /var/log/mysqld.log: MySQL database server log file
y /var/log/secure: Authentication log
y /var/log/utmp or /var/log/wtmp : Login records file
y /var/log/yum.log: Yum log files
In short /var/log is the location where you should find all Linux logs file. However some
applications such as httpd have a directory within /var/log/ for their own log files. You can rotate
log file using logrotate software and monitor logs files using logwatch software.
Linux last reboot time and date find out
by nixcraft on April 30, 2006 12 comments

So how do you find Linux / UNIX system last reboot or shutdown date and time? The last utility
will either list the sessions of specified users, ttys, and hosts, in reverse time order, or list the
users logged in at a specified date and time. Each line of output contains the user name, the tty
from which the session was conducted, any hostname, the start and stop times for the session,
and the duration of the session.
who command
You need to use who command, to print who is logged on. It also displays the time of last system
boot. Use last command to display system reboot and shutdown date and time.
$ who b
Output:
system boot Apr 30 15:08
Use last command to display listing of last logged in users and system last reboot time and date:
$ last reboot | less
Or better try:
$ last reboot | head -1
Output:
reboot system boot 2.6.15.4 Sun Apr 30 15:08 - 16:22 (01:13)
last command searches back through the file /var/log/wtmp and displays a list of all users logged
in (and out) since that file was created. The pseudo user reboot logs in each time the system is
rebooted. Thus last reboot command will show a log of all reboots since the log file was created.
To display last shutdown date and time use following command:
$ last -x|grep shutdown | head -1
Output:
shutdown system down 2.6.15.4 Sun Apr 30 13:31 - 15:08 (01:37)
Where,
y -x: Display the system shutdown entries and run level changes.

Vous aimerez peut-être aussi