Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

How to do it...

  1. The who command reports information about the current users:
        $ who
        slynux   pts/0   2010-09-29 05:24 (slynuxs-macbook-pro.local)
        slynux   tty7    2010-09-29 07:08 (:0) 

This output lists the login name, the TTY used by the users, login time, and remote hostname (or X display information) about logged in users.

TTY (the term comes from TeleTYpewriter) is the device file associated with a text terminal that is created in /dev when a terminal is newly spawned by the user (for example, /dev/pts/3). The device path for the current terminal can be found out by executing the tty command.
  1. The w command provides more detailed information:
        $ w
        07:09:05 up  1:45,  2 users,  load average: 0.12, 0.06, 0.02
 USER TTY FROM LOGIN@ IDLE JCPU ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985