* nix命令是什么用于查看用户的默认登录外壳 [英] What is the *nix command to view a user's default login shell

查看:89
本文介绍了* nix命令是什么用于查看用户的默认登录外壳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看用户默认登录shell的* nix命令是什么?

What is the *nix command to view a user's default login shell?

我可以使用chsh更改默认的登录shell,但是我不知道如何获取用户的默认shell.

I can change the default login shell with chsh, but I don't know how to get what is the user's default shell.

伪代码

$ get-shell
/usr/bin/zsh

推荐答案

使用getent可以查询/etc/passwd 文件以获取此信息的规范方法.您可以使用诸如cut之类的标准工具来解析getent输出,以提取用户的登录shell.例如:

The canonical way to query the /etc/passwd file for this information is with getent. You can parse getent output with standard tools such as cut to extract the user's login shell. For example:

$ getent passwd $LOGNAME | cut -d: -f7
/bin/bash

这篇关于* nix命令是什么用于查看用户的默认登录外壳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆