Help with top command

Currently when i run top command i get the following columns .

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND

In this how to remove '%WCPU' column ?

Thanks very much in advance .

Are you running in command line mode or interactive mode?

Sorry forgot to mention about that . I am running in command line mode .

I do no believe that there is a way to specify what columns you want in batch mode. You will have to parse the output using awk or a similar tool to remove the unwanted column.

1 Like

why not use cut -f command to retrieve only the columns you are interested in? you can use

cat $1 | while read LINE
do
   echo $LINE | awk -F, '{for(i=1;i<=NF;i++){ print $i }}' | while read WORD
   do
      awk '{$1 $2 $3 $4}'
   done
done

assuming you have dumped the output to a file first and then parse it offline.

1 Like

Program top comes with a manual; you can read the manual of program top by issuing

man top

after the prompt. In the manual you can find

2b. SELECTING and ORDERING Columns

in which you are instructed to press 'f' (Fields select) or 'o' (Order fields) and then you will be shown a screen containing the current fields string followed by names and descriptions for all fields.

The last paragraph I have just posted comes literally from the manual.

1 Like

thanks very much guys