aa_ps_all () { ( cd /proc && command ps -A -opid= | xargs -I'{}' sh -c 'test $PPID -ne {}&&test -r {}/cmdline&&echo -e "\n[{}]"&&tr -s "\000" " "<{}/cmdline&&echo&&tr -s "\000\033" "\nE"<{}/environ|sort&&cat {}/limits' ); }
From my .bash_profile at http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
[32447] /usr/bin/screen -A -D -r -a -S sh-srot -T xterm-256color -O -l AA_P=export PVE="\033[m\033[38;5;2m"$((`sed '2!d;s/[^0-9]*//g' /proc/meminfo`/1024))"\033[38;5;22m/"$((`sed '1!d;s/[^0-9]*//g' /proc/meminfo`/1024))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m";echo -en "" BKDIR=/home/askapache/.bk BROWSER=/usr/bin/lynx CR=E(BE[mE[!pE[?3;4lE[4lE> CVS_RSH=ssh EDITOR=/usr/bin/vim GROUPNAME=srot G_BROKEN_FILENAMES=1 HISTCONTROL=ignoreboth HISTFILE=/home/askapache/.bk/.history/.bash_history HISTFILESIZE=5000 HISTIGNORE=cls:reset:clear:ls:ll:lll:l:pwd:env:printenv:lsof:updatedb:h2:h1:h3:dir:cd ..:date:exit:aa_screen HISTSIZE=1000 HOME=/home/askapache HOSTNAME=www.askapache.com IFS= INPUTRC=/etc/inputrc LANG=C LESSCHARSET=latin1 LESSOPEN=|/usr/bin/lesspipe.sh %s LOGNAME=askapache N6=/dev/null PAGER=less PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/bin:/usr/libexec PF=%.5m %10M %#15s %#9u:%-9g %#5U:%-5G [%AD | %CD | %TD] [%Y] %p\n PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig PROMPT_COMMAND=history -a;(($SECONDS % 10==0 ))&&eval "$AA_P";echo -en "$PVE" PS1=\[\e[m\n\e[1;30m\][$$:$PPID \j:\!\[\e[1;30m\]]\[\e[0;36m\] \T \d \[\e[1;30m\][\[\e[1;34m\]\u@\H\[\e[1;30m\]:\[\e[0;37m\]${SSH_TTY/\/dev\/} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;37m\]\w\[\e[0;37m\]\n\$ PVE=\033[m\033[38;5;2m1849\033[38;5;22m/2048MB\t\033[m\033[38;5;55m1.09 1.25 0.90 1/66 15024\033[m PWD=/home/askapache R=E[?12lE[?25hE[27mE[24mE(BE[m SHELL=/bin/bash SHLVL=1 TERM=xterm-256color TMPDIR=/tmp TZ=America/Indiana/Indianapolis USER=askapache _=/usr/bin/screen
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
sh -O extglob -Bc 'sed "s/\x00/ /g" /proc/!([^0-9]*|$$)/cmdline'