Unix
如何從 ps -u $user 中清楚地看到程序數據?
這個問題是基於這個執行緒。
**問題:**在過程數據中查找安裝
我想知道您如何從以下數據中看到我正在進行 MacPorts 埠的更新。
我跑
ps -u Sam
我明白了
UID PID TTY TIME CMD 501 79 ?? 0:15.95 /sbin/launchd 501 186 ?? 0:01.50 /Library/Google/Google Desktop/GoogleDesktopAgent.app/Contents/MacOS/GoogleDesktopAgent 501 188 ?? 0:01.14 /System/Library/CoreServices/AirPort Base Station Agent.app/Contents/MacOS/AirPort Base Station Agent -launchd -allowquit 501 193 ?? 0:01.55 /System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotlight 501 194 ?? 0:00.34 /usr/sbin/UserEventAgent -l Aqua 501 195 ?? 0:13.79 /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Support/ATSServer 501 196 ?? 0:09.80 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock -psn_0_28679 501 197 ?? 0:10.99 /System/Library/CoreServices/SystemUIServer.app/Contents/MacOS/SystemUIServer -psn_0_40970 501 198 ?? 0:00.00 /usr/sbin/pboard 501 199 ?? 1:48.90 /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -psn_0_45067 501 210 ?? 0:17.12 /Library/CFMSupport/CNQL1213_ButtonManager.app/Contents/MacOS/CNQL1213_ButtonManager -psn_0_65552 501 214 ?? 0:01.50 /Users/Sam/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/Contents/MacOS/GrowlHelperApp -psn_0 501 218 ?? 0:00.07 /Applications/iTunes.app/Contents/Resources/iTunesHelper.app/Contents/MacOS/iTunesHelper -psn_0_81940 501 219 ?? 2:12.63 /Applications/Personal/Dropbox.app/Contents/MacOS/Dropbox -psn_0_86037 501 220 ?? 0:03.80 /System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension -psn_0_94231 501 287 ?? 0:00.00 /sw/bin/dbus-daemon --nofork --session 501 402 ?? 0:01.19 /System/Library/CoreServices/Dock.app/Contents/Resources/DashboardClient.app/Contents/MacOS/DashboardClient 501 403 ?? 0:00.54 /System/Library/CoreServices/Dock.app/Contents/Resources/DashboardClient.app/Contents/MacOS/DashboardClient 501 6768 ?? 43:54.31 /Applications/Browsers/Firefox.app/Contents/MacOS/firefox-bin -psn_0_270402 501 7178 ?? 0:55.52 /Applications/Browsers/Safari.app/Contents/MacOS/Safari -psn_0_315469 501 7297 ?? 0:00.24 /usr/bin/ssh-agent -l 501 7482 ?? 0:12.13 /Applications/iTerm.app/Contents/MacOS/iTerm -psn_0_344148 501 7620 ?? 0:10.82 /Applications/Browsers/Opera.app/Contents/MacOS/Opera -psn_0_360536 501 8029 ?? 0:03.11 SCREEN -xR 501 34477 ?? 0:06.56 /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -psn_0_532610 501 43345 ?? 0:01.08 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker MDSImporterWorke 501 62291 ?? 0:10.15 /Applications/Utilities/Activity Monitor.app/Contents/MacOS/Activity Monitor -psn_0_540804 0 34478 ttys000 0:00.02 login -pfq Sam /bin/zsh 501 34479 ttys000 0:00.05 -zsh 501 34497 ttys000 0:00.01 screen -xR 0 8030 ttys001 0:00.01 login -pflq Sam /bin/zsh 501 8031 ttys001 0:01.45 zsh 0 30465 ttys001 0:00.00 ps -u Sam 0 83953 ttys002 0:00.01 login -pflq Sam /bin/zsh 501 83957 ttys002 0:00.07 zsh 0 24515 ttys003 0:00.01 login -pflq Sam /bin/zsh 501 24567 ttys003 0:00.94 zsh 501 34808 ttys003 0:00.06 vim /Users/Sam/.zshrc
你怎麼能看到我正在進行安裝?
您是否使用 sudo 執行更新,如下所示:
sudo port ...
如果是這樣,則更新不是以您的帳戶執行,而是以 root 身份執行。您可以嘗試這樣的命令來查看“埠”是否正在執行:
ps aux | grep port
試試看,讓我知道你看到了什麼。
這個答案有助於更好地理解數據。
我跑
pstree
我明白了
-+= 00001 root /sbin/launchd |--= 00010 root /usr/libexec/kextd |--= 00011 root /usr/sbin/notifyd |--= 00012 root /usr/sbin/syslogd |--= 00014 root /usr/sbin/ntpd -c /private/etc/ntp-restrict.conf -n -g -p /var/run/ntpd.pid -f /var/db/ntp.drift |--= 00015 _usbmuxd /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/usbmuxd -launchd |--= 00016 root /usr/sbin/update |--= 00017 root /sbin/SystemStarter |--= 00020 root /usr/sbin/securityd -i |--= 00022 root /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Support/mds |--= 00023 _mdnsresponder /usr/sbin/mDNSResponder -launchd |--= 00024 Sam /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow console |--= 00025 root /usr/sbin/KernelEventAgent |--= 00027 root /usr/libexec/hidd |--= 00028 root /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Support/fseventsd |--= 00030 root /sbin/dynamic_pager -F /private/var/vm/swapfile |--= 00033 root /usr/sbin/diskarbitrationd |--= 00034 root /usr/sbin/DirectoryService |--= 00036 root /usr/sbin/configd |--= 00039 root autofsd |--= 00041 root /usr/libexec/ApplicationFirewall/socketfilterfw |-+= 00045 root /Library/Google/Google Desktop/GoogleDesktopDaemon.bundle/Contents/MacOS/GoogleDesktopDaemon | \--= 96304 nobody (GDImportWorker) |--= 00046 daemon /usr/sbin/distnoted |--= 00047 root /System/Library/CoreServices/coreservicesd |--= 00049 root /usr/sbin/blued |--= 00061 _windowserver /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/WindowServer -daemon |-+= 00079 Sam /sbin/launchd | |--= 00186 Sam /Library/Google/Google Desktop/GoogleDesktopAgent.app/Contents/MacOS/GoogleDesktopAgent | |--= 00188 Sam /System/Library/CoreServices/AirPort Base Station Agent.app/Contents/MacOS/AirPort Base Station Agent -launchd -allowquit | |--= 00193 Sam /System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotlight | |--= 00194 Sam /usr/sbin/UserEventAgent -l Aqua | |--= 00195 Sam /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Support/ATSServer | |-+= 00196 Sam /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock -psn_0_28679 | | |--- 00402 Sam /System/Library/CoreServices/Dock.app/Contents/Resources/DashboardClient.app/Contents/MacOS/DashboardClient | | \--- 00403 Sam /System/Library/CoreServices/Dock.app/Contents/Resources/DashboardClient.app/Contents/MacOS/DashboardClient | |--= 00197 Sam /System/Library/CoreServices/SystemUIServer.app/Contents/MacOS/SystemUIServer -psn_0_40970 | |--= 00198 Sam /usr/sbin/pboard | |--= 00199 Sam /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -psn_0_45067 | |--= 00210 Sam /Library/CFMSupport/CNQL1213_ButtonManager.app/Contents/MacOS/CNQL1213_ButtonManager -psn_0_65552 | |--= 00214 Sam /Users/Sam/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/Contents/MacOS/GrowlHelperApp -psn_0_69649 | |--= 00218 Sam /Applications/iTunes.app/Contents/Resources/iTunesHelper.app/Contents/MacOS/iTunesHelper -psn_0_81940 | |--= 00219 Sam /Applications/Personal/Dropbox.app/Contents/MacOS/Dropbox -psn_0_86037 | |--= 00220 Sam /System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension -psn_0_94231 | |--= 00287 Sam /sw/bin/dbus-daemon --nofork --session | |--= 06768 Sam /Applications/Browsers/Firefox.app/Contents/MacOS/firefox-bin -psn_0_270402 | |--= 07178 Sam /Applications/Browsers/Safari.app/Contents/MacOS/Safari -psn_0_315469 | |--= 07297 Sam /usr/bin/ssh-agent -l | |--= 07482 Sam /Applications/iTerm.app/Contents/MacOS/iTerm -psn_0_344148 | |--= 07620 Sam /Applications/Browsers/Opera.app/Contents/MacOS/Opera -psn_0_360536 | |-+= 62291 Sam /Applications/Utilities/Activity Monitor.app/Contents/MacOS/Activity Monitor -psn_0_540804 | | \--= 62301 root /Applications/Utilities/Activity Monitor.app/Contents/Resources/pmTool | |-+= 95918 Sam /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -psn_0_610453 | | \-+= 95919 root login -pfq Sam /bin/zsh | | \-+= 95920 Sam -zsh | | |-+= 96345 Sam pstree | | | \--- 96347 root ps -axwwo user | | \--- 96346 Sam pbcopy | \--= 96321 Sam /System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app/Contents/MacOS/PubSubAgent |--= 00177 messagebus /sw/bin/dbus-daemon --system |--= 00200 root /usr/sbin/coreaudiod |--= 43345 Sam /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker MDSImporterWorker com.apple.Spotlight.ImporterWorker.501 \--= 96302 _spotlight /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker MDSImporterWorker com.apple.Spotlight.ImporterWorker.89
grep 命令的圖像