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:
Scans the file once to build a list of line numbers that contain non-printable characters
Scans the file again, passing those line numbers to sed as two commands to print the line number and the line itself. Also passes the output through a tr to replace the characters with a ?
copies all files from the source disk / (skipping boundaries of mouted -in volumes) to /mnt/mydisk. Logical links are being preserved as well as devices, pipes etc. This can copy a MacOS X or Linux volume and keep it bootable. Note: its not suited to copy files with MacOS 9 style resources.
Someone might attack on your system. You can drop attacker IP using IPtables. However, you can use route command to null route unwanted traffic. A null route (also called as blackhole route) is a network route or kernel routing table entry that goes nowhere. Matching packets are dropped (ignored) rather than forwarded, acting as a kind of very limited firewall. The act of using null routes is often called blackhole filtering.
Gets the latest Tweets in your friends timeline from Twitter. Uses curl and xmlstarlet.
Uses curl, xmlstarlet and festival to speak your horoscope. Modify the m (month) and d (day) parameters to the astrology web service to hear your personal horoscope.
Will search recursively and output the searchResult.txt in the same folder you are located.
Pick a mp3 at random and play it.
Assumes the availability of locate with an updated db and mpg123
Not the most useful command I guess, but all of the really useful ones are taken...
This command is very helpful when we need to duplicate a test scenario and first we want to find out the installed libraries together with the version and release numbers and architecture. (look example)
Command can be tuned by choosing just the names of libraries we are interested in. For example glibc and gcc.
this will increase the volume by 2 decibels on the pcm channel. the argument to -c is for which sound card to use, the arg after set is the channel (PCM, Master, etc.) and what to set by.
amixer -c 0 set PCM 2dB-
decrease volume by 2 decibels
amixer -c 0 set PCM toggle
this is for alsa systems
for mac os (and maybe other UNIX systems) osascript -e 'set Volume *' where * is any number (can have decimal points) between 0 and 10
This is equivalent to: less `which rcsyslog`
grep ERROR *.log
-bash: /bin/grep: Argument list too long
echo *.log | xargs grep ERROR /dev/null
after a terminal gets clobbered (like after you cat a binary file by accident), this is the only way to get it back without re-starting it.
It takes a hunk and shows the different between the three file. Useful when you want to compare two different changed file which from the same base file.
(use emacs ediff3, eyecandy and more useful if you want to merge them from anywhere to anywhere)
The file myfile is owned by tom and has read and write permissions for tom. Group and other permissions are empty which make myfile readable and writable only by tom. setfacl enables user tom to give read permission to user john only. The command 'ls -l' shows a '+' sign telling us that file access control list has been setup for myfile.