Today I needed to choose an icon for an app. My simpler way: put all of /usr/share/icons in myicons folder and brows'em with nautilus. Then rm -r 'ed the entire dir. Show Sample Output
In other way of xargs, only with find -exec
This function does a batch edition of all OOO3 Writer files in current directory. It uses sed to search a FOO pattern into body text of each file, then replace it to foo pattern (only the first match) . I did it because I've some hundreds of OOO3 Writer files where I did need to edit one word in each ones and open up each file in OOO3 gui wasn't an option. Usage: bsro3 FOO foo
My variation on an audio burning command from commandlinefu - this one doesn't crap out if you want to burn a CD in a directory whose permissions don't allow it, and instead rips everything to /tmp. If you mount your music partition like I do using Samba, you probably don't have write permission inside that file system in order to create the temporary directory other audio burning commands here use. Not a bad idea to add cdrom to your groups, and /bin/eject with visudo.
The tag function takes a tag name as its first argument, then a list of files which take that tag. The directory $HOME/tags/tagname will then hold symbolic links to each of the tagged files. This function was inspired by tmsu (found at https://bitbucket.org/oniony/tmsu/wiki/Home).
Example:
tag dog airedale.txt .shizturc weimeraner.pl
This will create $HOME/tags/dog which contains symbolic links to airedale.txt .shizturc and weimeraner.pl
Create and access directory (edited)
The previous alternative dont work (the cd command was missing).
To make it even more practical, make sure you can login to the ssh server using a keypair.
For use in scripts this command is very usefull
Clone linux installation.
_ expands to the last argument of the last command that was executed
Creates a directory named with the current date, in the format YYYYMMDD. If you give it a directory name as an argument, it will create the new directory inside the specified directory. This is an alternative to command #1993. Show Sample Output
Clone directory structure without the files
This creates a bash function `take` that you can call with the name of the directory as the first parameter. Add the function to ~/.bashrc to have it available anytime. Show Sample Output
shell function which allows you to tag files by creating symbolic links directories in a 'tags' folder.
The tag function takes a tag name as its first argument, then a list of files which take that tag. The directory $HOME/tags/tagname will then hold symbolic links to each of the tagged files. This function was modified from bartonski's (http://www.commandlinefu.com/commands/view/10216) inspired by tmsu (found at https://bitbucket.org/oniony/tmsu/wiki/Home) with readlink function by flxndn (http://www.commandlinefu.com/commands/view/10222).
Example:
tag dog airedale.txt .shizturc weimeraner.pl
This will create $HOME/tags/dog which contains symbolic links to airedale.txt .shizturc and weimeraner.pl
You need to cp, mv, scp, ..., some files around from one place to another, and after having laboriously typed out the source path, you remember that the destination directory doesn't yet exist, and so the command will fail. So rather than killing the command line and starting over, just interpolate the results of creating the directory and echo its name. You could DRY this with a for; do; done, but that may be more trouble than it's worth. Show Sample Output
Cleans apt-get and gpg cache and keys
Using a GUI file managers you can merge directories (cut and paste). This command roughly does the same (it doesn't ask for confirmation (no problem for me) and it doesn't clean up the empty SRC directories (no problem, trivial).
probably does the same:
cp -l SRC TARGET; rm -rf SRC
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: