Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Please, I need help. I need a code to display
" Benn Franklin is logged on to terminal pts/13 and has been for 1 hour(s) and 17 minute(s)". I know how to get user's name and terminal but I don't know how to get how long the user has been on (will not exceed 24 hours)
NOTE: the system displays time using a 24-hour military style clock format.
Is this for a homework assignment for school? I hope it's not. You might try adapting the instructions that Google found when I searched, expecting to find something simpler.
Please, I need help. I need a code to display
" Benn Franklin is logged on to terminal pts/13 and has been for 1 hour(s) and 17 minute(s)". I know how to get user's name and terminal but I don't know how to get how long the user has been on (will not exceed 24 hours)
NOTE: the system displays time using a 24-hour military style clock format.
Hi infoobayo and welcome to LQ.
As some of my fellow members have asked or implied, "What have you tried?"
You're asking for code, a handout. We are all volunteers, including yourself.
What code do you know? Are you thinking to use a script or a compiled program? Do you have any idea how to start a script at all? If you wrote a script, are you familiar with what you need to accomplish in order to be able to run the script?
Homework questions are fine on LQ, if you do identify that you are working on one and also do not post the question verbatim. Further, if it is homework, you really should be attempting this on your own and sharing your thoughts about it, as well as how close or far you are to any possible answer. This is very fundamental stuff, and if you are so very far from any possible solution, you need help and should seek it from your instructor. If this is for work or self exploration, we fully understand this, and our intentions are that you learn these fundamental things correctly so that you do not end up asking for a code handout as your next question, but instead have a problem where you are able to demonstrate your initial efforts and can possibly also help other future members with problems similar to ones which you do know the answer.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.