【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……
答案就是:
  1. man + [command]    - show info(manual) about the command
复制代码
比如说,我们在终端输入
  1. man pwd
复制代码
显示结果就是这样的:
 
所以下次要查任何命令(command)的用法的时候都可以在前面加个man, - - 然后 详细用法 就都给你显示出来了有木有!
然后退出直接输
  1. q
复制代码
就好啦。


下面是一些 常用的终端命令 (其中“+”只代表空格;[]是自己写的内容):
General:
  1. pwd // show current directory
  2. cd + [directory path] // move to the directory
  3. cd .. //move to the up directory
  4. ls // list of the files in the directory
  5. ls -l // list(long-form)
  6. mkdir + [dir] // make new directory
  7. rmdir + [dir] // remove the directory
复制代码

Creating Files:
Raspbian上有个默认的command line text editor,叫Nano。当然你也可以下载Emacs、vim等其他text editor。
进入Nano编辑文档,输入
  1. nano
复制代码
即可。

Accessing Files (只在txt上亲测过有用,其他文件会乱码):
  1. cat + [name.txt] // print the content
  2. head + [name.txt] // print the first 10 lines
  3. tail + [name.txt] // print the last 10 lines
  4. head -20 +[name.txt] // print the first 20 lines
  5. cp + [original file name] + [new name] // copy
  6. mv + [oringinal file name] + [new name] // rename if the new name if newly defined; remove if the new name if previously defined.
复制代码

File Permissions:
Access permission有三种:r - read; w - write; x - execute
owner有三种:user; group; other(everyone)
在terminal中输入
  1. ls -l
复制代码
显示详情如下:
 
然后我们就可以知道各个用户的权限了有木有啊有木有!!

Root Account:
所谓root,就是获得highest permission level,并且能够access key files and directories.
想获得root权限?
戳下贴:
http://jingyan.baidu.com/article/11c17a2c438f5ef446e39d89.html
然而一般我们并不需要获取完全的root权限,所以我们在command前面可以用
  1. sudo
复制代码
这样就是对a single command使用root权限啦。

Process:
Linux(以及其他多数操作系统)都是进行多线程(multiple processes)的。有的是foreground的,有的是background的,只是切换太快因此我们都无法感受到……
输入
  1. ps a
复制代码
然后我们就能知道现在有哪些进程正在运行啦。
输入
  1. kill + [PID]
复制代码
就能结束该进程啦。
输入
  1. shutdown
复制代码
直接关机……

GUI:
如果你用的是老版的raspbian,那么开机输完密码后再输入
  1. startx
复制代码
就能进入友好的图形化界面(zhuo mian)了~



以上就是这门课第二周的 成果。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值