This is useful if you have need to do port forwarding and your router doesn't assign static IPs, you can add it to a script in a cron job that checks if you IP as recently changed or with a trigger script. This was tested on Mac OSX.
Schedule your Mac to sleep at any future time.
Also wake, poweron, shutdown, wakeorpoweron. Or repeating with
sudo pmset repeat wakeorpoweron MTWRFSU 7:00:00
Query with
pmset -g sched
Lots more at http://www.macenterprise.org/articles/powermanagementandschedulingviathecommandline
No need for the ls -r and a sort is also not really needed. Show Sample Output
Ruby version.
Also, a perl version:
perl -e 'printf("%.2x.",rand(255))for(1..5);printf("%.2x\n",rand(255))'
adjusting the field "f1" will give you additional information such as f1 = 98% f2 = discharging f3 = 2:02 remaining Show Sample Output
First set the variable $hexchars:
hexchars="0123456789ABCDEF"
Change the number in the first for loop if you need less then 1200 mac addresses
Show Sample Output
Doubt it actually generates valid mac addresses but this version doesn't need any external commands so it runs much faster. Much shorter as well. Show Sample Output
Shorter and more straightforward.
Also in perl:
perl -e 'print join(":", map { sprintf "%0.2X",rand(256) }(1..6))."\n"'
List all MAC addresses on a Linux box. sort -u is useful when having virtual interfaces.
MAC OSX doesn't come with an updatedb command by default, this will emulate the updatedb thats on a typical Linux OS. Simply add it to your ~/.bash_profile
This does the following: 1 - Search recursively for files whose names match REGEX_A 2 - From this list exclude files whose names match REGEX_B 3 - Open this as a group in textmate (in the sidebar) And now you can use Command+Shift+F to use textmate own find and replace on this particular group of files. For advanced regex in the first expression you can use -regextype posix-egrep like this: mate - `find * -type f -regextype posix-egrep -regex 'REGEX_A' | grep -v -E 'REGEX_B'` Warning: this is not ment to open files or folders with space os special characters in the filename. If anyone knows a solution to that, tell me so I can fix the line.
I much prefer using /sbin/ip over /sbin/ifconfig for most everything. I find the interface and output to be much more consistent and it has many abilities that ifconfig, route, etc. do not. To get the mac address for only one interface, add 'show dev [interface]' to the 'ip link' part of the command: ip link show dev eth0 | grep 'link/ether' | awk '{print $2}' . Also, both this command and the ifconfig one do not require root access to run, so the sudo is not necessary. Show Sample Output
Python Alternative Show Sample Output
Formats the output from `ioreg` into XML, then parses the XML with `xmllint`'s xpath feature. Show Sample Output
adding users to groups on OS X is not a straightforward process, you need to use the new in built in Directory Service command line utility...
...or for a particular interface...
Simple MAC adrress, thanks to ifconfig.
Useful for creating MAC addresses for virtual machines on a subnet. 00:16:3e is a standard Xen OID, change as needed. Show Sample Output
You have to install the package macchanger but this command will create a random mac from a list of known manufacturers. If you want to make a complete random mac, use the -r option .
Insert an additional (moveable) spacer on the left side of the Dock in Mac OS X
Insert an additional (moveable) spacer on the right side of the Dock in Mac OS X
In Mac OS X, by default, you have to click the mouse on a Terminal window before you can type in it. You can change this behavior to mimic the X11 behavior of focusing on the window on mouseover.
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: