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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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:
This revision to my command (command #8851) was called for when it failed to find the parent
package of 'rlogin', which is really a deep symbolic link to /usr/bin/ssh.
This revision fixes this newfound issue, while ensuring fixes of other older issues work too.
delete file name space
the rename is rename perl version
Sometimes you unzip a file that has no root folder and it spews files all over the place. This will clean up all of those files by deleting them.
Using -Z with grep and -0 with xargs handles file names with spaces and special characters.
calls grep on all non-binary files returned by find on its current working directory
This will make a false directory with the same file names as whatever directory you choose. This is wise to use when testing scripts that alter contents, filenames, or move files. I wrote this after an OOPS I made when renaming a directory of JPGs, PNGs, PSDs that were mixed. I recommend this as I lost over 2000 vacation pictures and some graphics I designed for software and web sites. :(
NOTE: This only creates name copies, that data itself is not copied.
Helps if you accidentally deleted files from an svn repo with plain rm and you would like to mark them for svn to delete too.
LC_ALL=C is here to always grep on "differ" whatever your language env.
xargs -n 2 to run gvim -d with 2 arguments
gvim --nofork to use only one instance of gvim
This is a more concise answer to http://blog.commandlinekungfu.com/2011/09/episode-158-old-switcheroo.html in my opinion.
This works more reliable for me ("cut -c 8-" had one more space, so it did not work)
Finds a string in files recursively below the current directory on systems without the "egrep" and its "-r" functionality.
- grep for the word in a files, use recursion (to find files in sub directories), and list only file matches
-| xargs passes the results from the grep command to sed
-sed -i uses a regular expression (regex) to evaluate the change: s (search) / search word / target word / g (global replace)
-sl : show just file names
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.
Doesn't use shuf, its much faster with "shuf -n4" instead of sort -R
Tells you everything you could ever want to know about all files and subdirectories. Great for package creators. Totally secure too.
On my Slackware box, this gets set upon login:
LS_OPTIONS='-F -b -T 0 --color=auto'
alias ls='/bin/ls $LS_OPTIONS'
which works great.
The original suggestion did not work for me, when operating on folders located on an external mount (ie other than the root device) in Ubuntu. A variation using xargs does the trick.
It can work for message queue, semaphore set or shared memory just changing the parameter.
Escapes spaces in paths.