How to list shell of account?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat How to list shell of account?
# 1  
Old 01-04-2011
How to list shell of account?

Hello. I have been trying to figure out something very simple that I know I've done before; which is list the shell of a specific account. In this case it is the account: "news". I know how to change the shell using chsh, just not list it. I want output like "/bin/sh" only. Any thoughts or ideas are appreciated, thanks.
# 2  
Old 01-04-2011
You can look at the /etc/passwd file

If you
Code:
grep "news" </etc/passwd

you will see the details for account news


See also -->
https://www.unix.com/unix-dummies-que...ent-shell.html
# 3  
Old 01-04-2011
That's sort of what I want...but I need the last part of it by itself, and I don't think awk will work here because there are no spaces. There's no way to do kind of like this?

Code:
echo $SHELL

Only instead of giving me my current shell, have it give me any account I specify?
# 4  
Old 01-04-2011
One way to look up the login shell of the account "news":

Code:
awk -F: '{if ($1==name) {print $7; exit}}' name=news /etc/passwd

# 5  
Old 01-04-2011
finger

If it's installed, try using "finger":

[sandholm@sys1-lnx ~]$ finger news
Login: news Name: news
Directory: /etc/news Shell: /bin/sh
Never logged in.
No mail.
No Plan.
[sandholm@sys1-lnx ~]$
# 6  
Old 01-04-2011
Quote:
Originally Posted by methyl
One way to look up the login shell of the account "news":

Code:
awk -F: '{if ($1==name) {print $7; exit}}' name=news /etc/passwd

This works perfectly, thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

How to list Inactive user account in AIX 5.3?

Hello, I have a situation, where I ask for to get a list of all inactive users (expire or locked in last 41 days). I looked into /etc/shadow (no such file in my server). I referred some old threads but not found useful information. I'm using AIX 5.3 .... I have total 1641 users in server. ... (5 Replies)
Discussion started by: sumit30
5 Replies

2. Red Hat

List shell of specific account

Hi everyone. I am wondering how I would accomplish outputting the shell of a specific account on a single line of output. For example I would like to list the shell of 'news' as... /bin/sh providing its current shell is /bin/sh. This probably is a simple answer that I haven't been able to... (2 Replies)
Discussion started by: austinharris43
2 Replies

3. UNIX for Dummies Questions & Answers

How do i list all locked account in linux?

Hi How do i list all locked account in my linux distributiion I have tried passwd -S -a but it seems to not working . My distribution details. # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: OracleVMserver... (3 Replies)
Discussion started by: pinga123
3 Replies

4. Shell Programming and Scripting

Shell account SSH Tunnelling?

What do I need to do to be able to connect to an IRC server from work? At work I'm behind a firewall that blocks all IRC connections on standard ports. I read that I could use a shell account and set something up (which I am searching what) that I could use to connect to and tunnel my... (4 Replies)
Discussion started by: KromiX
4 Replies

5. AIX

AIX shell account

I am just wondering if there is a way I can obtain a free shell account for an AIX server that I can make test drive on it. I tried google search and ibm's web site but couldn't find anything.. regards, (2 Replies)
Discussion started by: milhan
2 Replies

6. UNIX for Dummies Questions & Answers

Create POP 3 Account via Shell

This may be so simple that I am overlooking it somewhere, but search as I may, I cannot find an answer anywhere! I am running a Linux box with sendmail and many different virtual domains. I cannot however, figure out how to setup a pop3 account for a specific domain. For example, I have a... (0 Replies)
Discussion started by: kermite
0 Replies

7. UNIX for Dummies Questions & Answers

Where can I get a Free Shell Account?

I am new to UNIX and am interested to practice on a Shell account with some basic Unix installed, does anyone know of a free or cheap shell account? (4 Replies)
Discussion started by: shneurg
4 Replies

8. UNIX for Dummies Questions & Answers

unix shell account

i purchased a unix shell account and got myself into a bit of trouble with my providers heh i got 3 automated emails telling me i had 3 background processes running, and my limit is two, which i knew. after a couple of emails between myself and a human being, he suggested i look up... (2 Replies)
Discussion started by: turf
2 Replies
Login or Register to Ask a Question