Created
December 31, 2011 02:48
the (mac)linux command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terminal | |
sudo rm -r (r是递归的意思) | |
删除文件夹 | |
mv 无递归,即无mv -r | |
cp -R | |
复制文件夹 | |
man | |
search for help in the terminal | |
e.g. man open | |
open -a | |
open the applications | |
mate -h | |
the text mate application | |
rm | |
rm -r | |
删除文件夹 | |
/usr/bin 目录是terminal命令目录 | |
mv | |
剪切,重命名 | |
用户权限 | |
chmod | |
-rwxrwxrwx | |
u/g/o | |
user/group/other(其它人,但不是u和g) | |
read/write/excute | |
+/-/= | |
e.g. | |
chmod g+r file(dir) or chmod 777 file(dir) | |
ls -l 查看文件权限 | |
ls -ld 查看文件夹权限 | |
find | |
e.g. | |
find ~/Desktop -name "*.pdf" | |
如果只是搜索用spotlight很方便(ctrl + space) | |
locate | |
mvim | |
!m redo it (redo mvim) | |
if ls | |
!l redo ls | |
man du | |
du display disk usage statistics | |
2012.4.26 | |
C-l is the shortcut of clear command in terminal | |
pbpaste command: | |
paste the content to a file | |
e.g. pbpaste > cp.text | |
vim -p button.html cp.txt | |
edit two files just add the -p argument | |
:tabdo command | |
e.g. :tabdo q! :tabdo | |
find / -name php 2>/dev/null | |
can ignore "Permission denied" using 2>/dev/null | |
sudo apt-get remove xfce-* | |
通配符 * 的运用 | |
已运行命令,ctrl+z 可以让其在后台运行 | |
fg 再恢复其前台运行 | |
jobs 查看 | |
bg | |
当你有些工作比如updatedb, find等需要一定时间,这些工作可以考虑让它在后台运行,而你可以用bash做其它工作。 | |
proxy & | |
后台运行,退出了终端也没问题 | |
在我们的日常工作中,我们可以用 CTRL-z 来将当前进程挂起到后台暂停运行,执行一些别的操作,然后再用 fg 来将挂起的进程重新放回前台(也可用 bg 来将挂起的进程放在后台)继续运行。这样我们就可以在一个终端内灵活切换运行多个任务, | |
在一个bash里完成,这就需要 job control 了 | |
shell光标移动 | |
ctrl + u 删除光标前面的 | |
ctrl + k 删除光标后面的 | |
ctrl + a 光标到ahead | |
ctrl + e 光标到end | |
ctrl + p / n 前一条/后一条 | |
ctrl + c 中止 | |
ctrl + d 注销 | |
ctrl + f / b 前后移动 | |
alt + backspace 删除词 | |
ctrl + h 删除,相当于 backspace键 | |
ctrl + w 删除词,(则 alt + backspace 可以弃用了) | |
ctrl + y 恢复删除的 | |
用户管理: | |
last | |
users | wc -w | |
ifconfig | |
ip addr | |
who | |
whoami | |
sudo adduser | |
sudo deluser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment