commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
This example code is intended to be used as a root permissions check in a script. It makes use of the $EUID (effective user ID) environment variable which is fully su- and sudo-safe.
set CDIR for it to work right..
Tar - Compress by excluding folders
get-ipsw device-name generation-string firmware-version
get-ipsw iPod 2,1 4.0
Different generation strings:
iPhone 3G: iPhone 1,2
iPhone 3GS: iPhone 2,1
iPod touch 2G: iPod 2,1
iPod touch 3G: iPod 3,1
This can be used with idevicerestore (I haven't tried it though).
Some shell newbies don't know this very handy file management related command so I decided to include it here.
You need to have the "file" package installed.
Saves opening another console terminal (eg. CTRL+ALT+F[n]) or opening another remote terminal.
Ctrl+Z pauses the current task and pushed it to the background, leaving you with a command prompt for those "Oh crap I forgot to change xyz before I ran that and it'll take forever if I Ctrl+C and start again..." situations. Typing 'fg' (shorthand for foreground, that's how I remember it) will resume the paused task.
Bash scrip to test if a server is up, you can use this before wget'ing a file to make sure a blank one isn't downloaded.
Every seconds do
I wanted to play a song from the shell and get the shell back, I also dont want to store the file if it is not needed.
edit, not sure if I need to mention it... killall vlc to stop it
compare to alternative :
- directly tests the -STOP of the process to continue or stop loop,
- background operator should be set (or not) at the call of the function
For extension i suggest a slowPID() based on kill like above and a slowCMD based on killall.
On my music directory, I create variable that contains all mp3s files, then I play them with mpg123. -C options enable terminal control key, s for stop, p for pause, f for forward to next song.
Remove all empty directories below the current directory. If directories become empty as the results of this, remove those too.
Get just the IP address for a given hostname. For best results, make this a function in your shell rc file so that it can be used for things like traceroute:
Titus:~$ traceroute `getip foo.com`
traceroute to 188.8.131.52 (184.108.40.206), 64 hops max, 52 byte packets
Have wc work on each file then add up the total with awk; get a 43% speed increase on RHEL over using "-exec cat|wc -l" and a 67% increase on my Ubuntu laptop (this is with 10MB of data in 767 files).
By default, slot 1 is used for OTP purposes and validates against the Yubikey servers. Running the command above will replace that. If you have a Yubikey 2 or above, you can change -1 to -2 and program the second slot with a strong static key.
take a list of IP:PORT and output IP:PORT:COUNTRY
Traffic details on the Ethernet interface.
When you press "cmd+n" in TextMate, you can have "HTML" language as default document format... You can also define other languages too. You need to know the UUID of your language bundle.
1.) my profile ends with $USER not with .default
2.) only grep for the first occurrence because some extensions have the translated name also inside the install.rdf
This is an easy way to quickly get a status for a device in multipath on SLES systems, as long as the server is configured based on Novell's standards, where multipathed disks are referred to by /dev/disk/by-... tree. Make sure to replace name_of_vg with your Volume Group name.