Zenity Linux Command

What is Zenity?


Some of the features of Zenity

Installation of Zenity

>> zenity --version
>> whereis zenity 
>> sudo apt-get install zenity 
 >> sudo yum install zenity 

Zenity Basic Dialog Boxes

Different types of Zenity
#First Name
>> first_name=`zenity --title="First name" --entry --text="Enter first name"`
#Second Name
>> second_name=`zenity --title="second name" --entry --text="Enter Second name"`
>> zenity --question --text="Are You Indian citizen" && zenity --password > password.txt || zenity --warning --text="Sorry your not eligible to proceed"
>> zenity --list --title="LOGABLE USERS" --column="FIRST NAME" --column="LAST NAME" --column="PASSWORD" --column="DOB" $first_name $second_name $password $dob --text="User Details" --width="800" --height="400"

Creating Script to Manage Linux Users

Script-1 for creating a new user

>> vim newUser
userad=$(zenity --username --password --title="Login")
>> user=$(echo $userad | cut -d"|" -f1)
>> password=$(echo $userad | cut -d"|" -f2)
zenity — info — title=”User $user created” — text=”SUCCESS”
>> chmod 755 newUser
>> ./newUser
Successfully user Created

Removing a User Script-2

vim delUser
chmmod 755 delUser

Execute Script-2 to remove a user




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store