Generates a bash array and uses it to select a random image from ~/wallpapers.
Pass the files path to finfo(), can be unix path, dos path, relative or absolute. The file is converted into an absolute nix path, then checked to see if it is in-fact a regular/existing file. Then converted into an absolute windows path and sent to "wmic". Then magic, you have windows file details right in the terminal. Uses: cygwin, cygpath, sed, and awk. Needs Windows WMI "wmic.exe" to be operational. The output is corrected for easy...
finfo notepad.exe
finfo "C:\windows\system32\notepad.exe"
finfo /cygdrive/c/Windows/System32/notepad.exe
finfo "/cygdrive/c/Program Files/notepad.exe"
finfo ../notepad.exe
Show Sample Output
Repair each node in sequence. Make sure you change the IP replacements to match your environment
echo defaults to include a newline character at the end of the string, which messes with the hash. If you suppress it with -n then it has the same effect as PHP's ?echo md5("string"), "\t-";? Even more, by using cut you get the exact same output, so it works as a drop-in replacement for the original command for this thread. Show Sample Output
hexdump could be used for conversion too!
- recompresses all gz files to bz2 files from this point and below in the directory tree
- output shows the size of the original file, and the size of the new file. Useful.
- conceptually easier to understand than playing tricks with awk and sed.
- don't like output? Use the following line:
for gz in `find . -type f -name '*.gz' -print`; do f=`basename $gz .gz` && d=`dirname $gz` && gunzip -c $gz | bzip2 - -c > $d/$f.bz2 && rm -f $gz ; done
Show Sample Output
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.
Find all private keys and dump their fingerprints. Show Sample Output
Lost your luks passphrase? You can always bruteforce from the command line. See the sample output, a simple command using a dictionary. Show Sample Output
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. Show Sample Output
In this example I am returning all the files in /usr/bin that weren't put there by pacman, so that they can be moved to /usr/local/bin where they (most likely) belong. Show Sample Output
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! ;) Show Sample Output
The `*.csv` type can be substituted for anything you want Show Sample Output
Found it online and could be very useful
Something I do a lot is extract columns from some input where cut is not suitable because the columns are separated by not a single character but multiple spaces or tabs. So I often do things like: ... | awk '{print $7, $8}' ... which is a lot of typing, additionally slowed down when typing symbols like '{}$ ... Using the simple one-line function above makes it easier and faster: ... | col 7 8 How it works: The one-liner defines a new function with name col The function will execute awk, and it expects standard input (coming from a pipe or input redirection) The function arguments are processed with sed to use them with awk: replace all spaces with ,$ so that for example 1 2 3 becomes 1,$2,$3, which is inserted into the awk command to become the well formatted shell command: awk '{print $1,$2,$3}' Allows negative indexes to extract columns relative to the end of the line. Credit: http://www.bashoneliners.com/oneliners/oneliner/144/ Show Sample Output
Chronometer using the bc calculator. Show Sample Output
Mac OSX friendly version of google function Show Sample Output
Using the $PIPESTATUS array you can get the results of a command in a sequence of commands piped together. The command above returns the result of grep -o "bob", which is exit result of 1 since no match was made. Show Sample Output
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: