Linux View user Login system related commands and scripting (vii)
View user log in System
1.W shows who's logged in and what's being done
2.who shows who logged in
-R: Show System RunLevel
3.sleep Sleep Command (sleep 5 sleeps 5 seconds after waking up)
4.whoami display user name or UID
5.last: Display/var/log/wtmp file showing user login history and System restart history
-N 3: Displays information about the last 3 times
6.LASTB: Display/var/log/btmp file, display user error login attempt
-N 3: Displays the last 3 bad logon attempts
7.lastlog: Displays the last successful login information for each user;
-U user name: Displays the most recent login information for the specified user
8.basename Displays the last file name
$: Script path and name when executing script
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/17/wKioL1cTW8iDfvkBAACcinJ97GE231.jpg "title=" Base.jpg "alt=" Wkiol1ctw8idfvkbaaccinj97ge231.jpg "/>
9.mail send and receive mail commands
10.hostname command: Modify the hostname, this is real-time modification, the next reboot does not take effect
For example: If the host name of the current host is empty, or (none), or localhost, change it to willow.com
[-Z ' hostname '] | | [' hostname ' = = ' (none) '-o ' hostname ' = = ' localhost '] && hostname willow.com
11. Generate Random Numbers
random:0-32768
/dev/random:
/dev/urandom:
12. Generate 100 random numbers using random, and find the maximum and minimum values; The script is as follows:
#!/bin/bash
Max=0
Min=0
For I in ' SEQ 1 100 '; Do
Rdom= $RANDOM
[$I = = 1] && min= $RDOM
If [$I-le 99]; Then
Echo-n "$I: $RDOM," Let the random number display one by one be displayed and separated by a colon
Else
echo "$I: $RDOM" Let the last number of random numbers show up
Fi
[$RDOM-gt $MAX] && max= $RDOM
[$RDOM-lt $MIN] && min= $RDOM
Done
echo "Max is $MAX" Maximum number
echo "min is $MIN" minimum number
This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1764786
Linux View user Login system related commands and scripting (vii)