I just started to learn linux and i am stuck with this practice question of Linux Fundamentals
The username cry0l1t3
, his UID, and the set shell separated by a comma (,
)
what is mean by set shell?
I just started to learn linux and i am stuck with this practice question of Linux Fundamentals
The username cry0l1t3
, his UID, and the set shell separated by a comma (,
)
what is mean by set shell?
Every User in Linux Enviroment has a Shell enviroment. You can have many shell installed on you system, Korn Shell, Bash, Zsh ecc.
You can type “ps” command on terminal for see you actual shell in use and in /etc/passwd, you can see the username, uid, gid, home and shell associate at every users defined in your system.
You can change your shell type a command like:
bash
sh
ksh
zsh
ecc
This change your shell. After it you type exit, yuo return to the original enviroment, when you are logged on the system.
To add to what thor said, you can change your default shell by using the chsh
command. Similar to how you change your password with passwd
.
To display the username cry0l1t3
and his UID, separated by a comma, you can use a combination of grep
and awk
. Here’s the command:
grep "neo4j" /etc/passwd | awk -F":" '{print $1 ", " $3}'
Here’s a breakdown of the command:
grep "^cry0l1t3:" /etc/passwd
:grep "^cry0l1t3:" /etc/passwd
: Searches for the line that starts with cry0l1t3:
in the /etc/passwd
file.awk -F':' '{print $1 "," $3}'
:awk -F':'
: Sets the field separator to :
(colon).'{print $1 "," $3}'
: Prints the first field (username) and the third field (UID), separated by a comma.Thanks <3