LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-22-2007, 11:56 PM   #1
kinetik
Member
 
Registered: Dec 2005
Location: The most beautiful city in the world.
Distribution: Mostly RedHat. Also Suse, Ubuntu, PHLAK etc.
Posts: 149

Rep: Reputation: 15
Need some help with ps command


Hi All


I've got the following nifty ps command:

ps -eo pid,args,etime --sort start_time


The thing is it doesn't output the command very wide, for instance:

Quote:
3810 /usr/local/monit 15:07
3840 /sbin/mingetty t 15:06
3841 /sbin/mingetty t 15:06
3842 /sbin/mingetty t 15:06
3843 /sbin/mingetty t 15:06
3844 /sbin/mingetty t 15:06
3845 /sbin/mingetty t 15:06
3846 /sbin/agetty -L 15:06
5774 sh -c /usr/local 07:21
5777 cat - 07:21
6945 less .bash_histo 02:41
7275 sshd: user [pri 01:12
7318 sshd: user@pts/ 01:04
7319 -bash 01:04
7367 su 01:02
7368 bash 01:01
7669 /opt/panmgr/jre1 00:06
7670 /opt/panmgr/jre1 00:06
7674 /opt/panmgr/jre1 00:05
7696 sleep 1 00:00
7697 ps -eo pid,args, 00:00

Is there a way I can get the second column a bit wider? As in much wider?


Thanks!
 
Old 01-23-2007, 12:34 AM   #2
lauer
Member
 
Registered: Aug 2003
Location: Germany
Distribution: openSuSE
Posts: 61

Rep: Reputation: 16
How about piping it through sed and inserting TABs after the second column? I'm not a sed guru and I'm not sitting at my linux box, but you may find useful tips on the sed manpage.
 
Old 01-23-2007, 12:51 AM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You could also swap the columns to get wider output. For example:
Code:
ps -eo pid,etime,args --sort start_time
If that's not enough, force it to be wider with:
Code:
ps -ewwo pid,etime,args --sort start_time
 
Old 01-23-2007, 06:21 PM   #4
kinetik
Member
 
Registered: Dec 2005
Location: The most beautiful city in the world.
Distribution: Mostly RedHat. Also Suse, Ubuntu, PHLAK etc.
Posts: 149

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by gilead
You could also swap the columns to get wider output. For example:
Code:
ps -eo pid,etime,args --sort start_time
If that's not enough, force it to be wider with:
Code:
ps -ewwo pid,etime,args --sort start_time


Yep, that did it!

Thanks buddy
 
Old 01-25-2007, 06:23 PM   #5
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
For the record, you could also pipe it through awk using its printf command, or printf itself. I lean toward awk because I learned it 1st, but the original printf may be easier for someone not familiar w/ either. In any case, expect to do some time RTFM'ing or in the case of awk, inside the <expletive deleted> info system.

A hint: entering "##gawk" in the Konqueror address bar will give its info pages translated to HTML, & w/ many clickable links -- makes info almost palatable.

The entire thing is available here: http://www.gnu.org/software/gawk/manual/gawk.html
as "The GNU Awk User's Guide", in one looong web page. The advantage of 1 page is searchability, the downside is bandwidth use.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration