linux - 查看 PS 命令的完整输出

标签 linux bash shell process

当我在我使用 putty 连接到的 linux 服务器上运行 ps -aux 命令时,很少有进程太长而无法适应我当前的窗口宽度。有其他选择吗?

-- 更新--

很抱歉降级,我认为其他人也不会发现答案有用,所以我降级了。

这是您要的信息。

hadoop-user@hadoop-desk:~$ echo $TERM
xterm

hadoop-user@hadoop-desk:~$ stty -a
speed 38400 baud; rows 47; columns 158; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

hadoop-user@hadoop-desk:~$ echo $COLUMNS
158

最佳答案

使用 auxww 标志,您将在终端窗口和 shell 脚本中看到输出的完整路径。

darragh@darraghserver ~ $uname -a
SunOS darraghserver 5.10 Generic_142901-13 i86pc i386 i86pc

darragh@darraghserver ~ $which ps
/usr/bin/ps<br>

darragh@darraghserver ~ $/usr/ucb/ps auxww | grep ps
darragh 13680  0.0  0.0 3872 3152 pts/1    O 14:39:32  0:00 /usr/ucb/ps -auxww
darragh 13681  0.0  0.0 1420  852 pts/1    S 14:39:32  0:00 grep ps

ps aux 列出所有用户执行的所有进程。有关详细信息,请参阅 man psww 标志设置无限宽度。

-w         Wide output. Use this option twice for unlimited width.
w          Wide output. Use this option twice for unlimited width.

我在以下博客上找到了答案:
http://www.snowfrog.net/2010/06/10/solaris-ps-output-truncated-at-80-columns/

关于linux - 查看 PS 命令的完整输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2159860/

相关文章:

linux - 使用 NPTL,同时将 glibc 与 linuxthreads 保持一致

bash - 如何在 Linux 上使用 flock

linux - 将脚本结果输出到文本文件然后将结果通过电子邮件发送到个人电子邮件的命令

linux - 将 init 转换为 systemd

c - 尝试用两个或多个管道实现 shell 但程序挂起 - C

linux - 如果文件存在,如何设置 polkit 规则以锁定关闭?

linux - Git 不影响提交后的更改

bash - 如何知道 PBS 批处理作业何时完成

linux - CVS linux 服务器项目太多,服务器命令结果为 "argument list too long"

从文件中获取第 n 行的 Bash 工具