Count the total number of logged in user
Answer:
To count the total number of logged in user(s), use the following commands:
# who | wc -l
3
It shows currently there are 3 users logged in.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Count the total number of logged in user
Answer:
To count the total number of logged in user(s), use the following commands:
# who | wc -l
3
It shows currently there are 3 users logged in.
Check remote hostname using nslookup
Answer:
You can find the hostname of remote machine using the nslookup command.
# nslookup 198.182.196.48 | grep name
48.196.182.198.in-addr.arpa name = linux.org.
List all installed package in Ubuntu
Answer:
To list all the installed packages in Ubuntu, so you try the "dpkg -l" command:
E.g.
# dpkg -l
Print current environment variables using printenv
Answer:
Besides using env command, you can also use the printenv command, which has the same effect.
# printenv
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=ff8f5b056d8812b8...
Use an alternative port when connecting to remote server using SSH
Answer:
Sometimes the SSH server port is not the standard 22 for security reason. So when you connect it, you need to specify the alternative port used with the -p argument.
E.g.
# ssh -p 12345 [email protected]