The Unix Tools Are Your Friends
The Unix Tools Are Your Friends
Diomidis Spinellis
IF, ON MY WAY TO EXILE ON A DESERT ISLAND, I had to choose between an IDE and the Unix toolchest, I’d pick the Unix tools without a second thought. Here are the reasons why you should become proficient with Unix tools.
First, IDEs target specific languages, while Unix tools can work with anything that appears in textual form. In today’s development environment, where new languages and notations spring up every year, learning to work in the Unix way is an investment that will pay off time and again.
Furthermore, while IDEs offer just the commands their developers conceived, with Unix tools you can perform any task you can imagine. Think of them as (classic pre-Bionicle) Lego blocks: you create your own commands simply by combining the small but versatile Unix tools. For instance, the following sequence is a text-based implementation of Cunningham’s signature analysis—a sequence of each file’s semicolons, braces, and quotes, which can reveal a lot about the file’s contents:
for i in *.java; do
echo -n "$i: "
sed 's/[^"{};]//g' $i | tr -d '\n'
echo done
In addition, each IDE operation you learn is specific to that given task—for instance, adding a new step in a project’s debug build configuration. By con- trast, sharpening your Unix tool skills makes you more effective at any task. As an example, I’ve employed the sed tool used in the preceding command sequence to morph a project’s build for cross-compiling on multiple processor architectures.
176 97 Things Every Programmer Should Know

Unix tools were developed in an age when a multiuser computer had 128KB of RAM. The ingenuity that went into their design means that nowadays they can handle huge data sets extremely efficiently. Most tools work like filters, processing just a single line at the time, meaning that there is no upper limit in the amount of data they can handle. You want to search for the number of edits stored in the half-terabyte English Wikipedia dump? A simple invocation of
grep ‘’ | wc –l
will give you the answer without sweat. If you find a command sequence gen- erally useful, you can easily package it into a shell script, using some uniquely powerful programming constructs, such as piping data into loops and condi- tionals. Even more impressively, Unix commands executing as pipelines, like the preceding one, will naturally distribute their load among the many pro- cessing units of modern multicore CPUs.
The small-is-beautiful provenance and open source implementations of the Unix tools make them ubiquitously available, even on resource-constrained platforms, like my set-top media player or DSL router. Such devices are unlikely to offer a powerful graphical user interface, but they often include the BusyBox application, which provides the most commonly used tools. And if you are developing on Windows, the Cygwin environment offers you all imag- inable Unix tools, both as executables and in source code form.
Finally, if none of the available tools matches your needs, it’s very easy to extend the world of the Unix tools. Just write a program (in any language you fancy) that plays by a few simple rules: your program should perform just a single task; it should read data as text lines from its standard input; and it should dis- play its results unadorned by headers and other noise on its standard output. Parameters affecting the tool’s operation are given in the command line. Fol- low these rules, and “yours is the Earth and everything that’s in it.”
The Unix Tools Are Your Friends的更多相关文章
- Cross-platform Tools
MinGW和Cygwin都解决了C++跨平台交叉编译的问题,使Linux下的程序在Windows上编译运行成为可能. MinGW给习惯在Linux上开发的人员在windows上提供了一套类似的工具集: ...
- 让 ASP.NET vNext 在 Mac OS 中飞呀飞。。。
写在前面 阅读目录: 娓娓道来 Install ASP.NET vNext Command Line Tools 安装 Homebrew 使用 Homebrew,安装 KVM Install Subl ...
- 生成lua的静态库.动态库.lua.exe和luac.exe
前些日子准备学习下关于lua coroutine更为强大的功能,然而发现根据lua 5.1.4版本来运行一段代码的话也会导致 "lua: attempt to yield across me ...
- VS2012使用Git并连接到osc@git
1.下载GitExtensions并安装 在http://sourceforge.net/projects/gitextensions/files/latest/download 下载 安装时请注意 ...
- 【Docker 在 windows 10 / windows 8 下安装】
步骤: 1. 下载: a.https://github.com/boot2docker/windows-installer/releases 下载一个 windows 客户端: 安装时建议勾选:Boo ...
- Nginx初学者指南
Starting, Stopping, and Reloading Configuration To start nginx, run the executable file. Once nginx ...
- Django开发博客- 部署
安装Git Git是一个被大量程序员使用的”版本控制系统”.此软件可以跟踪任何时间文件的改变,这样你以后可以随时召回某个特定版本. windows系统下面可以下载git-scm安装.除了第5步”Adj ...
- 命令行工具cmder
1.下载地址 http://bliker.github.io/cmder/ 分为两个版本:mini版和Full版 2.快捷命令配置: 比如,快速启动canssandra/redis数据库服务和查询工具 ...
- Beginner’s Guide(开始者向导)
This guide gives a basic introduction to nginx and describes some simple tasks that can be done with ...
随机推荐
- 服务端指南 数据存储篇 | 聊聊 Redis 使用场景(转)
作者:梁桂钊 本文,是升级版,补充部分实战案例.梳理几个场景下利用 Redis 的特性可以大大提高效率. 随着数据量的增长,MySQL 已经满足不了大型互联网类应用的需求.因此,Redis 基于内存存 ...
- HDU1009:FatMouse' Trade(初探贪心,wait)
FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containi ...
- Python与数据结构[4] -> 散列表[0] -> 散列表与散列函数的 Python 实现
散列表 / Hash Table 散列表与散列函数 散列表是一种将关键字映射到特定数组位置的一种数据结构,而将关键字映射到0至TableSize-1过程的函数,即为散列函数. Hash Table: ...
- 洛谷——P1405 苦恼的小明
P1405 苦恼的小明 题目描述 黄小明和他的合伙人想要创办一所英语培训机构,注册的时候要填一张个人情况的表格,在身高一栏小明犯了愁. 身高要求精确到厘米,但小明实在太高了,无法在纸上填下这么长的数字 ...
- 微信小程序开发教程(一)准备
1.成为微信公众平台开发者 成为微信公众平台的开发者,是小程序开发的首要条件.只有成为微信公众平台的开发者,才可以使用公众平台的各种开发接口.如果你已经是开发者,则可以跳过本章. ①.进入微信公众平台 ...
- luogu P1313 计算系数
二项式定理 组合数取膜 费马小定理 #include<iostream> using namespace std; #define mod 10007 #define int long l ...
- 【Floyd】【Dilworth定理】【最小路径覆盖】【匈牙利算法】bzoj1143 [CTSC2008]祭祀river
Dilworth定理,将最长反链转化为最小链覆盖.//貌似还能把最长上升子序列转化为不上升子序列的个数? floyd传递闭包,将可以重叠的最小链覆盖转化成不可重叠的最小路径覆盖.(引用:这样其实就是相 ...
- [CF930E]/[CF944G]Coins Exhibition
[CF930E]/[CF944G]Coins Exhibition 题目地址: CF930E/CF944G 博客地址: [CF930E]/[CF944G]Coins Exhibition - skyl ...
- Exercise02_09
import javax.swing.JOptionPane; public class Acceleration { public static void main(String[] args){ ...
- 使用IDEA创建package
1)使用IDEA创建java工程 什么也不选,直接点击Next 无脑继续下一步 点击“Finish”完成工程的创建. 2)在使用IDEA创建了工程之后,首先选中“src”文件夹,然后 紧接着输入包名 ...