Tag: Unix预览模式: 普通 | 列表

Aug.29,Good command line usage habits and tips

If you use the command line frequently, chances are you may have some bad command line habits. IBM's DeveloperWorks site has posted 10 good UNIX usage habit tips, some of them are just pretty handy tricks in general and if you're new to the Mac OS X Terminal, you'll probably learn something since practically all of them work within the Mac OS X command line. Here's one of my personal favorites since it hit home with my command line activities:

* Change the path to unpack something into rather than moving the archive file itself, in this example by using the -C flag with the tar command:

tar xvf -C path/to/unpack newarc.tar.gz

I'm certainly guilty of moving archives around, but that's partially because I like to keep all of them in a central location. But if you're going to just delete the archive anyway, there's no point in moving the archive file around just to unpack it. Save yourself the keystrokes.

Here's the full list of tips in the IBM DeveloperWorks article:

查看更多...

Tags: Mac OSX x86 苹果 Unix

分类:迈入新年代 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 119

Aug.23,Compare 2 directories contents using diff

If you want to see the difference between two folders on a Mac, launch the Terminal and read on. Using the command line tool 'diff' you can easily compare the contents of any two directories, here's the command we'll use to achieve this:

diff -rq directory1 directory2 >> differences.txt

This executes the diff command comparing directory1 and directory2 (if you have a folder with a space in the file name, just put it in quotes like so: "folder one"), and then redirects the output of that command to a file named differences.txt. Here's an example and how the actual printout will look:

diff -rq "old music" "new music" >> musicfolders.txt

查看更多...

Tags: Mac OSX x86 苹果 Unix

分类:迈入新年代 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 165

Aug.12,Repair disk permissions from command line

You can initiate the same Repair Disk Permissions functionality that is seen in Disk Utility via the Terminal by typing the following command in the Terminal:

diskutil repairPermissions /

This will repair the disk permissions on your Mac's main drive, if you want though you can run it on another disk by specifying it rather than / at the command line. Once the command has been executed you will see a message like:

Started verify/repair permissions on disk0s2 Mac HD

The time it takes to repair the disk permissions depends on various factors, but the command will update as permissions are repaired and will end itself when diskutil is finished. If you have verified disk permissions and you find a bunch of problems, you might want to cross check them with this list from Apple for errors that you can safely ignore.

Tags: Mac OSX x86 苹果 Unix

分类:迈入新年代 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 222

Jul.24,Using Quick Look from the Command Line

Sometimes you need to Quick Look a file, but you're in Terminal or iTerm or something. If you're dealing with images, you want to see them before you do anything. But you don't want to use the open command. That's where qlmanage comes in.

qlmanage is a CLI tool that, from the manpage, is a 'Quick Look Server debug and management tool.' It's got more options than described below, but those are for developers debugging QL.

The -p option generates a preview, as if you'd tapped the Space bar in the Finder. The -t option generates thumbnails, like in Coverflow or Info For. Here, then, are typical uses of the tool:

  • qlmanage -p '/Users/Name/Music/Player.mp3'
    Generates a QL window in Terminal.
  • qlmanage -t '/Users/Name/Pictures/Image.png'
    Generates a window with a thumbnail.
  • qlmanage -p '/Users/Name/Documents/Nurse.doc' '/Users/Name/Movies/Liters.mpg'
    Generates a QL window in Terminal with a page-through option to see both docs.

Tags: Mac OSX x86 苹果 Unix

分类:迈入新年代 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 203

Mar.3,两则OS X终端命令应用小技巧

将一个文件复制到文件夹的所有子文件夹:

find <parent directory> -type d -exec cp <parent directory>/<Filename1> {}/ \;

以php.ini为例:

find . -type d -exec cp php.ini {}/ \;

-----

移除目录结构下的一个子目录,以.svn为例:

find . -name .svn -exec rm -rf \{\} \;

Tags: Mac OSX x86 苹果 Unix

分类:迈入新年代 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 340

081116,Run.Unix.apps.on.your.Mac

A quick guide to X11 – the graphical Unix interface built into Leopard
Brian Jepson

----------

If you’ve ever thought about running Unix programs on your Mac, you might have hesitated because you assumed that meant you were stuck with the command-line interface. But you aren’t.

Go to Leopard’s Applications/Utilities folder and double-click on X11.app. That will ope...

查看更多...

Tags: Mac OSX x86 苹果 Unix X11

分类:零捌征程 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 549