Sponsored Content
Top Forums Shell Programming and Scripting Understanding ampersand (&) usage in the command Post 302422335 by Shan_u2005 on Tuesday 18th of May 2010 06:29:06 AM
Old 05-18-2010
Understanding ampersand (&) usage in the command

Please explain the usage of ampersand in the following command
Code:
who & echo "Total number of users are `who|wc -l`"

What I understand is that ampersand is used to run some process in the background. And, what I am expecting from this command is

"Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list."

Thanks.
 

10 More Discussions You Might Find Interesting

1. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

2. UNIX for Dummies Questions & Answers

Understanding 2>&1

Hi, I have this line in a script: if mt -f /dev/nst0 rewind > /tmp/status_nst0.log 2>&1 ; then What does the 2>&1 mean? I think the line is saying that after rewinding the device if the log file does not exist then execute the code but I do not understand the contribution of the 2>&1.... (2 Replies)
Discussion started by: mojoman
2 Replies

3. UNIX for Advanced & Expert Users

How to find out memory & cpu usage of a process

Hi, By using time command we can determine the execution time of a process or command. bash-2.04$ time ls -l total 0 -rw-r--r-- 1 admin tac 0 Oct 6 04:46 file1 -rw-r--r-- 1 admin tac 0 Oct 6 04:46 file2 real 0m0.002s user 0m0.000s sys 0m0.001s... (5 Replies)
Discussion started by: learn more
5 Replies

4. UNIX for Dummies Questions & Answers

usage of 2>&1 while appending

Hi, 17 11 * * * /xx/yy/name.sh >> /tmp/cron.log 2>&1 The above statement is one of the crontab entries. The crong log is getting appended everytime. Can anyone tell me the usage of "2>&1"? Thanks. (2 Replies)
Discussion started by: venkatesht
2 Replies

5. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

6. UNIX for Dummies Questions & Answers

Ampersand usage and Emacs

In the terminal, using the ampersand allows the process to run in the background--Emacs, for example. But is there a way to automatically open Emacs as a background process so I can still use the command line? Typing the ampersand is just annoying to me, and I keep forgetting; it's just too useful... (0 Replies)
Discussion started by: Zucriy Amsuna
0 Replies

7. Shell Programming and Scripting

help understanding regex with grep & sed

I have the following line of code that works wonders. I just don't completely understand it as I am just starting to learn regex. Can you help me understand exactly what is happening here? find . -type f | grep -v '^\.$' | sed 's!\.\/!!' (4 Replies)
Discussion started by: trogdortheburni
4 Replies

8. Solaris

Understanding & Monitoring CPU performance (Load vs SAR)

Hi all, Been reading a lot of the cpu load and its "analogy of it to car traffic path of expressway" From wiki Most UNIX systems count only processes in the running (on CPU) or runnable (waiting for CPU) states. However, Linux also includes processes in uninterruptible sleep states... (13 Replies)
Discussion started by: javanoob
13 Replies

9. Shell Programming and Scripting

Problems with ampersand (&) in sed command

Hello everybody, I have a Problem with sed command. I want to replace a defined string with a string from a database field (dynamic). e.g. sed -i -e 's/%NAME%/'"$HNAME"'/g' The Problem is that the $HNAME variable can contain Special characters like '&' e.g. HNAME="AH Kruger & Co. KG" ... (1 Reply)
Discussion started by: Bambuti2000
1 Replies

10. Red Hat

Nohup with ampersand & process gets disconnected

For years I have spawned shell scripts with nohup and ampersand and they run whether or not I stay logged in. Recently a client told us that we had to set a keep alive timeout on all of our Redhat 7.6 Linux servers. Our sysadmin set the following parameters in the sshd_config file on all of our... (10 Replies)
Discussion started by: gandolf989
10 Replies
rusers(1)							   User Commands							 rusers(1)

NAME
rusers - who is logged in on remote machines SYNOPSIS
rusers [-ahilu] host... DESCRIPTION
The rusers command produces output similar to who(1), but for remote machines. The listing is in the order that responses are received, but this order can be changed by specifying one of the options listed below. The default is to print out the names of the users logged in. When the -l flag is given, additional information is printed for each user: userid hostname:terminal login_date login_time idle_time login_host If hostname and login host are the same value, the login_host field is not displayed. Likewise, if hostname is not idle, the idle_time is not displayed. A remote host will only respond if it is running the rusersd daemon, which may be started up from inetd(1M) or listen(1M). In the absence of a name service, such as LDAP or NIS, rusers displays host names as numeric IP addresses. OPTIONS
-a Give a report for a machine even if no users are logged on. -h Sort alphabetically by host name. -i Sort by idle time. -l Give a longer listing in the style of who(1). -u Sort by number of users. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWrcmdc | +-----------------------------+-----------------------------+ SEE ALSO
who(1), inetd(1M), listen(1M), pmadm(1M), sacadm(1M), attributes(5) SunOS 5.10 7 Mar 2003 rusers(1)
All times are GMT -4. The time now is 01:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy