Sponsored Content
Top Forums Shell Programming and Scripting who command from non terminal in unix Post 302593185 by lalitpct on Thursday 26th of January 2012 03:00:35 AM
Old 01-26-2012
who command from non terminal in unix

I was executing a command "who -ms" from a CHUI application but i get below message,
It seems that who command can be executed only when we are logged directly in unix box as we have terminal.
Is there a way to get rid of this problem , or anyother command where i can get machine name of the terminal from where i am logged in?
Code:
process not attached to terminal                                               x
xUsage: who [-AabdHilmpqrsTtuwX?] [am {i,I}] [file]                            x
x         -A   Accounting entries                                              x
x         -a   All (AbdHlprTtu) options                                        x
x         -b   Boot time                                                       x
x         -d   Dead processes                                                  x
x         -H   Display a header (title)                                        x
x         -l   Login processes                                                 x
x         -m   Information about current terminal (same as 'am i'              x
x         -p   Processes other than getty or user process                      x
x         -q   Quick (only user and host name)                                 x
x         -r   Run level                                                       x
x         -s   Short form (suppress Activity and PID)                          x
x         -T,w Status of tty (+ writable, - not writable, x exclusive open, ? hx
x         -t   Time changes                                                    x
x         -u,i Activity and PID of shell                                       x
x         -X   Expanded user names

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 01-26-2012 at 05:31 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

connecting to unix through hyper terminal - as a dumb terminal

I just changed from windows NT to XP and I am no longer able to connect to my unix system. I used to use hyper terminal -- which acts as dumb terminal to my main frame unix system. I think one of the options used to be "direct to comX". This option isn't listed now. I use a serial port and the... (2 Replies)
Discussion started by: michelle
2 Replies

2. UNIX for Dummies Questions & Answers

Need Someone With Access To Unix Terminal

Any chance someone could look up the Whois for www.weddingchannel.la and www.art.la at the following link: whois -h whois.afilias-grs.info domainname.la Thanks in advance!!! rdm (4 Replies)
Discussion started by: rdm
4 Replies

3. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies

4. UNIX for Dummies Questions & Answers

what's the terminal command to do this ?

what's the terminal command to do this ? thanks (6 Replies)
Discussion started by: aneuryzma
6 Replies

5. Shell Programming and Scripting

Is command line invocation of gnome-terminal to run more than one command possible?

Hello, I am trying to learn how to pass something more than a one-command startup for gnome-terminal. I will give an example of what I'm trying to do here: #! /bin/bash # #TODO write this for gnome and xterm USAGE=" ______________________________________________ ${0##*/} run... (0 Replies)
Discussion started by: Narnie
0 Replies

6. Shell Programming and Scripting

How do I launch a command on an existing terminal in unix using PERL

Hello, I have a PERL-TK based GUI from which I want to launch a command on an existing UNIX terminal (this is also the parent terminal for this perl based gui window). The command I want to launch is interactive (there is no intention to interact with that command from the same PERL gui i.e. no... (2 Replies)
Discussion started by: AnuragJindal
2 Replies

7. UNIX for Advanced & Expert Users

unix command for terminal - view sequences as a single line?

Hello, I'm looking for some code that will list sequences of files as a single line. ie, sequences of files like this: filename.1.ext filename.2.ext filename.3.ext filename.4.ext filename.5.ext filename.6.ext filename.7.ext filename.8.ext filename.9.ext filename.10.ext would... (6 Replies)
Discussion started by: kentm
6 Replies

8. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

9. Linux

Terminal command

I need to execute apt-cdrom to designate the pendrive using LM 18.3x 'live". (instead of CD-Rom) Rick (7 Replies)
Discussion started by: 69Rixter
7 Replies
who(1)							      General Commands Manual							    who(1)

NAME
who - who is on the system SYNOPSIS
[file] DESCRIPTION
The command can list the user's name, terminal line, login time, elapsed time since input activity occurred on the line, the user's host name, and the process-ID of the command interpreter (shell) for each current system user. It examines the database to obtain the informa- tion. If file is given, that file is examined, file should be a like file. The command with the or option identifies the invoking user. Except for the default option, the general format for output entries is: name [state] line time activity pid [comment] [exit] With options, can list logins, logoffs, reboots, and changes to the system clock, as well as other processes spawned by the process. Options Output only information about the current terminal. This option is equivalent to the and options described above. Lists only those users who are currently logged in. name is the user's login name. line is the name of the line as found in the directory The time field indicates when the user logged in. activity is the number of hours and minutes since input activity last occurred on that particular line. A dot indi- cates that the terminal has seen activity in the last minute and is therefore ``current''. If more than twenty-four hours have elapsed or the line has not been used since boot time, the entry is marked This field is useful when try- ing to determine whether a person is working at the terminal or not. The pid is the process-ID of the user's login process. The comment is the comment field associated with this line as found in (see inittab(4)). This can contain information about where the terminal is located, the telephone number of the dataset, type of terminal if hard-wired, etc. If no such information is found, then prints, as the comment, the user's host name as it was stored in the database or named file. Note that the user's host name is printed instead of comments from the file if the option is used in conjunction with the option. Same as the option, except that the state of the terminal line is printed. state describes whether someone else can write to that terminal. A appears if the terminal is writable by anyone; a appears if it is not. can write to all lines hav- ing a or a in the state field. If a bad line is encountered, a is printed. (UNIX Standard only, see standards(5).) Only the following fields are displayed: name state line time Lists only those lines on which the system is waiting for someone to login. The name field is in such cases. Other fields are the same as for user entries except that the state field does not exist. Prints column headings above the regular output. A quick displaying only the names and the number of users currently logged in. When this option is used, all other options are ignored. Lists any other process which is currently active and has been previously spawned by init. The name field is the name of the program executed by as found in The state, line, and activity fields have no meaning. The comment field shows the id field of the line from that spawned this process. See inittab(4). This option displays all processes that have expired and have not been respawned by The exit field appears for dead processes and contains the termina- tion and exit values of the dead process (as returned by -- see wait(2)). This can be useful in determining why a process terminated. Indicates the time and date of the last reboot. Indicates the current run-level of the process. The last three fields contain the current state of the number of times that state has been previously entered, and the previous state. These fields are updated each time changes to a different run state. Indicates the last change to the system clock (via the command) by See su(1). Processes database or the named file with all options turned on. Default. Lists only the name, line, and time fields. When the file is specified, (the option can be used to examine the file) this option indicates when the accounting system was turned on or off using the or commands (see acctsh(1M)). The name field is a dot The line field is or a reason that was given as an option to the command. The time is the time that the on/off activity occurred. Displays the user's host name. If the user is logged in on a tty, displays the string returned from (see gethostname(2)). If the user is not logged in on a tty and the host name stored in the database or named like file has not been truncated when stored (meaning that the entire host name was stored with no loss of information), it is displayed as it was stored. Otherwise, the (IPv4) or (IPv6) function is called with the internet address of the host (see gethostent(3N)). The host name returned by (IPv4) or (IPv6) is displayed unless it returns an error, in which case the truncated host name is dis- played. Gets the information from file. (UNIX Standard only, see standards(5). The option can not be used with or options. If option is used with the idle time is added to the end of the format.) EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5). Environment Variables determines the locale to use for the locale categories when both and the corresponding environment variable (beginning with do not specify a locale. If is not set or is set to the empty string, a default of "C" (see lang(5)) is used. determines the locale for interpretation of sequences of bytes of text data as characters (e.g., single- verses multibyte characters in arguments and input files). determines the format and contents of date and time strings. determines the language in which messages are displayed. If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. EXAMPLES
Check who is logged in on the system: Check whether or not you can write to the terminal that another user is using: and look for a plus after the user ID. AUTHOR
was developed by AT&T and HP. FILES
SEE ALSO
date(1), login(1), mesg(1), su(1), init(1M), utmpd(1M), gethostname(2), wait(2), gethostent(3N), getutsent(3C), getbwent(3C), inittab(4), utmp(4), standards(5). STANDARDS CONFORMANCE
who(1)
All times are GMT -4. The time now is 03:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy