Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
06-10-2004, 02:38 PM
|
#1
|
Member
Registered: Nov 2003
Location: San Francisco, CA
Distribution: FreeBSD, OpenBSD, Gentoo, OS X
Posts: 80
Rep:
|
formating console output (omitting parts you do not want)
So there is uptime, which gives me a format like this:
Code:
12:28:51 up 22:29, 4 users, load average: 0.05, 0.04, 0.01
But all I'd like is the time the machine is up, like so:
What tool could i pipe to to omit the rest of the line to acheive this?
Now...
How do I format it in such a day that it can pick up only the uptime.... when it can range from what you see above to
i did a `set list` in VI, no tabs in between feilds, just spaces....
I need a solution that will work both on various GNU/Linux distros AND BSD's
|
|
|
06-10-2004, 02:44 PM
|
#2
|
Member
Registered: Jul 2003
Location: Virginia
Distribution: Ubuntu Hoary (5.04)
Posts: 550
Rep:
|
Code:
uptime | cut -d ',' -f 1 | sed -e "s/.*up/up/"
|
|
|
06-10-2004, 03:22 PM
|
#3
|
Member
Registered: Nov 2003
Location: San Francisco, CA
Distribution: FreeBSD, OpenBSD, Gentoo, OS X
Posts: 80
Original Poster
Rep:
|
wanna make out?
thanks!
|
|
|
06-10-2004, 03:25 PM
|
#4
|
Member
Registered: Jul 2003
Location: Virginia
Distribution: Ubuntu Hoary (5.04)
Posts: 550
Rep:
|
Glad it worked out for you. cut and sed can be very userful.
|
|
|
06-10-2004, 04:05 PM
|
#5
|
Member
Registered: Nov 2003
Location: San Francisco, CA
Distribution: FreeBSD, OpenBSD, Gentoo, OS X
Posts: 80
Original Poster
Rep:
|
I knew there was something like cut, and sed and awk are *vey* useful. I'll admit tho that I need to learn more about these. I have some uncomitted time this weekend that I'll put towards learning more about these tools.
Something like doing a df -h and adding up the net total of disk space would be nice. These tools should help accomplish that.
thanks for the help.
|
|
|
06-10-2004, 04:43 PM
|
#6
|
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642
Rep:
|
This may be slightly OT but if you are interesting in being able to tell at a glance what your uptime is, along with a lot of other useful stats, check out gkrellm. http://web.wt.net/~billw/gkrellm/gkrellm.html It's totally cool and gives you a central, graphical way to keep tabs on your system. -- J.W.
|
|
|
06-10-2004, 07:32 PM
|
#7
|
Member
Registered: Nov 2003
Location: San Francisco, CA
Distribution: FreeBSD, OpenBSD, Gentoo, OS X
Posts: 80
Original Poster
Rep:
|
I don't run X on servers  but thanks for the suggestion.
torsmo is also a *very* nice app. I find it's interface much more appealing.
|
|
|
All times are GMT -5. The time now is 01:38 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|