commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
This find syntax seems a little easier to remember for me when I have to use -prune on AIX's find. It works with gnu find, too.
Add whatever other find options after -prune
For a given filesystem return the LUN ID. Command assumes 1:1 relationship between fs:lv:hdisk:lun which may not be the case in all environments.
Lists directory size up to a maximum traversal depth on systems like IBM AIX, where the du command doesn't have Linux's --max-depth option. AIX's du uses -g to display directory size on gigabytes, -m to use megabytes, and -k to use kilobytes. tr### is a Perl function that replaces characters and returns the amount of changed characters, so in this case it will return how many slashes there were in the full path name.
This command is used to verify a sha256sum-formatted file hash list on IBM AIX or any other UNIX-like OS that has openssl but doesn't have sha256sum by default. Steps:
1: Save to the filesystem a script that:
A: Receives as arguments the two parts of one line of a sha256sum listing
B: Feeds a file into openssl on SHA256 standard input hash calculation mode, and saves the result
C: Compares the calculated hash against the one received as argument
D: Outputs the result in a sha256sum-like format
2: Make the script runnable
3: Feed the sha256sum listing to xargs, running the aforementioned script and passing 2 arguments at a time
This command is for UNIX OSes that have plain vanilla System V UNIX commands instead of their more functional GNU counterparts, such as IBM AIX.
This command is for producing GNU sha256sum-compatible hashes on UNIX systems that don't have sha256sum but do have OpenSSL, such as stock IBM AIX.
1.- Saves a wrapper script for UNIX find that does the following:
A.- Feeds a file to openssl on SHA256 hash calculation mode
B.- Echoes the output followed by the filename
2.- Makes the file executable
3.- Runs find on a directory, only processing files, and running on each one the wrapper script that calculates SHA256 hashes
Pending is figuring out how to verify a sha256sum file on a similar environment.
use this command to gzip the file and write to stdout and from the stdout redirect to the another file
Not figured by me, but a colleague of mine.
See the total amount of data on an AIX machine.
See who is using a specific port. Especially when you're using AIX. In Ubuntu, for example, this can easily be seen with the netstat command.
Specify the size in bytes using the 'c' option for the -size flag. The + sign reads as "bigger than". Then execute du on the list; sort in reverse mode and show the first 10 occurrences.
This command is AIX compatible.
It will prompt the user for a new password at next logon
you must be in the directory to analyse
report all files and links in the currect directory, not recursively.
this find command ahs been tested on hp-ux/linux/aix/solaris.