commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
If you want to see your top ten cpu using processes from the browser (e.g. you don't want to ssh into your server all the time for checking system load) you can run this command and browse to the machines ip on port 8888. For example 192.168.0.100:8888
It requires https://jqplay.org/, that comes with brew: brew install jq
When you run a lot of containers the built in docker ps output becomes unreadable. This command formats the output to be easier on the eyes.
Requires q (https://github.com/harelba/q) text as data.
There are times when a X Window server hangs. When this happens, you can log in on a terminal and kill the Xorg process (i.e. the X Server). This one line command will do the trick.
left-most column is PID, middle is virtual memory being consumed, right-most is actual process.
Displays memory usage for individual instances of an application that spawns multiple instances of itself. This command also works on single process applications.
If you have ever been trying to look for a list of processes based on their elapsed time you don't need to look any further.
This command lets you find the list of processes ordered in a reversed order (oldest at the top) that have been running for over an hour on your system. Any system processes are filtered out, leaving only user initiated ones in. I find it extremely useful for debugging and performance analysis.
Run one script after another in such a way that second script starts after finishing first one. Without using Pipe | or ampercent && i.e. the first process is already running and you want second one to start after the first one finishes. And this can be done in different folder in case the output of second script will affect the output of first script. So run this on any folder you wish to.
Where $PID is the process id of the already running job (add PID number)
script2 is your script you wish to run after first script ends
sleep 1 is sleep for one second (SUFFIX may be ?s? for seconds (the default), ?m? for minutes, ?h? for hours or ?d? for days, read man sleep)
This command will show the sum total of memory used in gigabytes by a program that spawns multiple instances of itself. Replace chrome with whatever program's memory usage you are investigating. This command is rather useless on software that only spawns a single instance of itself.
Add up the amount of memory your processes are using and display the total. Replace marcanuy with your desired username.
Llist all the processes in the run queue.
This will find all the -Xmx[BIGINT] running on a system, add them up for you and give you the total.
Sets the exec bit on a file.
Piping ps into grep is mostly useless: ps has its own filter options like -u and -C
Pipes the header row of ps to STDERR, then greps for the command on the output of ps, removing the grep entry before that.
This shows all process (-e) and threads (-L) in full format (-F)