Displays the manifest within a jar file. Can use it to confirm version number, etc.
Require "grep -P" ( pcre ).
If you don't have grep -P, use that :
grep -Eo '"url":"[^"]+' $(ls -t ~/.mozilla/firefox/*/sessionstore.js | sed q) | cut -d'"' -f4
In other way of xargs, only with find -exec
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 loop, until the last port (65535), list all opened ports on host. in the sample I used localhost, but you can replace with any host to test. Show Sample Output
This is a joke for @putnamhill and @glaudiston I'm pretty sure we can write longer if we want ;)
Hi glaudiston, you can save a few chars by leaving out cat and pipe and still enjoy the added flexibility.
Yep, is hard, but is a way more flexible using pipe.
Only need to install Image Magick package.
Display a xkcd comic with its title and save it in /tmp directory
If you prefer to view the newest xkcd, use this command:
wget -q http://xkcd.com/ -O-| sed -n '/<img src="http:\/\/imgs.xkcd.com\/comics/{s/.*\(http:.*\)" t.*/\1/;p}' | awk '{system ("wget -q " $1 " -O- | display -title $(basename " $1") -write /tmp/$(basename " $1")");}'
If you can install rpl it's simpler to use and faster than combinations of find, grep and sed. See man rpl for various options. time on above operation: real 0m0.862s, user 0m0.548s, sys 0m0.180s using find + sed: real 0m3.546s, user 0m1.752s, sys 0m1.580s Show Sample Output
Optimal way of deleting huge numbers of files
Using -delete is faster than:
find /path/to/dir -type f -print0 | xargs -0 rm
find /path/to/dir -type f -exec rm {} +
find /path/to/dir -type f -exec rm \-f {} \;
This command find all files in the current dir and subdirs, and replace all occurances of "oldstring" in every file with "newstring".
This command copies all filenames in the current dir and subdirs that end in .mp3 regardless of case (also matches .MP3 .mP3 and .Mp3) It copies all the files to the "mp3" folder in your home directory. If you want to see the files that are beeing copied, replace "cp {}" with "cp -v {}"
If you copy windows file in e.g. cygwin the ACL might miss on the copied file. With this command you can copy the ACL of an existing file to another. WARNING: Existing ACL will get lost. Show Sample Output
No problem with word splitting. That should works on many Unix likes. Show Sample Output
for udp nmap -sU -p 80 hostname
WARNING!!! ALL DATA WILL BE LOST!!! This command should ONLY be run on drives that are meant to be wiped. Data destruction will result from running this command with the '-w' switch. You may run this command with the '-n' switch in place of '-w' if you want to retain all data on the drive, however, the test won't be as detailed, since the '-n' switch provides a non-destructive read-write mode only, whereas '-w' switch actually writes patterns while scanning for bad blocks.
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: