LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-20-2018, 11:48 PM   #1
catiewong
Member
 
Registered: Aug 2018
Posts: 190

Rep: Reputation: Disabled
list by Alphabetical order


just would like to ask , I use "ps -ef" command to list running process , it will be listed by start date of the process , would advise if I would like by Alphabetical order , how to do it ?
 
Old 12-21-2018, 12:29 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,109

Rep: Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150
Try ps --sort command. For details, see the man page.

Google also knows this. Search for linux ps sort by command.
 
Old 12-21-2018, 12:58 AM   #3
catiewong
Member
 
Registered: Aug 2018
Posts: 190

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Try ps --sort command. For details, see the man page.

Google also knows this. Search for linux ps sort by command.
sorry to future ask , just tried "ps -aux --sort" but not work , would advise what command should use ?
 
Old 12-21-2018, 01:05 AM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,109

Rep: Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150
Quote:
Originally Posted by catiewong View Post
sorry to future ask , just tried "ps -aux --sort" but not work , would advise what command should use ?
Perhaps ps -ef --sort.
 
Old 12-21-2018, 01:09 AM   #5
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,109

Rep: Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150
On my server:
Code:
$ ps -ef --sort command | head -n20
UID        PID  PPID  C STIME TTY          TIME CMD
lightdm    835   834  0 10:02 ?        00:00:00 (sd-pam)
bbausch   6568  6567  0 15:06 ?        00:00:00 (sd-pam)
root       682     1  0 10:02 ?        00:00:00 /usr/sbin/ModemManager
root        63     2  0 10:01 ?        00:00:00 [NULL_task_for_h]
root       693     1  0 10:02 ?        00:00:00 /usr/sbin/NetworkManager --no-daemon
root       801   777  0 10:02 tty7     00:00:07 /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
root       694     1  0 10:02 ?        00:00:03 /usr/lib/accountsservice/accounts-daemon
root      1260     1  0 10:02 tty1     00:00:00 /sbin/agetty --noclear tty1 linux
root      1261     1  0 10:02 ttyS0    00:00:00 /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt220
lightdm    850     1  0 10:02 ?        00:00:00 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately
lightdm    862     1  0 10:02 ?        00:00:00 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
avahi      658     1  0 10:02 ?        00:00:00 avahi-daemon: running [odroid.local]
avahi      675   658  0 10:02 ?        00:00:00 avahi-daemon: chroot helper
root       653     1  0 10:02 ?        00:00:00 /usr/sbin/avahi-dnsconfd -s
bbausch   6618  6617  0 15:06 pts/8    00:00:00 -bash
root        37     2  0 10:01 ?        00:00:00 [bioset]
root       688     1  0 10:02 ?        00:00:00 /usr/lib/bluetooth/bluetoothd
root        42     2  0 10:01 ?        00:00:00 [cfg80211]
root        62     2  0 10:01 ?        00:00:00 [cfinteractive]
So, ps removes some non-alphanumeric characters and uses the last pathname component.

It also seems to be immune to the LANG setting.

Last edited by berndbausch; 12-21-2018 at 01:12 AM.
 
1 members found this post helpful.
Old 12-21-2018, 03:00 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,576

Rep: Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341
Quote:
Originally Posted by catiewong View Post
sorry to future ask , just tried "ps -aux --sort" but not work , would advise what command should use ?
I would give you an advice, at least please try to read the man page. Really. Believe me, it would be much faster than posting and waiting for the answer. --sort requires a spec, like --sort command. Also you can search for solutions on the net where you can find immediate answers. Like this: https://alvinalexander.com/linux/uni...ps-command-cpu. I cannot explain better.
 
Old 12-21-2018, 03:58 AM   #7
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 892

Rep: Reputation: 288Reputation: 288Reputation: 288
@OP: I don't know which ps you have but maybe one of the following is what you want (depending on the ascending/descending order):
Code:
ps --sort=+cmd
ps --sort=-cmd
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files in order alphabetical order nuxguy Linux - General 13 11-07-2014 06:32 AM
Create a User List in Alphabetical Order? carlosinfl Linux - General 7 10-26-2010 03:07 PM
How to list the 'chkconfig --list' in alphabetical order? thomas2004ch Linux - Newbie 3 01-08-2010 03:09 AM
How-to list contents of text file in alphabetical order? sucram2g Linux - Software 1 02-19-2007 04:39 AM
how to 'sort' by file extension then alphabetical order adamrosspayne Linux - Newbie 4 07-04-2006 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration