Load,  Statistics, Messages and Users

The following commands are useful to find out what is going on on the system.

#  top #  display  and  update  the  top  cpu  processes

#  mpstat  1 #  display  processors  related  statistics

#  vmstat  2 #  display  virtual  memory  statistics

#  iostat  2 #  display  I/O  statistics  (2  s  intervals)

#  systat  -vmstat  1 #  BSD  summary  of  system  statistics  (1  s  intervals)

#  systat  -tcp  1 #  BSD  tcp  connections  (try  also  -ip)

#  systat  -netstat  1 #  BSD  active  network  connections
 

System :

#  systat  -ifstat  1 #  BSD  network  traffic  through  active  interfaces

#  systat  -iostat  1 #  BSD  CPU  and  and  disk  throughput

#  tail  -n  500  /var/log/messages #  Last  500  kernel/syslog  messages

#  tail  /var/log/warn #  System  warnings  messages  see  syslog.conf
 

Users :

#  id #  Show  the  active  user  id  with  login  and  group

#  last #  Show  last  logins  on  the  system

#  who #  Show  who  is  logged  on  the  system

# groupadd  admin #  Add  group  "admin"  and  user  colin  (Linux/Solaris) 

# useradd  -c  "Colin  Barschel"  -g  admin  -m  colin 

# usermod  -a  -G  <group>  <user> #  Add  existing  user  to  group  (Debian) 

# groupmod  -A  <user>  <group> #  Add  existing  user  to  group  (SuSE) 

#  userdel  colin #  Delete  user  colin  (Linux/Solaris)

#  adduser  joe #  FreeBSD  add  user  joe  (interactive)

#  rmuser  joe #  FreeBSD  delete  user  joe  (interactive)

#  pw  groupadd  admin #  Use  pw  on  FreeBSD

#  pw  groupmod  admin  -m  newmember #  Add  a  new  member  to  a  group

# pw  useradd  colin  -c  "Colin  Barschel"  -g  admin  -m  -s  /bin/tcsh 

# pw  userdel  colin;  pw  groupdel  admin 
 

Encrypted passwords are stored in /etc/shadow for Linux and Solaris and /etc/master.passwd on FreeBSD. If the master.passwd is modified manually (say to delete a password), run # pwd_mkdb

-p  master.passwd to rebuild the database.
 

To temporarily prevent logins system wide (for all users but root) use nologin. The message in nologin will be displayed (might not work with ssh pre-shared keys).

# echo "Sorry no login now" > /etc/nologin # (Linux)
# echo "Sorry no login now" > /var/run/nologin # (FreeBSD)

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.