使用Linux系统,第一件事当然是学Linux命令。本篇罗列了一些基本命令。
列出内容 ls
( list 列表、列出 )
常用的选项:
1 | -A (all,显示所有,包含隐藏内容) |
选项可以组合使用:
1 | ls -lt |
文件
- 创建 touch
1
2touch a.txt
touch a.txt b.txt c.txt - 删除 rm
1
2rm a.txt
rm a.txt b.txt c.txt - 查看文本内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14cat 查看全部
用法:cat a.txt
head 查看前10(默认)行
用法:head a.txt
head -n a.txt
查看前 n 行
tail 查看末尾10(默认)行
用法:tail a.txt
tail -n a.txt
查看末尾 n 行
文件夹
- 创建 mkdir
1
2mkdir music
mkdir music movie picture - 删除 rm -r
1
2rm -r music
rm -r music movie picture