- 浏览: 525682 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
xuyifeng:
[img][/img][b][/b][/i]玩儿[i][u][ ...
win/linux 网关绑定MAC,ARP攻击 -
icarusli:
一般是要根据具体情况来分析,只不过基本都会是上面所说的原因,但 ...
nginx 502 bad故障原因及解决方法收集 -
haohetao:
博主有Mydigit邀请码吗,给送个haohetao@gmai ...
U盘量产功能增多
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:08Use 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,
-x: Display the system shutdown entries and run level changes.
For more information read last command man page.
http://www.cyberciti.biz/tips/linux-last-reboot-time-and-date-find-out.html
------------------
2 diana 10.15.07 at 12:57 pm
i couldn’t find out the error. please help me.
#Send list of users logged on to server via email
59 11 * * * last | grep date ‘+%a %b %d’ > /tmp/users.out ; mail -s “Users Logged Today” ephrondiana@gmail.com
when i tried to execute,
$ last |grep date ‘+%a %b %d’
i got no such file or directory error.
3 vivek 10.15.07 at 1:06 pm
Should be..
59 11 * * * last | grep $(date '+%a %b %d') > /tmp/users.out ; mail -s “Users Logged"
4 diana 10.15.07 at 1:25 pm
thanks a lot vivek.i din’t expect this much fast reply.But unfortunately when i execute,
$ last | grep $(date ‘+%a %b %d’)
i couldn’t get anything.Please help
5 vivek 10.15.07 at 2:12 pm
My bad…I forgot to include double quote …
59 11 * * * last | grep "$(date '+%a %b %d')" > /tmp/users.out ; mail -s “Users Logged"Also you may wanna try out:
last -t yyyymmddhhmmssHTH
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:08Use 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,
-x: Display the system shutdown entries and run level changes.
For more information read last command man page.
http://www.cyberciti.biz/tips/linux-last-reboot-time-and-date-find-out.html
------------------
2 diana 10.15.07 at 12:57 pm
i couldn’t find out the error. please help me.
#Send list of users logged on to server via email
59 11 * * * last | grep date ‘+%a %b %d’ > /tmp/users.out ; mail -s “Users Logged Today” ephrondiana@gmail.com
when i tried to execute,
$ last |grep date ‘+%a %b %d’
i got no such file or directory error.
3 vivek 10.15.07 at 1:06 pm
Should be..
59 11 * * * last | grep $(date '+%a %b %d') > /tmp/users.out ; mail -s “Users Logged"
4 diana 10.15.07 at 1:25 pm
thanks a lot vivek.i din’t expect this much fast reply.But unfortunately when i execute,
$ last | grep $(date ‘+%a %b %d’)
i couldn’t get anything.Please help
5 vivek 10.15.07 at 2:12 pm
My bad…I forgot to include double quote …
59 11 * * * last | grep "$(date '+%a %b %d')" > /tmp/users.out ; mail -s “Users Logged"Also you may wanna try out:
last -t yyyymmddhhmmssHTH
发表评论
-
Linux下察看swap分区大小的命令
2016-10-01 00:57 1447Linux下察看swap分区大小的命令 top 或者f ... -
Htop安装使用
2014-03-15 14:06 1169Htop是个好东西 htop安装 htop官网源码下载 h ... -
Centos6.0使用第三方YUM源(EPEL,RPMForge,RPMFusion)
2014-03-15 12:49 1500Centos6.0使用第三方YUM源(EPEL,RPMForg ... -
ps aux stat状态解释
2014-02-26 11:54 1464分类: LINUX 运行 ps aux 的到如下信息: ... -
LVM管理及挂载LVM分区-相关
2013-12-22 21:31 8681,创建PV,先fdisk分区(w,写入分区表;partpro ... -
esxi5.1 开启SNMP
2013-08-14 14:10 1596一直知道SNMP在5.1下不是默认打开了,而且GUI那操作都是 ... -
克隆CentOS 6 网卡无法自动识别的解决方法
2012-08-29 01:12 1708VMware 下LINUX下使用ifconfig查看时无eth ... -
memcached 安装测试
2012-04-20 00:52 951http://www.monkey.org/~provos/l ... -
Linux 常用 命令
2012-03-25 00:14 679压缩解压: --------- 比如要打包的A目录在/home ... -
Linux下超大硬盘分构(gpt分区)
2012-03-01 01:41 3365安装CentOS 5.3 时,遇到的问题: 硬件环境:Dell ... -
VMware ESX Server时间较正
2011-10-19 12:42 1463VMware ESX Server的时间准确,比较重要,因为上 ... -
repair filesystem /etc/fstab readonly
2011-10-10 23:15 1737有时候,区块未格式化,或引用了不存在的标签,会造成系统启动不正 ... -
Nginx下WordPress设置Rewrite(含二级域名跳转)
2011-09-28 16:05 15998Apache 在Apache下,利用mod_rewrite来实 ... -
NFS 性能调优
2011-10-10 23:11 1694NFS 性能调优 在 NFS 网络中,服务器是调优的主要目标, ... -
hdparm (显示与设定硬盘的参数。)
2011-09-27 03:17 0语 法: hdparm [-Cfg ... -
mount与umount用法
2011-09-27 03:15 0打不开iso文件的时候,一个简单的命令经可以打开这个iso文件 ... -
NFS 檔案分享
2011-09-27 03:13 01 NFS 的用途 2 掛 ... -
NFS,Memcached,Tokyo tyrant实现session共享性能测试
2011-09-27 03:04 0<p>在我负责的某个 ... -
NFS 性能调优
2011-09-27 03:02 8958在 NFS 网络中,服务 ... -
MySQL服务器的linux性能优化和扩展技巧
2011-09-27 02:55 3098MySQL服务器的linux性能优化和扩展技巧 作者:Yos ...
相关推荐
自己学习《APUE》时写的linux下一些命令(大概40个左右)实现,仅当学习使用,这些命令包括cat cp echo head ls paste rmdir tail umask who chattr cut expand join mkdir pwd sed tee uniq chgrp date find last ...
adduser、chfn、chsh、date、exit、finger、free、fwhois、gitps、groupdel、groupmod、halt、id、kill、last、lastb、login、logname、logout、logrotate、newgrp、nice、procinfo、ps、pstree、reboot、renice、...
config/autoconf.h KCONFIG_TRISTATE=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/tristate.config BUILDROOT_CONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/...
Linux命令大全完整版 目 录 目 录 I 1. linux系统管理命令 1 adduser 1 chfn(change finger information) 1 chsh(change shell) 1 date 2 exit 3 finger 4 free 5 fwhois 5 gitps(gnu interactive tools ...
Linux命令大全(CHM格式离线版) Linux命令大全(修改版) 进行重新编译的说明 文件传输 bye ftp ftpcount ftpshut ftpwho ncftp tftp uucico uucp uupick uuto 备份压缩 ar bunzip2 bzip2 bzip2recover compress cpio ...
第一部分 Linux简介和原理介绍 第一章 概述 1.1 Linux 的历史及背景 1.1.1 什么是 Linux? 1.1.2 Linux 该怎么念? 1.1.3 Linux 的历史 1.1.4 Linux的优点 1.2 Linux与开源软件 1.3 Linux 与 Windows 的比较 1.3.1 ...
linux命令大全,中文版本 Linux命令大全(修改版) 进行重新编译的说明 文件传输 bye ftp ftpcount ftpshut ftpwho ncftp tftp uucico uucp uupick uuto 备份压缩 ar bunzip2 bzip2 bzip2recover compress cpio dump ...
1:find 文件搜索 语法:find [搜索范围][比配条件] 2:locate 在文件资料库中查找文件 语法:locate 文件名 3:which 搜索命令所在目录级别名信息 语法:which[命令名称] 4:whereis 搜索命令所在目录级帮助文档路径 ...
You can send messages with a client/server type setup.<END><br>57 , al40.zip Apparently, if you use AOL to connect to the Internet and you do not touch it for 45 minutes it will timeout and drop ...
6.48 up2date指令:更新Linux系统 6.49 vmstat指令:显示虚拟内存空间 第7天 其他常见指令 7.1 as指令:标准GNU汇编程序 7.2 autoconf指令:产生配置脚本 7.3 autoheader指令:为configure产生模板头文件 7.4 ...
--timeout=[x]=[y]=[color] 倒计时位置、颜色。单位:列,行,24位色彩。 2015-05-14(yaya) 改进 NTFS 文件系统: 对于驻留属性文件(小文件),可以写,也可用 blocklist 显示信息。 对于非驻留属性列表,...
4、交叉编译器 arm-softfloat-linux-gnu-gcc-3.4.5 【实验步骤】 一、建立自己的平台类型 (1)解压文件 #tar jxvf u-boot-1.3.1.tar.bz2 (2)进入 U-Boot源码目录 #cd u-boot-1.3.1 (3)创建自己的开发板...
Ubuntu 相对其它Linux 发行版的主要特点.. 2 基本操作................................................................... 3 进入系统........................................................... 3 命令行提示...