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.”

时间: 2024-10-28 14:57:54

The Unix Tools Are Your Friends的相关文章

Django开发博客- 部署

安装Git Git是一个被大量程序员使用的”版本控制系统”.此软件可以跟踪任何时间文件的改变,这样你以后可以随时召回某个特定版本. windows系统下面可以下载git-scm安装.除了第5步”Adjusting your PATH environment”, 需要选择”Run Git and associated Unix tools from the Windows command-line”(底部的选项).除此之外,默认值都没有问题. Linux系统的安装使用包管理器安装 123 sudo

Python中Unicode码和非Unicode码引起的错误与格式转换

1.1. 问题 Problem You need to deal with data that doesn't fit in the ASCII character set. 你需要处理不适合用ASCII字符集表示的数据. 1.2. 解决 Solution Unicode strings can be encoded in plain strings in a variety of ways, according to whichever encoding you choose: Unicode

Something About Perl

Perl is a high-level , general-purpose,interpreted ,dynamic programming language . It was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier . It borrows features from other progra

Git简介、安装与配置

老规矩QAQ,先来简单介绍一下Git: Git是一个分布式版本控制系统,可以理解为是一个用于管理代码,控制版本,方便多人合作开发的一款工具. Git:分布式版本控制系统. SVN.CVS:集中式版本控制系统. 分布式和集中式的区别: 1) 集中式:简单来说,版本库是放到中央服务器的,想要修改就要先从中央服务器取得最新的版本,然后开始编写代码,工作结束,再把自己编写的代码推送给中央服务器.集中式版本控制系统最大的毛病就是需要联网才能工作,网速好的话还行,遇到网速差的,提交代码就会变得非常慢. 2)

MinGW and Cygwin – An Introduction and Differences

If you are using Linux and your are a big fan of shell and its other utilities like grep, ls, make and its compilers gcc and g++, and if you want these utils on Windows platform, then this articles is for you. Even if you are not a developer, but sti

grub的编译安装

grub的编译安装比较容易.首先下载grub的源代码,然后解压,查看INSTALL文件, 下面是INSTALL文件的一部分,是有关依赖的: The Requirements================ GRUB depends on some software packages installed into your system. Ifyou don't have any of them, please obtain and install them beforeconfiguring t

在Windows下编译Lua

http://blog.csdn.net/yue7603835/article/details/41739085 http://blog.csdn.net/birdflyto206/article/details/49403801 Building Lua on other systems If you're not using the usual Unix tools, then the instructions for building Lua depend on the compiler

MinGW & Cygwin

MinGW和Cygwin都解决了C++跨平台交叉编译的问题,使Linux下的程序在Windows上编译运行成为可能. MinGW给习惯在Linux上开发的人员在windows上提供了一套类似的工具集:Cygwin主要是对于在Linux的程序,无需改动代码即可移植到windows上:gnuwin32主要是对习惯linux工具的人员,在windows上提供一套类似的命令. Unix下编译通过的C代码,在win32下编译是不能通过的 ,当然Unix和win32的API都符合标准C,即大多数函数调用在u

机器学习常用算法总结

机器学习&数据挖掘 前言: 找工作时(IT行业),除了常见的软件开发以外,机器学习岗位也可以当作是一个选择,不少计算机方向的研究生都会接触这个,如果你的研究方向是机器学习/数据挖掘之类,且又对其非常感兴趣的话,可以考虑考虑该岗位,毕竟在机器智能没达到人类水平之前,机器学习可以作为一种重要手段,而随着科技的不断发展,相信这方面的人才需求也会越来越大. 纵观IT行业的招聘岗位,机器学习之类的岗位还是挺少的,国内大点的公司里百度,阿里,腾讯,网易,搜狐,华为(华为的岗位基本都是随机分配,机器学习等岗位