0

In a bash shell using ps, is it possible to return just process names + PIDs without their paths? For example, using ps -A I get something like this:

Octo:~ decavolt$ ps -A
PID TTY           TIME CMD
 1 ??        12:29.17 /sbin/launchd
10 ??         0:01.37 /usr/libexec/kextd
11 ??         7:03.37 /usr/sbin/DirectoryService
12 ??        18:16.71 /usr/sbin/notifyd
...

What I'd like to see is more like:

PID TTY           TIME CMD
 1 ??        12:29.17 launchd
10 ??         0:01.37 kextd
11 ??         7:03.37 DirectoryService
12 ??        18:16.71 notifyd
...

EDIT: Sorry, I should have clarified that this is on OSX 10.5 and 10.6

2
  • On my system, using version 3.2.7, the output from -A is identical to the output you're looking for. Commented Jan 7, 2011 at 19:11
  • Sorry Anders, I should have mentioned that this is on OSX 10.5 and 10.6 Commented Jan 7, 2011 at 19:22

3 Answers 3

4

http://ss64.com/osx/ps.html

According to this page, the -c option should be what you're looking for. Try that.

Sign up to request clarification or add additional context in comments.

Comments

0

On my system, ps -A does what you want, however, try ps -A c to see if it works for you (if you're using GNU ps).

1 Comment

Yupp, produces the same result on an old Solaris 9 system with default installation also.
0

Try ps -o pid,tty,time,comm.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.