Unix commands in Mac OS X

参考:http://www.renfei.org/blog/mac-os-x-terminal-101.html

One command line includes 4 parts: Command Name、Options、Arguments、Extras .

man <command-name> :  Give the manual of this command.

绝对和相对路径

/ : Root directory

..  : Parent directory.

目录操作

pwd : Print working directory, which will show the absolute path of current folder.

ls  : List directory contents.      Ls –la  : List all contents including hidden contents.

cd : Change directory.

   mkdir : Make directories.

rmdir:  Remove directories.

   mvdir:  Move or rename a directory.

处理特殊字符(space, bracket, quotation mark, !, $, &, *, ;, \, …)

\ : Use back slash before the character.        cd Punlic/Drop\ Box/      ( = cd “Public/Drop Box”).

文件操作

cp  : Copy files.

mv : Move files.

rm :  Remove files

vi:  or vim :  A programmers text editor

nano:  Nano‘s another editor, an enhanced free pico clone.

   cat : Concatenate and print files.  It reads files sequentially, writing them to the standard output.

cat file1 : Will print the contents of file1 to the standard output.

cat file1 file2 > file3:  Will sequentially print the cntents of file1 and file2 to the file3.

cat file1 – file2 – file3:   ???

od:  Octal, decimal, hex, ASCII dump

less:

which:  Locate a program file in the user’s path.

find :   find . -name "*.c" -print

    file:  Determine file type.

head:  Display first lines of a file.  head -10 filename.

  tail:  Display the last part of a file.

cut:  Cut out selected portions of each lie of a flie.

colrm:  Remove columns from a file.    colrm 8 20 filename

diff: Compare files line by line.

sort: Sort lines of text file.

uniq:  Report or filter out repeated lines in a file.

comm: Select or regject lines common to two files.

wc:  Word, line, character, and byte count.

nl: Line numbering filter.        nl file1 > file2

进程操作

  ps : Process status     ps u

  kill : Terminate or signal a process.               kill -9 30142

The kill utility sends a signal to the processes specified by the pid operand(s).

     Only the super-user may send signals to other user‘s processes.

Some of the more commonly used signals:

      1  HUP (hang up)

      2  INT (interrupt)

      3  QUIT

      6   ABRT (abort)

      9  KILL (non-catchable, non-ignorable kill)

      14   ALRM (alarm )

      15  TERM (software termination signal)

时间操作: 

  date:  Display or set date and time.

  cal:  Display a calendar and the date of easter        cal 4 2015.

time: time command execution (totoal time elapsed.)

系统管理

w:  Display who is logged in and what they are doing.

  who:

whoami:

su  : Substitute user identify.

Sudo : Substitute user do, or super user do.  It allows a permitted user to execute a command as the superuser or another user.

时间: 2024-08-24 14:34:09

Unix commands in Mac OS X的相关文章

mac os x 命令+10个常用命令行工具

很多朋友对osx下的命令行操作挠头,估计多数是在windows时代开始接触计算机的.有dos基础的应该是看看就 明白,而玩过Linux的应该是轻车熟路了.这个贴子希望能给见到命令行就头大的兄弟一些帮助,所涉及到的命令基本限于安装kext,修改plist,更 换核心 所碰到的操作.如果想进一步了解Unix的命令,再网上找些关于Linux命令的文章看,有很多.高手们就免看了,不过希望能来挑挑毛病,再来补充两句... ------------------------------------------

【转】操作系统Unix、Windows、Mac OS、Linux的故事

电脑,计算机已经成为我们生活中必不可少的一部分.无论是大型的超级计算机,还是手机般小巧的终端设备,都跑着一个操作系统.正是这些操作系统,让那些硬件和芯片得意组合起来,让那些软件得以运行,让我们的世界在科技的领域里一次又一次的享受生活 我们熟知的操作系统大概都是windows系列,近年来Apple的成功,让MacOS也逐渐走进普通用户.在服务器领域,恐怕Linux是无人不知无人不晓.他们都是操作系统,也在自己的领域里独领风骚.这都还得益于另外一个古董级别的操作系统--Unix,虽然说古董级别,只是

操作系统Unix、Windows、Mac OS、Linux的故事

文章转自:http://blog.csdn.net/wenmingchan/article/details/49925379 http://www.jb51.net/os/other/159236.html 我们熟知的操作系统大概都是windows系列,近年来Apple的成功,让MacOS也逐渐走进普通用户.在服务器领域,恐怕Linux是无人不知无人不晓.他们都是操作系统,也在自己的领域里独领风骚.这都还得益于另外一个古董级别的操作系统--Unix,虽然说古董级别,只是他年纪大了,性能和功能,U

Mac OS X 中一些常用的命令行技巧

一.网络设置相关 1.网卡的物理地址的动态重置 出于某些需求,例如网络中的 IP 地址或网络帐号与网卡物理地址绑定,使得多个设备无法切换上网,可尝试临时更改物理地址.不过,系统偏好设置是不能修改网卡物理地址的,这就是命令行的用武之地了.具体来说,若心中已有想修改的物理地址,例如 00:1f:3c:93:b5:99,可执行 $ sudo ifconfig en1 ether 00:1f:3c:93:b5:99 来临时修改网卡的物理地址:若没有物理地址,只是想临时启用尝试一下,可用 openssl

Mac OS X Yosemite 10.10.3 apache+mysql+django web开发环境的搭建

准备工作: 1.确认mac os x 的版本号为10.10.3: 2.mac os x yosemite预装了apache.python,因此无需下载该包: 在shell下输入python即可查看版本: Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright"

Mac 操作系统安装 SVN server教程(Subversion With Mac OS X Tutorial)

Find recent articles on my github page: rubyrobot.github.io ? 2006-2014 Imagine Ecommerce Subversion With Mac OS X Tutorial Updated: April 2011 Subversion is a version control system that allows you to work with other people on a project and switch b

Mac 操作系统安装 SVN 服务器教程(Subversion With Mac OS X Tutorial)

Find recent articles on my github page: rubyrobot.github.io © 2006-2014 Imagine Ecommerce Subversion With Mac OS X Tutorial Updated: April 2011 Subversion is a version control system that allows you to work with other people on a project and switch b

mac os x常用快捷键及用法

最近在研究mac os x系统,开始入手,很不习惯,和windows差别很大,毕竟unix内核.使用中总结了一些使用快捷键(默认),持续更新,欢迎大家补充.1.撤销:command+z 保存:command+s 2.复制:command+c 粘贴:command+v 3.剪切文件和文件夹:首先选中文件,按command+c复制文件,然后按command+option+v就可以剪切了 剪切文本:选中文本,command+x,然后command+v 4.隐藏:command+h最小化:command

【学习笔记】Mac OS X系统介绍

一.Dock *相当于Windows的快速启动栏,用来存放常用软件的图标 *单击软件图标即可打开相应的软件 *右击软件图标还有其他菜单选项:比如退出软件 *图标下边的黑点代表程序正在运行中,并没有完全退出 *删除Dock上的软件图标 方式1-右击软件图标 方式2-将图标拖动到离Dock稍远的地方 *Dock的设置 二.退出应用程序 *方式1:右击Dock中的软件图标 *方式2-使用快捷键 快捷键退出程序:Command + Q 快捷键关闭窗口:Command + W(关闭程序的窗口不一定是退出程