linux how to know what shell i am using
If Linux means anything, it means selection. Y'all can achieve even a simple task like identifying the current user in many means. This tutorial will show you how to use some of the quickest and easiest methods.
Why would you need to find the identity of the electric current user? In many cases the owner of the computer is the simply user and, without getting besides existential, they probably know themselves. Perhaps, but it is besides common for people to create boosted user accounts to allow family members to have access to the estimator. And, if you're continued to a remote vanquish on a server somewhere, you may need a quick reminder of the username you're logged in with. If you see a logged in session with no i in attendance, how practise you lot identify the current user from the command line?
Let's try the easiest pick first. All we need to do is look at the command prompt. By default, Linux distributions have the username in the prompt. Simple. We didn't even have to type a thing.
If the user has inverse their prompt to another format we demand to try something else. The who
command will give us the information we are looking for.
who
The output from who
gives you lot the name of the current user, the final they are logged in at, the engagement and time when they logged in. If information technology is a remote session, information technology also tell usa where they are logged in from.
By comparison, the whoami
command provides a very pithy reply:
whoami
You can go the same one-word reply by echoing the $USER
environment variable to the screen.
echo $USER
The one-letter of the alphabet command westward
requires less typing and provides more information.
westward
The west
control provides united states with the user name which is what we wanted, and a bonus set of data for that user. Note that if there are multiple users logged into the Linux arrangement, the w
command will listing them all. You'd need to know which terminal the user you were interested in had logged in on. If they've logged directly onto the Linux figurer itself, that'll be pts/o, and then look for :0 in the output from west
.
The due west
command provides the boot time, uptime and boilerplate load for the previous five, x and fifteen minutes, and the following information regarding the current user.
- USER: The user proper noun.
- TTY: The type of concluding they are logged in at. This volition usually be a pts (a pseudo-teletype). :0 means the physical keyboard and screen connected to this computer.
- FROM: The name of the remote host if this is a remote connexion.
- LOGIN@: The fourth dimension at which the user logged in.
- IDLE: Idle time. This shows ?xdm? in the screenshot because we're running under an X-windows Display Director, which does non provide that information.
- JCPU: Joint CPU time, this is the CPU time used by all processes that have been attached to this tty. In other words, the total CPU time of this user in this logged in session.
- PCPU: Procedure CPU time, this is the CPU time used past the electric current procedure. The current process is named in the WHAT column.
- WHAT: The command line of this user's current process.
Now that we know who this user is, we can obtain more information about them. The id
command is a proficient place to kickoff. Type id
, a space, the name of the user and press enter.
id dave
This gives us their user ID (uid), group ID (gid) and the groups they're a member of. A less cluttered brandish of the groups can exist obtained by using the groups
command.
groups dave
A overnice summary is provided by the finger
control. Use apt-get
to install this package onto your system if yous're using Ubuntu or another Debian-based distribution. On other Linux distributions, use your Linux distribution's bundle management tool instead.
sudo apt-get install finger
Once you have finger
installed, you lot can use it to display some information virtually the user in question.
finger dave
On most Linux systems, some of these fields will be blank. The office, full name, and phone numbers are not populated past default. The "No Plan" field refers to an old scheme where you could provide a few notes for whoever was interested, well-nigh what you were working on, or planning to do. If you edit the .plan file in your home folder, the contents of that file are appended to the output from finger
.
To apace reveal the proper name of the logged in user from the GNOME desktop used on Ubuntu and many other Linux distributions, click the system menu in the peak-correct corner of your screen. The bottom entry in the drop-downwardly menu is the user proper name. Other Linux desktop environments should testify your username in a similarly easy-to-find carte.
That was easy, just one click. But where's the fun in that?
You lot don't go to feel like a digital detective in the aforementioned manner as you do when y'all employ the Bash shell.
Source: https://www.howtogeek.com/410423/how-to-determine-the-current-user-account-in-linux/
0 Response to "linux how to know what shell i am using"
Post a Comment