Replace the word 'war' to word 'peace' in every file in the current directory.
It uses curl --url-encode to encode long URLs *properly* and parses XML with xmlstarlet. If ~/.bitlyrc were to contain login:apikey then a script could read the apiKey and login from ~/.bitlyrc like so: login=$(sed 's/:.*//' < $HOME/.bitlyrc) apikey=$(sed 's/[^:]*://' < $HOME/.bitlyrc) curl -s --data-urlencode 'longUrl='$1 --data-urlencode 'login='$login --data-urlencode 'apiKey='$apikey 'http://api.bit.ly/shorten?version=2.0.1&format=xml' | xmlstarlet sel -T -t -m "//shortUrl" -v "." | line Show Sample Output
Instead of typing "cd ../../.." you can type ".. 3". For extremely lazy typists, you can add this alias: alias ...=".. 2" ....=".. 3" - so now you can write just .... !!! NB the .. function needs to be "source"d or included in your startup scripts, perhaps .bashrc.
This command will set bash as the default shell for all users in a FreeBSD system.
Route output to notify-send to show nice messages on the desktop, e.g. title and interpreter of the current radio stream
When you run an X program from a terminal you can see any errors. But when it's run from another X program (eg from a menu item, from your fluxbox 'keys' file etc) it might just die and you see nothing (except perhaps in .xsession-errors). Instead, launch it via this command and you'll see the termination status, stderr and stdout. eg: "xlaunch firefox" or "xlaunch 'echo stdout; echo stderr >&2; false'": 'echo stdout; echo stderr >&2; false' failed with error 1 STDERR: stderr STDOUT: stdout
This creates a persistent ssh -i /path/to/key -ND local-IP:PORT User@Server connection. You may have to install autossh. -f puts in daemon mode. if you are having trouble, try it without -f.
i spent way too many hours trying to fiddle with /etc/X11/xorg.conf trying to hook up various external projectors. too bad i didn't know this would solve all my problems.
mounts an ISO file to a directory on the target file system
This is the 140 character long new year's countdown timer that was posted to the climagic account on twitter and identi.ca. There are saner ways of doing this of course, but probably none of those would fit. Uses the figlet command, but of course you can replace figlet with just echo if you want. Show Sample Output
use '0' and '9' to increase/decrease volume. this is useful on laptops with low speaker volume.
The command will help to print the location of the pattern. Above command will print all the files which contain variable "$foo" along with line containing that pattern. Specify pattern after "grep"
see http://iptraf.seul.org/ for all kinds of documentation and screenshots
Requires Python; doesn't require a specific server to return your IP.
eliminates "l" and "o" characters change length by changing 'x' here: cut -c 1-x Show Sample Output
Slightly simpler version of previous sed command that does the same thing. In this case, the output will stop at the command, and the entire command will be terminated as well, instead of proceeding through the whole file.
If you gzip an empty file it becomes 20 bytes. Some backup checks i do check to see if the file is greater than zero size (-s flag) but this is no good here. Im sure someone has a better check than me for this? No check to see if file exists before checking it's size.
The original didn't use -print0 which fails on weird file names eg with spaces. The original parsed the output of 'ls -l' which is always a bad idea.
how to finish command or script without any output Show Sample Output
reload a configuration from .bashrc file Show Sample Output
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: