Link to home
Start Free TrialLog in
Avatar of jcob_l
jcob_l

asked on

username

echo %USERNAME%

we use in windows

what is it's equivalent in linux..


Please help.
Avatar of Frosty555
Frosty555
Flag of Canada image

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)
Avatar of jcob_l
jcob_l

ASKER

[root@server2 dbs]# echo $USER
root
[root@server2 dbs]#
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 ?
ASKER CERTIFIED SOLUTION
Avatar of edster9999
edster9999
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Darr247
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).
Check $PS1

answer is there itself.
Avatar of jcob_l

ASKER

yes that is correct with sudo.