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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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:
this works on Solaris, so not better than the "only-GNU"-tool :-(
I think, there is no one-liner for this, that will work on all *nix-es
- convert unixtime to human-readable with awk
- useful to read logfiles with unix-timestamps, f.e. squid-log:
sudo tail -f /var/log/squid3/access.log | awk '{ print strftime("%c ", $1) $0; }
Uses the data in the /proc system, provided by the acpid, to find out the CPU temperature. Can be run on systems without lm-sensors installed as well.
This will download a Youtube playlist and mostly anything http://code.google.com/apis/youtube/2.0/reference.html#Video_Feeds
The files will be saved by $id.flv
Sqlite database keeps collecting cruft as time passes, which can be cleaned by the 'vacuum;' command. This command cleans up the cruft in all sqlite files relating to the user you have logged in as. This command has to be run when firefox is not running, or it will exit displaying the pid of the firefox running.
"cut" the user names from /etc/passwd and then running a loop over them.
allows you to use floating point operations in shell scripts
Enable 'sleep' function in Windows environment where this does not exist, although not exact in time. (there is a delay for each ping) This is a simple way to separate commands with a time-period.
Ummmm.. Saw that gem on some dead-head hippies VW bus at phish this summer.. It's actually one of my favorite ways of using bash, very clean. It shows what you can do with the cool advanced features like job control, redirection, combining commands that don't wait for each other, and the thing I like the most is the use of the ( ) to make this process heirarchy below, which comes in very handy when using fifos for adding optimization to your scripts or commands with similar acrobatics.
F UID PID PPID WCHAN RSS PSR CMD
1 gplovr 30667 1 wait 1324 1 -bash
0 gplovr 30672 30667 - 516 3 \_ sleep 3
1 gplovr 30669 1 wait 1324 1 -bash
0 gplovr 30673 30669 - 516 0 \_ sleep 5
1 gplovr 30671 1 wait 1324 1 -bash
0 gplovr 30674 30671 - 516 1 \_ sleep 7
This is helpful for shell scripts, I use it in my custom php install script to schedule to delete the build files in 3 hours, as the php install script is completely automated and is made to run slow.
Does require at, which some environments without crontab still do have.
You can add as many commands to the at you want. Here's how I delete them in case the script gets killed. (trapped)
atq |awk '{print $1}'|xargs -iJ atrm J &>/dev/null
Very very cool list of quotations and directives on pythonic programming. I love them and they are sure applicable in C++ too, and for most any programming, really.
This will email user@example.com a message with the body: "rsync done" when there are no processes of rsync running. This can be changed for other uses by changing $(pgrep rsync) to something else, and echo "rsync done" | mailx user@example.com to another command.
Gets the internal and external IP addresses of all your interfaces, or the ones given as arguments
The Linux kernel uses unused memory in caches. When you execute "free" you never get the "real" available memory.
This command uses mutt to send the mail. You must pipe in a body, otherwise mutt will prompt you for some stuff. If you don't have mutt, it should be dead easy to install.