- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ps -efx showing truncated result for command colum...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 06:30 AM
06-24-2019 06:30 AM
ps -efx showing truncated result for command column
Hey Guys,
I'm having a bit of an issue when ps, I'm getting truncated results for the command column.
It was mentioned on other posts here to try use the -x flag which resulted in more of the command being showed but still has a chunk cut off.
Anyone know why this is happening or if there is a work around I can possibly do to check the full command for a process in it's entirety.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 07:30 PM
06-24-2019 07:30 PM
Re: ps -efx showing truncated result for command column
The ps command was not (originally) designed for massive command line strings. Before HP-UX 11.00 (ie, 10.20, etc), you were stuck with about 46 characters and no -x for extended command line. At 11.00, the -x feature was a patch to ps but limited to 1000 characters. Extremely long command lines can run into a number of OS and/or shell string limitations.
The man page is helpful:
The default length of the COMMAND field is 128 (including the null
terminator). This can be configured by setting
DEFAULT_CMD_LINE_WIDTH=value in the /etc/default/ps file. The value
of DEFAULT_CMD_LINE_WIDTH should be between 64 and 1020. However,
when the comm column is displayed, by default, the length of the
COMMAND field will be 14 characters. If the environment variable
PS_CMD_BASENAME is defined, then the length of the COMMAND field will
be between 64 and 255 characters.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2019 03:44 AM
06-25-2019 03:44 AM
Re: ps -efx showing truncated result for command column
So the ps command will always have a limit of 1020 characters, would you happen to know of any other means to see the full command via other commands, I was looking at pstat but that also seems to have the same limit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2019 02:00 AM
07-23-2019 02:00 AM
Re: ps -efx showing truncated result for command column
If you have the privileges to attach a debugger to the process, you could hack into libc's __argv:
#! /bin/sh
echo $(\
{
cat <<EOF
set print elements 0
set print address off
set pagination off
set \$argc=1
set \$argv=(char **)__argv
while \$argv[\$argc] != 0
print \$argv[\$argc]
set \$argc=\$argc+1
end
quit
EOF
} \
| gdb -q -p $1 \
| grep = \
| sed -e 's/^[^=]*=//g' -e 's/"//g'\
)
You could do it with a C program using ttrace(2) calls (to attach to the process and to read process data) and cross-process libdl calls (to resolve "__argv") etc.
--
ranga