# Linux Command ## basic terminal command | | | | ---------------------------- | ------------------------------------------------------------ | | `. ` | current folder当前文件夹 | | `chmode +r` | read | | `chmode +w` | write | | `chmode +x` | execute | | `gedit` | open in text editor | | `rm -r a/` |remove a directory. | | `rm -f a.txt` |remove a file. | | `rm -rf` | **never use this!** recursively and forcibly remove a directory without prompting for comfimations.| | `rm -rf /` | **never use this!** this will delete all the files| | shift+alt+i 全部 | 选择全部 | | CTRL+R | typing Ctrl-R to invoke a recursive search of your command history | | find . -name VirtualSerial.h | 查找文件 | | grep -r "qsort" | | | gcc --print-file-name=libc.a | 找到libc.a的位置 | ## vim command | command | | | ------- | ------------- | | `:wq` | save and quit | | | | | | | ## File management 文件管理 | | | | --------------------------------------------- | ------------------------------------------- | | rmdir | delete a directory | | `sudo chmod +x /usr/local/bin/docker-compose` | Apply executable permissions to the binary: | | | | | | | ### chmod `chmod`是change mode的缩写 Linux/Unix 的文件调用权限分为三级 : 文件所有者(Owner)、用户组(Group)、其它用户(Other Users)。 ![img](https://www.runoob.com/wp-content/uploads/2014/08/file-permissions-rwx.jpg) #### 语法 ``` chmod [-cfvR] [--help] [--version] mode file... ``` #### 参数说明 mode : 权限设定字串,格式如下 : ``` [ugoa...][[+-=][rwxX]...][,...] ``` 其中: - u 表示该文件的拥有者,g 表示与该文件的拥有者属于同一个群体(group)者,o 表示其他以外的人,a 表示这三者皆是。 - \+ 表示增加权限、- 表示取消权限、= 表示唯一设定权限。 - r 表示可读取,w 表示可写入,x 表示可执行,X 表示只有当该文件是个子目录或者该文件已经被设定过为可执行。 其他参数说明: - -c : 若该文件权限确实已经更改,才显示其更改动作 - -f : 若该文件权限无法被更改也不要显示错误讯息 - -v : 显示权限变更的详细资料 - -R : 对目前目录下的所有文件与子目录进行相同的权限变更(即以递归的方式逐个变更) - --help : 显示辅助说明 - --version : 显示版本 ### tree `tree -L 2`: list the tree of the current directory with two layers. ## Change Default python: > change the default python to python 3 `sudo apt-get install python-is-python3`