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.
» 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:
Beeps on mouse's every move. Bear in mind that, at least on Ubuntu, /dev/input/mice can be read only by root.
I rarely use the system menu to start applications. I use keyboard shortcuts instead. Keyboard shortcuts are convenient time savers. To configure the shortcuts I use gconf-editor or CompizConfig Settings Manager (if I have Compiz turned on). Lately I've been using Chromium as my browser. Since Chromium is under heavy development it occasionally becomes unusable and I have to switch back to Firefox. I was hard-coding the browser command in my keyboard shortcuts. This became problematic with frequent browser hopping. I now use the xdg-open command when defining my keyboard shortcuts. xdg-open opens a file or URL in the user's preferred application. In the metacity keybinging_commands I have xdg-open http://gmail.com
where I used to have firefox http://gmail.com
. Now when switching browsers I don't have to update each keyboard binding command I just change my default browser in Ubuntu by clicking through the menu: System / Preferences / Preferred Applications / Web Browser. xdg-open
is more convenient for this browser hopper.
Infinitely plays beeps with sinusoidally changing sound frequency. Ideal for alarm on an event.
I spent a bunch of time yesterday looking for the xsel package in Cygwin- turns out you can use the /dev/clipboard device to do the same thing.
If you just want to write or append some text to a file without having to run a text editor, run this command. After running the command, start typing away. To exit, type . on a line by itself.
Replacing the >> with a single > will let you overwrite your file.
print multiple increasing years using cal - calendar -. You can also try
seq Start Increment End
It's the same command as submitted, but first with a command to make all characters green. It's the only way it looked "matrix-like" on my gnome-terminal.
gemInst.sh:
#!/bin/bash
for i in [email protected]; do
if [ "$1" != "$i" ]
then
echo /newInstall/gem install $1 -v=\"$i\"
/newInstall/gem install $1 -v="$i"
if [ "$?" != "0" ]
then
echo -e "\n\nGEM INSTALL ERROR: $1\n\n"
echo "$1" > gemInst.err
fi
fi
done
When you use a "for" construct, it cycles on every word. If you want to cycle on a line-by-line basis (and, well, you can't use xargs -n1 :D), you can set the IFS variable to .
In my job I often have to deal with moving 100,000 files or more. A mv won't do it because there are too many. This will move everything in the current directory to the target path.
add it in ~/.bashrc
install bash-completion