username

echo %USERNAME%

we use in windows

what is it's equivalent in linux..


Please help.
jcob_lAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Frosty555Commented:
0
edster9999Commented:
well to be exact 'whoami' is a command.
If you want exactly the same thing you have above (a system veriable which holds the current  username) then it would be

echo $USER

(note the capital letters)
0
jcob_lAuthor Commented:
[root@server2 dbs]# echo $USER
root
[root@server2 dbs]#
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

edster9999Commented:
yes.  See the word 'root' at the start of lines 1 and 2.... thats your username.
See the '#' at the end of those lines.... that also means you are 'root'
root is your username.

Is that not what you want ?
0
edster9999Commented:
if you started as a different user and then did 'su' or 'sudo' to become root
and you want to know what is the username beneath root
then you could use the command
logname
or to get it as a variable you can echo, you could do something like :

echo "Your name is `logname` "
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Darr247Commented:
Not related (i.e. please no assist for this), but if you're new to Linux something you should be aware of... the more stuff you do at root level, the more ownerships and permissions will get tied to it until eventually your setup won't run withOUT using 'su -' for root (most distros by default no longer allow "logging in" as root for just that reason).

So it's much better to do 'su' + root password, or put the user in the /etc/sudoers file and use 'sudo' + user password (as edster9999 mentioned in http:#a39526099).
0
SandyCommented:
Check $PS1

answer is there itself.
0
jcob_lAuthor Commented:
yes that is correct with sudo.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.