I used this because I needed to sort the content of a bunch of gzipped log files. Replace sort with something else, or simply remove sort to just rezip everything
This script will list all the files in the tarballs present on any folder or subfolder of the provided path. The while loop is for echoing the file name of the tarball before listing the files, so the tarball can be identified
The magic is performed by the parameter -t Show Sample Output
remove files with access time older than a given date. If you want to remove files with a given modification time replace %A@ with %T@. Use %C@ for the modification time. The time is expressed in epoc but is easy to use any other format. Show Sample Output
Execute this in the root of your music library and this recurses through the directories and normalizes each folder containing mp3s as a batch. This assumes those folders hold an album each. The command "normalize-audio" may go by "normalize" on some systems.
find all files in cur dir add to url and append to file
Remove all empty directories below the current directory. If directories become empty as the results of this, remove those too.
List all files from the current directory and subdirectories, sorted by modification time, oldest first.
If you have a directory with many working copies of various subversion projects and you want to update them all at once, this one may be for you. Show Sample Output
Finds all files below the current directory. Orders the result from smallest to largest. Good for finding the largest files in the tree.
If your site is struck with the white screen of death you can find the syntax error quickly with php lint
xargs avoids having to remember the "{} \;" (although definitely a useful thing to know. Unfortunately I always forget it). xargs version runs 2x faster on my test fwiw. edit: fixed to handle spaces in filenames correctly.
If you keep saved-webpages to read offline, then deleting the .js files will use a third less disk-space, without affecting the readability.
A simple command to find the total number of subdirectories in current directory starting with specific name. Show Sample Output
The sample command searches for PHP files replacing tabs with spaces.
-u NONE # don't use vimrc
Instead of
retab!
one may pass
retab! 4
for instance.
Look at this http://susepaste.org/69028693 also
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: