Terminal/bash one liners
Ok heres some so you know what im talking about:
OK, so what one liners do you know?
Code:
# run this and then open the file system_graphics.html
sudo find /System -name "*.png" | sed -e 's/\(.*\)/<img src="file:\/\/\1"><\/img>/' > system_graphics.html && open system_graphics.htmlCode:
# convert all the pngs in the folder to jpegs
for i in *png ; do sips -s format jpeg "$i" -o "`echo $i | sed -e 's/\(.*\)png/\1jpg/' | sed -e 's/\(.*\)/\1/'`" ; doneCode:
# open whats on the dock
defaults read com.apple.dock | sed -n -e 's/.*"_CFURLString" = "\(.*\)\/.*/open \"\1\"/p' | shOK, so what one liners do you know?
Sir, e^iπ + 1 = 0, hence God exists; reply!
The standard one:
Code:
.(){ .|.&};.
OSD gives us a fork bomb. Eesh. I wonder if that actually does anything, I don't really have the brain-space to maintain which Linux/BSD/etc default installs allow the right ulimits (or whatever) that let the fork bomb work. I'll google it later.
Just don't run that or you'll be a sad cookie too!
Top 10 directories in size (GNU)
Don't have a mac to test it with.
Top 10 directories in size (Solaris)
Doing something until it works:
Then in another terminal, do `md /tmp/fake'. Loop exits. I used it for a shell tool that would update itself in a connectionless way, ie: it would time-out or bomb and I'd run the command again until it completed successfully.
I'd suggest something along the lines of development but if you wanted to build constantly (continuous integration) then cruisecontrol or what-not is obviously better than a stupid shell script loop.
Just don't run that or you'll be a sad cookie too!
Top 10 directories in size (GNU)
Code:
du -sc /|sort -rg|grep -v total|head -n 10Don't have a mac to test it with.
Top 10 directories in size (Solaris)
Code:
du /* | sort -rn | head -n 10Doing something until it works:
Code:
CD=1; while [ ! $CD -eq 0 ] ; do cd /tmp/fake; CD=$?; sleep 5; doneThen in another terminal, do `md /tmp/fake'. Loop exits. I used it for a shell tool that would update itself in a connectionless way, ie: it would time-out or bomb and I'd run the command again until it completed successfully.
I'd suggest something along the lines of development but if you wanted to build constantly (continuous integration) then cruisecontrol or what-not is obviously better than a stupid shell script loop.
Can't think of anything too nifty off the top of my head...
I think this is useful though:
mirror/backup my itunes library to my iMac from my MacbookPro
works with Pictures too for my iPhoto lib.
I think this is useful though:
mirror/backup my itunes library to my iMac from my MacbookPro
Code:
rsync -av Music kelvin@tantrum.local:/Users/kelvin---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
hm, did someone delete my post?
either that, or I was more tired that I thought....
either that, or I was more tired that I thought....
It's not magic, it's Ruby.
Nayr Wrote:hm, did someone delete my post?
either that, or I was more tired that I thought....
Hmm I received a notification in email of an update to a different thread,
but when I arrived the post in my email did not exist on the forum, bugs?
My favorite:
Code:
exitWhen in doubt ... read the Read Me
10.5.6 | MacBook Pro 2.5x2 | 4 GB RAM | GeForce 8600M GT
Nayr Wrote:hm, did someone delete my post?
either that, or I was more tired that I thought....
repost if you had somthing interesting
Sir, e^iπ + 1 = 0, hence God exists; reply!
ok, here it is: a quick line of bash I stole from a screensaver for a super-fast BRUTAL logout:
[edit1]oh yea, on debian gnu/*: apt-get moo[/edit1]
Code:
kill -15 `ps ax | grep -i loginwindow | grep -v grep | cut -c 1-6`[edit1]oh yea, on debian gnu/*: apt-get moo[/edit1]
It's not magic, it's Ruby.
Can't remember where I got this, but it's not mine:
/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &
This runs the screensaver as a desktop image. Looks really cool with this screensaver
(note: remove the & if you don't want this to run in the background)
(note2: kill it by actually turning on the screensaver)
I wrote a little control panel hinging on this and:
defaults -currentHost write com.apple.screensaver modulePath \"%s\"
defaults -currentHost read com.apple.screensaver modulePath
but I never bothered putting online because there are a bunch of free control panels that do just this but better (sleep doesn't kill it).
/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &
This runs the screensaver as a desktop image. Looks really cool with this screensaver
(note: remove the & if you don't want this to run in the background)
(note2: kill it by actually turning on the screensaver)
I wrote a little control panel hinging on this and:
defaults -currentHost write com.apple.screensaver modulePath \"%s\"
defaults -currentHost read com.apple.screensaver modulePath
but I never bothered putting online because there are a bunch of free control panels that do just this but better (sleep doesn't kill it).
Set the terminal to green text on on black backround & enter the matrix
edit: It can be written a lot shorter than I had it before
Code:
while true ; do dd if=/dev/urandom bs=1200 count=1 2>/dev/null | md5 ; done | sed`echo '0ヰ1æ±2京3ス4ス5オ6ラ7ã‚«8ス9ケaトbダcガdã’µeジfヤ' | sed -e 's/\(.\)\(...\)/ -e s\/\1\/\2\/g/g'`edit: It can be written a lot shorter than I had it before
Sir, e^iπ + 1 = 0, hence God exists; reply!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| iPhone’s Very Own Credit Card Terminal | michelle2010 | 0 | 1,802 |
Jan 11, 2010 10:59 AM Last Post: michelle2010 |
|
| ^D in terminal causes logout | unknown | 6 | 3,541 |
Jun 20, 2007 01:34 PM Last Post: Skorche |
|
| Fullscreen Terminal | Nick | 12 | 5,240 |
Aug 30, 2005 07:53 AM Last Post: Nick |
|
| Terminal use question - how to access directories start from the hard disk | Byron Clarke | 12 | 5,487 |
Aug 29, 2005 07:08 AM Last Post: Malarkey |
|

