When trying to find an error in a hosted project it's interesting to find out how the source is organized: Are there .inc files? Or .php files only? Or .xml files that probably contain translated texts? Show Sample Output
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. Show Sample Output
Does a search and replace across multiple files with a subgroup replacement.
Note that in the command N is, for instance, 37. Show Sample Output
If you have a logfile where some lines start with timestamps like "2014-05-01 12:34:56,123" but other lines are missing the timestamp (like stack traces or object dumps), then use this script to copy the most recent timestamp to any lines that are missing it. This is useful for merging log files, since you can then safely sort by timestamp to merge the files. Show Sample Output
Use case insensitive regex to match files ending in popular video format extensions and calculate their total time. (traverses all files recursively starting from the current directory) Show Sample Output
I used this (along with a modified one replacing `mkv` with `srt`) to remove the slight differences in who the provider of the video / matching subtitle was (as they are the same contents and the subs match anyway). So now VLC (and other video players) can easily guess the subtitle file. Show Sample Output
This will add a perl POD stub above each method in all modules found recursively in your current directory. The stub will look like: =head2 method_name =cut sub method_name { ...
perl version of "Wait for file to stop changing" When "FileName" has not been changed for last 10 seconds, then print "DONE" "10" in "(stat)[10]" means ctime. One have other options like atime, mtime and others. http://perldoc.perl.org/functions/stat.html
drop first column with perl "$#F" means a index of last column(start from 0). One can easily handle range of columns like "[3..6]"
This sequence of pipes will strip the last newline and send the remainder to the X11 clipboard. I have it as: alias clipb='perl -pe "chomp if eof" | xclip -selection c' so I can just do "echo hello | clipb" Multi-line texts will keep their internal newlines, but the last newline will be removed. This usually makes most sense. Show Sample Output
Time protocol serves up seconds since 1900 in a 32 bit binary number. Show Sample Output
Sort your files in folders/chronological order Linux 4.1.6-1-ARCH Show Sample Output
The only command-line version of this task I could come up with that properly handles UTF-8 input, too. (Yes, I know how crazy it is to have UTF-8 with HTML entity escapes, but that stuff exists... sadly...; Just check Twitter.)
Prints a string as a sequence of hexadecimal values. Output comes in space separated pairs, regardless of ASCII or Unicode characters 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: