Particularly useful on OS X where netstat doesn't have -p option. Show Sample Output
The backtick operator, in general, will execute the text inside the backticks. On OS X, the pbpaste command will put the contents of the OS X clipboard to STDOUT. So if you put backticks around pbpaste, the text from the OS X clipboard is executed. If you add the pipeline | pbcopy, the output from executing the command on the clipboard is placed back on the clipboard. Note: make sure the clipboard is text only. Show Sample Output
Recursively removes all those hidden .DS_Store folders starting in current working directory.
Replace "user@domain.com" with the target e-mail address. Thanks to alediaz for "$HOSTNAME" which is very useful when running the command with Apple Remote Desktop to multiple machines simultaneously.
Create an ISO Image from a folder and burn it to CD (Os X)
random(6) - random lines from a file or random numbers
I often use this command to learn pronunciation of unfamiliar words.
Randomizes a file. The opposite of sort is sort -R!
Converts a .pdf to .jpg . should work with jpeg | tiff | png | gif | jp2 | pict | bmp | qtif | psd | sgi | tga
/path/ is the root folder of the DVD, not the VIDEO_TS folder.
sudo ipfw pipe 1 config bw 50KByte/s Set the bandwidth (bw) limit to any number you want. For example you could have a 15kb pipe for X application and then a 100kb pipe for another application and attach things to those pipes. If a port isn’t attached to a pipe, it runs at full speed. Change the number (in this case 1) to a different number for a different pipe. The next step is to attach your port. sudo ipfw add 1 pipe 1 src-port 80 In this case anything on port 80 (http) will be set to a limit of 50Kbyte/s. If you want to attach a second port to this pipe, repeat the command but change the port number at the end. src : http://www.mactricksandtips.com/2008/12/throttling-bandwidth-on-a-mac.html
It works best as part of a function, such as the following: MUSICROOT=~/Music function fplay { if [ $1 = '-v' ]; then shift 1 find -E $MUSICROOT -type f -iname "*$**" -iregex '.*\.(3g[2|p]|aac|ac3|adts|aif[c|f]?|amr|and|au|caf|m4[a|r|v]|mp[1-4|a]|mpeg[0,9]?|sd2|wav)' -print -exec afplay "{}" \; & else find -E $MUSICROOT -type f -iname "*$**" -iregex '.*\.(3g[2|p]|aac|ac3|adts|aif[c|f]?|amr|and|au|caf|m4[a|r|v]|mp[1-4|a]|mpeg[0,9]?|sd2|wav)' -exec afplay "{}" \; & fi }
The command creates an alias called 'path', so it's useful to add it to your .profile or .bash_profile. The path command then prints the full path of any file, directory, or list of files given. Soft links will be resolved to their true location. This is especially useful if you use scp often to copy files across systems. Now rather then using pwd to get a directory, and then doing a separate cut and paste to get a file's name, you can just type 'path file' and get the full path in one operation. Show Sample Output
Use this the next time you need to come up with a reasonably random bitstring, like for a WPA/WPA2 PSK or something. Takes a continuous stream of bytes coming from /dev/urandom, runs it through od(1), picking a random field ($0 and $1 excluded) from a random line and then prints it. Show Sample Output
The closer to zero the better.Credit to TheSeb on macrumors: http://forums.macrumors.com/showthread.php?t=1289884 Show Sample Output
If the password for the share your trying to mount contains special characters you can use URL escape characters. The above command uses an example as follows: username: user password: p@ss URL Encoded password: p%40ss All credit goes to Richard York: http://www.smilingsouls.net/Blog/20110526100731.html Also check out this URL Decoder/Encoder to convert your passwords. http://meyerweb.com/eric/tools/dencoder/
Swap TRUE with FALSE to turn it off again. Note: Finder must be relaunched afterwards to see the effect. For example like this:
killall Finder && open /System/Library/CoreServices/Finder.app
This finds all the PowerPC apps recognized by OS X.
A better version is:
system_profiler SPApplicationsDataType 2> /dev/null | perl -
wnl -e '$i=$j=$k=$p=0; @al=; $c=@al; while($j
s[$i].=$al[$j]; $i++ if ($al[$j]) =~ /^\s\s\s\s\S.*:$/; $j++} while($k
apps[$k++]; if (/Kind: PowerPC/s) {print; $p++;}} print "$i applications, $p P
owerPC applications\n\n"'
but that is more than 255 characters...
The sort utility is well used, but sometimes you want a little chaos. This will randomize the lines of a text file.
BTW, on OS X there is no
| sort -R
option! There is also no
| shuf
These are only in the newer GNU core...
This is also faster than the alternate of:
| awk 'BEGIN { srand() } { print rand() "\t" $0 }' | sort -n | cut -f2-
Show Sample Output
print the lines of a file in randomized order Show Sample Output
No final count, but clean and simple output.
If you are a regular user of Google Chrome and Gmail Offline, you'll find that Gmail Offline stops working after a while due to corruption of its local storage in your browser. Worse, trying to use Google Chrome's "Clear Browsing Data" menu command to remove all the local storage is (1) overkill, because it deletes non-Google page local storage, and (2) ineffective, because once the storage is corrupt, Google Chrome doesn't know how to delete it either. Fortunately, it's all stored in obviously named files in your home directory; this command deletes the files directly, after which restarting Google Chrome will let you reinstall Gmail Offline correctly.
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: