Sunday, May 23, 2010

Ubuntu: How to see the logged users, username with date/time

This is shell script for logged users, our username with logged date/time.

Open a text file in terminal

sudo gedit

copy and paste the following lines

# Write a shell script called hello which output the following:
# + Your username
# + The time and date
# + Who is logged on
# + also output a line of asterices (*******) after each section

# function to display a line of asterices
function line(){
echo "*************************************************"

echo "Your username : $(echo $USER)"
line # call function

echo "Current date and time : $(date)"

echo "Currently logged on users:"

Then save and exit

In terminal type the following command

sudo chmod +x


The out put is


yun said...

./loggedsh ==>./

arulmozhi r said...

Thanks to your comments