21

What parameter can help me to display the full command using top -c?

For example, I have one of the oupput from top -c

  5073 mysql     20   0  298m  12m 4668 S    0  0.0  29:27.46 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysql/mysqld.log --pid-file=/var/run/mysql/mysqld.pid -

There are more parameters after --pid-file==/var/run/mysql/mysqld.pid, but they are chopped off as the screen size. How can I make them visible?

3
  • 2
    Why do you ask? Why don't you use e.g. ps auxww, perhaps thru watch ? May 8, 2012 at 7:42
  • You could use htop which supports scrolling.
    – ortang
    May 8, 2012 at 8:21
  • @BasileStarynkevitch, goog question, I am not used to using "ps", but it is nice to know, thanks.
    – user200340
    May 8, 2012 at 8:49

4 Answers 4

11

top per se doesn't support wrapping, if i am correct. One way is you can increase your terminal width as follows.

export COLUMNS=_NO_YOU_DESIRE_
top

** then set update interval with 's _REFRESH_INTERVAL_'
** turn on command line display with 'c'
1
  • With zsh at least, this has undesirable side effects like shifting the right hand side prompt, and the initial position of the cursor. Jun 18, 2014 at 18:12
6

htop shows the full command. You can scroll to the right to see it all.

htop screenshot

http://hisham.hm/htop/

You can also rearrange, add and remove the columns to just show the information you are interested in. Press h inside top for details (or man htop in the terminal).

1

What helped was using the -O option to move the command to the leftmost column and then -f to remove most of the other items. I was interested to see only the full command which was being run.

3
  • There doesn't seem to be an -O or -f argument to top.
    – Daniel Beck
    Aug 21, 2013 at 19:24
  • Press o inside top to move columns left and right. Press f inside top to toggle columns. Dec 15, 2013 at 23:28
  • After all the customisation, you may wish to press W for top to remember those settings for next time it starts. Dec 15, 2013 at 23:33
0

You could use something like ps -eF > ps_out to get a snapshot of your current processes, with all the command line arguments. Or use htop which supports scrolling.

hth

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.