View Default Shell

The default shell for each user is stored in the last /etc/passwd file. As an example :

[lica @ clarisa ~] $ grep lica /etc/passwd
lica: x: 500: 500: lica: /home/lica: /bin/bash

In the above example the default shell for lica user is /bin/bash. If you have root access you can of course directly edit this file and change the final column for the user who will change the default shell. The non-root user can only see the contents of the file /etc/password but can not write in the file.

In addition to viewing the contents of the file /etc/passwd you can see the default shell by looking at the contents of the $ SHELL variable.

[lica @ clarisa ~] $ echo $ SHELL
/bin/bash

Know Who’s Who Are Logging And What The User Is Doing

If you are a system administrator or sysadmin of a Linux computer, where multiple users can log in simultaneously, you may be wondering how we can find out who I am currently logged in and what your users are doing using w command.

[lica @ canada ~] # w
11:18:03 up 3 days, 23:31, 1 user, load average: 1.22, 1.20, 1.05
USER TTY FROM LOGIN @ IDLE JCPU PCPU WHAT
lica pts / 1 gw.kurungsiku 11:05 0.00s 0.01s 0.00s w
From the above info we can see there is 1 user with:

  • username lica
  • login from pseudo terminal pts / 1
  • from my gw.kurungs
  • logged in at 11:05
  • idle for 0.05s
  • JCPU 0.01s, is the amount of time used by all processes related to the tty used by the user, but excludes previous background jobs and only includes the currently running background jobs
  • The PCPU0.00s time used by the current process is written in the WHAT column
  • The last/last command is executed w

Knowing How Long a Computer Has Been On With Uptime

If you want to know how long a computer with a Linux operating system has turned on, you can read the file / proc / uptime, or for easy you can use uptime commands. as an example

$ uptime

11:05:23 up 3 days, 23:18, 1 user, load average: 1.01, 1.11, 1.01
The output of the above uptime command gives us the following info

Current time (11:05:23)
How long the system has been on (3 days, 23:18)
Number of current user login (1 user)
Average system load (Load Averages) for last 1, 5 and 15 minutes
Maybe useful!