afiskon2011-05-12 13:33:43
*nix-like systems
afiskon, 2011-05-12 13:33:43

A couple of "lamer" questions for UNIX connoisseurs?

I've actually been working with unixes for quite some time, but still haven't found a solution for the following problems.

1. The ps command cuts the list of processes to fit the width of the terminal. In this regard, the command ps uax | grep ssh may not output anything even if there are processes with the corresponding name, because their names will be truncated. What to do?

2. Sometimes it happens that you go to the server via ssh, work, and at some point you realize that you need to change the size of the terminal. So, sometimes after that, long commands are cut off at the _old_ terminal boundary and begin to be entered over the bash prompt. Should there be a command or keyboard shortcut for this case?

Answer the question

In order to leave comments, you need to log in

13 answer(s)
Maxim, 2011-05-12

in the comments tin%)
1. ps auxwww
2. reset

Sergey, 2011-05-12

-w,w wide output

Eugene, 2011-05-12

1) read the entire command line of the desired process:
xargs -0 echo < /proc/$pid/cmdline
ps ax --width=$COLUMNS
2) did not encounter this, but the reset command should definitely help

Ilgiz, 2011-05-12

ps axww. in fr a little differently.

Stamm, 2011-05-12

1) You can try to display less information: ps ax | grep ssh

mark_ablov, 2011-05-12

1) either really use ax, or even describe the columns that you need yourself.

bobahPhD, 2011-05-12

1)ps -p $(pidof ssh)
2) you can try clear or reset

Ilgiz, 2011-05-12

in the physical console resolution is changed by vidcontrol'om.

Kane, 2011-05-12

You can also choose not to display only the required columns:

$ ps -o comm,pid -C sshd
COMMAND           PID
sshd             1504

Kane, 2011-05-12

You can use the reset command to reset the terminal.

AnViar, 2011-05-12

2) win+up, win+down in win7+putty will resize the window if this is the case. It seems to me that sticking occurs if the resize occurred at the time the command was executed in the console and the terminal lost the event.

Vlad Zhivotnev, 2011-05-12

Regarding the second point - CTRL + L in the bash, clear, if it doesn’t help, then the reset command will definitely help (this is the complete reinitialization of the terminal).

Balthasar, 2011-05-13

1) "ps uax | grep ssh" in this case, the output of ps does not go to the terminal and the width should not be taken into account.
At least it's like this for me: My terminal is a little narrower than 4161 familiarity.
$ ps aux | wc -L

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question