commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This works on my ubuntu/debian machines.
I suspect other distros need some tweaking of sort and cut.
I am sure someone could provide a shorter/faster version.
Find all corrupted jpeg in the current directory, find a file with the same name in a source directory hierarchy and copy it over the corrupted jpeg file.
Convenient to run on a large bunch of jpeg files copied from an unsure medium.
Needs the jpeginfo tool, found in the jpeginfo package (on debian at least).
This will, for an application that has already been removed but had its configuration left behind, purge that configuration from the system. To test it out first, you can remove the last -y, and it will show you what it will purge without actually doing it. I mean it never hurts to check first, "just in case." ;)
If you're like me and want to keep all your music rated, and you use xmms2, you might like this command.
I takes 10 random songs from your xmms2 library that don't have any rating, and adds them to your current playlist. You can then rate them in another xmms2 client that supports rating (I like kuechenstation).
I'm pretty sure there's a better way to do the grep ... | sed ... part, probably with awk, but I don't know awk, so I'd welcome any suggestions.
Use the find command to match certain files and summarise their total size in KBytes.
Greps located files for an expression.
Example greps all LaTeX files for 'foo':
locate *.tex | xargs grep foo
To avoid searching thousands of files with grep it could be usefull to test first how much files are returned by locate:
locate -c *.tex
Lists the local files that are not present in the remote repository (lines beginning with ?)
and add them.
Linux : these script enable you to edit multiple files and remove exact phrase from multiple files
Are there any creative pieces of music that can be created using beep and the shell? I'd love to hear it!
By time thumbnail images in ~/thumbnails take up too much space, this command will help deleting old ones.
Find options explained:
-type f : find files only, not directories
-atime +30 : last accessed more than 30 days ago
On Fedora clean the boot directory; erase older kernel
Can be used for other commands as well, replace rm with ls.
It is easy to make this shorter but if the filenames involved have spaces, you will need to do use find's "-print0" option in conjunction with xargs's "-0" option. Otherwise the shell that xargs uses to execute the "rm" command line will treat the space as a token separator, thereby treating the name as two (or more) names.
Create backup (.tar.gz) for all first-level directory from current dir.
-t, --target-directory=DIRECTORY (copy all SOURCE arguments into DIRECTORY).