Implementation of `rename` for systems on which I don't have access to it. Show Sample Output
Change the file extension in batch. Useful to create output file names with same input name but distinct extension by including logic inside the loop
You can read, add, delete and modify Windows permissions from Linux using smbcacls from the smb-client package. Show Sample Output
It gzip each file in a directory separately
Uses mime-type of files rather than relying on file extensions to find files of a certain type.
This can obviously be extended to finding files of any other type as well.. like plain text files, audio, etc..
In reference to displaying the total hours of video (which was earlier posted in command line fu, but relied on the user having to supply all possible video file formats) we can now do better:
find ./ -type f -print0 | xargs -0 file -iNf - | grep video | cut -d: -f1 | xargs -d'\n' /usr/share/doc/mplayer/examples/midentify | grep ID_LENGTH | awk -F "=" '{sum += $2} END {print sum/60/60; print "hours"}'
A shortcut to generate documentation with phpdoc. Defaults to HTML; optionally to PDF if third argument is given. Stores documentation in cwd under ./docs/. I forget the syntax to the output, -o, option, so this is easier.
This is a better version, as it does no command piping, uses for instead of while loops, which allows for a list of files in the current working directory to be natively processed. It also uses the -v/verbose option with mv to let you know what the command is doing. While the command does exactly the same in a better way, I would modify the sed option to replace spaces with underscores instead, or dashes. Please note that you'll receive errors with this command as it tries to rename files that don't even have spaces. This is an alternative to: http://www.commandlinefu.com/commands/view/8761/renames-all-files-in-the-current-directory-such-that-the-new-file-contains-no-space-characters. Show Sample Output
Using gentoo prefix portage I got in a situation where some packages did not contain the needed RPATH variable. This command helped me to find out which ones I should recompile Show Sample Output
Videos are found using their MIME type. Thus no need to for an extension for the video file. This is a efficent version of "jnash" cmd (4086). Thanks for jnash. This cmd will only show video files while his cmd show files having "video" anywhere in path. Show Sample Output
You can simply run "largest", and list the top 10 files/directories in ./, or you can pass two parameters, the first being the directory, the 2nd being the limit of files to display. Best off putting this in your bashrc or bash_profile file Show Sample Output
Really helpfull when play with files having spaces an other bad name. Easy to store and access names and path in just a field while saving it in a file. This format (URL) is directly supported by nautilus and firefox (and other browsers) Show Sample Output
Useful for transferring large file over a network during operational hours
Based / Inspired by malathion's below command http://www.commandlinefu.com/commands/view/20528/convert-csv-to-json Is written for python3 and is very easy to use csv2json *csv will convert all files ending in csv to json eg csv2json file.csv will output a file to file.json Validity of json tested in python3 and below site https://jsonformatter.curiousconcept.com/
This command will find all occurrences of one or more patterns in a collection of files and will delete every line matching the patterns in every file
include in the list human readable hidden files too:
file .* *|grep 'ASCII text'|sort -rk2
more reliable command:
ls|xargs file|grep 'ASCII text'|sort -rk2
and include hidden files:
ls -a|xargs file|grep 'ASCII text'|sort -rk2
This command creates a file of arbitrary size in a windows environment. Show Sample Output
Empties all files in /var/log over 5000k. Useful if /var goes crazy or if you just haven't cleaned up in a while.
you don't need to echo, just a plain redirect is enough to empty the file
The command `cat file >> file` failes with the following error message: cat: file: input file is output file `tee` is a nice workaround without using any temporary files. 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: