【Raspberry Pi入门系列2】Raspbian/Linux终端常用命令
筒子们我又来啦~~~我又来分享我第二周的笔记啦~~~
这门课的名字叫The Raspberry Pi Platform and Python Programming for the Raspberry Pi~
详细地址戳这个:
https://www.coursera.org/learn/raspberry-pi-platform/home/week/2
这周讲到了Raspbian的shell,在Linux/Raspbian上叫bash(bourne again shell),在Raspbian的控制台就是terminal(终端)。
终端一般是text-based的,能做很多graphics-based的应用不方便做的控制,记住一些常用的终端命令能帮助我们更好地使用Raspberry Pi哦~
首先介绍如何机智地了解command……
答案就是:
<font size="3" face="微软雅黑">man + - show info(manual) about the command</font>比如说,我们在终端输入
<font size="3" face="微软雅黑">man pwd
</font>显示结果就是这样的:
所以下次要查任何命令(command)的用法的时候都可以在前面加个man, - - 然后详细用法就都给你显示出来了有木有!
然后退出直接输
<font size="3" face="微软雅黑">q
</font>就好啦。
下面是一些常用的终端命令(其中“+”只代表空格;[]是自己写的内容):
General:
<font size="3" face="微软雅黑">pwd // show current directory
cd + // move to the directory
cd .. //move to the up directory
ls // list of the files in the directory
ls -l // list(long-form)
mkdir + // make new directory
rmdir + // remove the directory</font>
Creating Files:
Raspbian上有个默认的command line text editor,叫Nano。当然你也可以下载Emacs、vim等其他text editor。
进入Nano编辑文档,输入
<font size="3" face="微软雅黑">nano
</font>即可。
Accessing Files(只在txt上亲测过有用,其他文件会乱码):
<font size="3" face="微软雅黑">cat + // print the content
head + // print the first 10 lines
tail + // print the last 10 lines
head -20 + // print the first 20 lines
cp + + // copy
mv + + // rename if the new name if newly defined; remove if the new name if previously defined.
</font>
File Permissions:
Access permission有三种:r - read; w - write; x - execute
owner有三种:user; group; other(everyone)
在terminal中输入
<font size="3" face="微软雅黑">ls -l</font>显示详情如下:
然后我们就可以知道各个用户的权限了有木有啊有木有!!
Root Account:
所谓root,就是获得highest permission level,并且能够access key files and directories.
想获得root权限?
戳下贴:
http://jingyan.baidu.com/article/11c17a2c438f5ef446e39d89.html
然而一般我们并不需要获取完全的root权限,所以我们在command前面可以用
<font size="3" face="微软雅黑">sudo</font>这样就是对a single command使用root权限啦。
Process:
Linux(以及其他多数操作系统)都是进行多线程(multiple processes)的。有的是foreground的,有的是background的,只是切换太快因此我们都无法感受到……
输入
<font size="3" face="微软雅黑">ps a</font>然后我们就能知道现在有哪些进程正在运行啦。
输入
<font size="3" face="微软雅黑">kill + </font>就能结束该进程啦。
输入
<font size="3" face="微软雅黑">shutdown</font>直接关机……
GUI:
如果你用的是老版的raspbian,那么开机输完密码后再输入
<font size="3" face="微软雅黑">startx</font>就能进入友好的图形化界面(zhuo mian)了~
以上就是这门课第二周的成果。
沙发!!!!! 板凳!!!!!!!!! 地板也是我的……{:5_130:} 统统都是你的 大连林海 发表于 2016-3-10 07:31
统统都是你的
{:5_146:} {:5_173:} dsweiliang 发表于 2016-3-12 08:18
{:5_124:} dsweiliang 发表于 2016-3-12 08:18
{:5_124:} dsweiliang 发表于 2016-3-12 08:18
{:5_124:}
页:
[1]