Command line tools for web developers
coderholic.com
coderholic.com
It lets you monitor the progress of any piped command and gives you time elapsed, speed, time left, and a progress bar (wget style).
Copy a file:
pv sourcefile > destfile
Import mysql db: pv dump.sql| mysql -uroot -p db
More tricks: http://blog.urfix.com/9-tricks-pv-pipe-viewer/edit: To install on OS X just do
brew install pvIt provides a great suite of tools for interacting with S3, and is best used on an EC2 instance you are connected to via SSH. It is also ridiculously fast, much faster than trying to interact with S3 from a local FTP browser, or even from Amazon's own S3 dashboard. For example on my computer using Amazon's own web facing dashboard it will take about 30-45 minutes to make 14000 files on S3 public, versus via the command line tool downloaded and running on one of my EC2 instances it can make those files public within minutes.
I assume this is because it is local network traffic. Anyway, if you are ever in a bind and need to move a bunch of files to S3, I highly recommend S3 Tools. It has saved me many times.
Along those lines wget is the most powerful command line tool I've ever used, with so much capability. It is simply incredible when combined with S3 tools, allowing you to easily grab gigabytes of images off of a personal server or staging location and upload them to S3 very quickly.
And if you need to do more than move files around you can manage even more aspects of AWS including EC2 instances from the command line using this powerful command line tool:
Its great for writing automated bash scripts to manage your instances via cron jobs.
nice s3cmd ...
trickle -u 10 -d 20 ncftp
This runs ncftp capped at 10 KB/s up, 20 KB/s down. alias myip="curl icanhazip.com"
Apachebench (ab) is a decent alternative to siege, and knowing how to use tcpdump and netcat comes in handy for debugging. Other than that, my new favorite command line tool over the past several months has to be vagrant, which lets you script and streamline VM creation and builds from the command line. If I need to completely reproduce my production environment on a test box, it's my utility of choice.Questions:
- Is there a site pointing out amazing command line tools like this? (their existence as opposed to usage examples like at http://www.commandlinefu.com/)
- Is there a site listing the OS X equivalents for Linux command line tools? (e.g. what's the OS X equivalent for dos2unix / flip?)
(edit: merge 2 comments into 1)
I actually found dtrx on hacker news though a few years ago, but it's also on onethingwell I believe.
tar xf archive.tar.gz
tar xf archive.tar.bz2
Still, this will be useful for other formats, I think. Thanks. curl http://example.com/foo.tar.gz | tar zxf -for eg.
lftp :~> pget -c -n 10 http://warez.com/large_file.mp4
will start 10 concurrent download processes (n) and continue (c). lftp is full of hidden gems.Sometimes I migrate URL schemes, and set up permanent redirects in my .htaccess files. Testing them in a browser is a real pain, because browsers cache the redirect (which is the point of having a permanent redirect), so even if you change the .htaccess, you still get the old response. And pressing the refresh button is no help, because that reloads the destination page, not the source of the redirect.
That's when a non-caching command line client saves your day.
I find it amazingly useful.
Screen also detaches the console from your ssh session. In my case this means that the servers keep running if I loose my ssh connection to the (hardware) server.
It's a very handy tool and definitely belongs in the articles list of tools.
screen -d -m processName
is practically the easiest way to run and daemonize a process. nohup processNameThe biggest difference between tmux and screen is that tmux is a lot more flexible with regard to laying out groups of sub-terminals within the main terminal. screen is mostly limited to one-at-a-time, horizontal splitting or (in very recent versions) vertical splitting, while tmux lets you go nuts: http://tmux.sourceforge.net/tmux3.png
Also, GNU screen is very old and stable, while tmux is (so far) still new and flexible. For example, tmux very quickly added support for handling Unicode characters beyond U+FFFF, a feat that (so far as I know) screen still can't manage. That's only one example, but I'm sure there'll be more as time goes on.
EDIT: One other thing that tmux does that makes it better than screen: when I start up a tmux session from within an X11 session, tmux clears the $DISPLAY variable so that processes running inside tmux don't try to connect to the original X server - which may very well have gone away at that point. It's a small thing, but incredibly annoying when it happens.
Things like this are largely due to personal preferences, though. All I can tell you is that I am happier with tmux than I was with screen. It is more modern, and the split screening capabilities are better.
$ echo 'escape ^uU' > ~/.screenrc
Or I quickly start tearing my hair out and screaming profanities every time I try to do something.
If you do this, though, be careful what you paste - if it has backticks in it, screen will interpret them as escape characters.
Getting started is now two lines:
curl http://pagekite.net/pk/pagekite-0.4.py >pagekite.py
python pagekite.py 80 SOMENAME.pagekite.me
... answer a few questions and whatever is running on port 80 will be visible as https://SOMENAME.pagekite.me/ within moments, almost no matter what kind of network connection you have. :-)There are also .deb and .rpm packages available for heavier users.
But I didn't find anything else to be interesting.
wget post-file.it --post-file /path/to/file