命令

  • ls: 显示当前路径下的文件和文件夹
  • cd: 改变路径
  • mkdir: 创建新的文件夹
  • cp: 复制文件或文件夹
  • mv: 移动或者重命名文件或文件夹
  • rm: 移除文件或文件夹

更多命令见Terminal Commands

基本命令

登陆后的界面如下所示:

1
2
Last login: Tue Mar 29 16:36:10 on ttys001
shihchosen@Shihs-MacBook-Air Â ~   master ●✚ 

当前路径

运行

1
pwd

结果:

1
/Users/shihchosen

1
cd Documents/
1
2
3
4
5
6
7
8
9
10
11
12
13
shihchosen@Shihs-MacBook-Air  ~/Documents   master ●✚  ls
$RECYCLE.BIN
2.University_Contest_Data_Description.pages
2000px-ASCII-Table-wide.svg.png
Chow
Default.rdp
E-book
Github
LaTeX
MATLAB
Parallels
R
RClub

工作控制

1
ps -ax

上面的命令(process status)会返回所有的活动的窗口

1
2
3
4
5
6
7
8
9
10
11
12
PID TTY TIME CMD
1 ?? 13:18.53 /sbin/launchd
45 ?? 5:37.01 /usr/sbin/syslogd
46 ?? 2:05.03 /usr/libexec/UserEventAgent (System)
48 ?? 0:34.10 /usr/libexec/kextd
49 ?? 4:42.65 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/Support/fs
53 ?? 0:18.39 /System/Library/CoreServices/appleeventsd --server
54 ?? 3:31.69 /usr/libexec/configd
56 ?? 0:34.87 /System/Library/CoreServices/powerd.bundle/powerd
62 ?? 3:18.67 /usr/libexec/airportd
63 ?? 0:12.91 /usr/libexec/warmd
65 ?? 12:08.62 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Support/mds

用户名和用户位置

whoami返回当前用户名

1
2
[shihchosen@Shihs-MacBook-Air  ~/Documents   master ●✚  whoami
shihchosen

hostname返回当前主机名(位置)

1
2
[shihchosen@Shihs-MacBook-Air  ~/Documents   master ●✚  hostname
Shihs-MacBook-Air.local