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
This is a quick way to find what is hogging disk space when you get a full disk alert on your
monitoring system. This won't work as is with filesystems that allow embedded spaces in user
names or groups (read "Mac OS X attached to a Windows Domain"). In those cases, you will need to change the -k 5 to something that works in your situation.
left-most column is PID, middle is virtual memory being consumed, right-most is actual process.
If we've many files containing (?, ?, ?, ?, ? ) characters instead of ?, ?,... etc,...
we can ue this simple command line running a sed command inside a for loop searching for files containing that characters.
Hope u like it! Enjoy! ;)
Add date time to output whithin the current directory
I tried a few curses based mp3 players for playing back choir practice songs for my wife.
Unfortunately none of the ones I tried were capable of scrubbing a track.
Firefox saves the day.
Btrfs reports the inode numbers of files with failed checksums. Use `find` to lookup the file names of those inodes. The files may need to be deleted and replaced with backups.
Btrfs reports the inode numbers of files with failed checksums. Use `find` to lookup the file names of those inodes.
List the busiest scripts/files running on a cPanel server with domain showing (column $12).
IP addresses and number of connections connected to port 80.
Easiest way to obtain the busiest website list (sorted by number of process running).
Sort netflow packet capture by unique connections excluding source port.
Very quick! Based only on the content sizes and the character counts of filenames. If both numbers are equal then two (or more) directories seem to be most likely identical.
if in doubt apply:
diff -rq path_to_dir1 path_to_dir2
AWK function taken from here:
Remove duplicate line in a text file.
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.
Use the AWS CLI tools to generate a list instances, then pipe them to JQ to show only their launch time and instance id. Finally use sort to bring them out in runtime order. Find all those instances you launched months ago and have forgotten about.