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:
Displays the number of processes per state
Waits for all pings to complete and returns ip with mac address
Typing a word in terminal is easier than digging your phone out, opening your two-factor authentication app and typing the code in manually.
This alias copies the one-time code to your clipboard for 3 seconds (long enough to paste it into a web form), then restores whatever was on the clipboard beforehand.
This command works on Mac. Replace pbpaste/pbcopy with your distribution's versions.
Moves the mouse 1 pixel down and to the right, then immediately back again, every 4 minutes. This keeps screensavers from turning on. I have used this extensively and I've never even noticed the mouse movement because it is so subtle.
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)
While a dd is running in one terminal, open another and enter the while loop. The sample output will be displayed in the window running the dd and the while loop will exit when the dd is complete. It's possible that a "sudo" will need to be inserted before "pkill", depending on your setup, for example:
while pgrep ^dd; do sudo pkill -INFO dd; sleep 10; done
This one is for OS X users: sort -R and shuf aren't available in Lion (10.7.5)
Processes biglion quantity of sold ebay coupons/bonus codes, so you can know approximate count of users who buyed the coupons and when sales are come up again.
You can change sleep parameter so script will work slowly or faster (default is 5 seconds).
Additional requirements: curl
Standart tools used: awk, date, cat, grep (bash)
This one works without an external program (watch). Witch is not await able all the time. HINT: use CTRL + C to exit the loop.
If you're a slow reader and/or you like to ponder, adjust the sleep time to be longer
This has saved me many times while debugging timeout issues to "too many open files" issues. A high number of the order of thousand, indicates that somewhere connection is not being closed properly.
If you are on your bed, waching a movie or if you are downloading something, but you whant to sleep. You can use these easy command to power off after X time. The time is in sec. if you whant to wait 1 H, use:
sleep 3600; poweroff
This will cause their computer to make a beeping sound after a random amount of time until it is killed.
The closer to zero the better.Credit to TheSeb on macrumors: http://forums.macrumors.com/showthread.php?t=1289884