Linux- common base command (continually updated)

Summary of some of the commands of their own writing, for white

1, view server time

date

2, view the current date (calendar format)

cal
cal 2016 --查看2016全年日历
cal 1 2016 --查看2016年1月份

3, directory operations

pwd 查看当前目录
cd / 跳到总目录
cd .. 退回上一层文件夹
ls 显示当前目录下所有文件

image.png

ls -l 显示目录下所有文件详细信息,打开后首字母如果为d,如drwxr-xr-x,则该条文件为文件夹,否则为文件,

The following picture, the first for the folder, three files
1579502844(1).jpg
4, create / delete folders

mkdir 当前目录下创建文件夹
rmdir 移除文件夹

5. Copy the file to determine similarities and differences

cp ray.txt file.txt 复制一份ray文件,文件名为file
diff ray.txt file.txt 判断两份文件是否一致,一致的话无输出结果,有差异则输出两者差异的地方

6, view the file contents

cat 查看目标文件里面有哪些文件,不用进入文件
head ray.txt -n 5 查看ray前五行内容
tail ray.txt -n 5 查看最后五行内容

image.png

wc   wordcount的缩写,查看文件的内容总概,格式为 【行  单词数 字符数】
wc -w  查看多少单词
wc -l  查看有多少行
wc -c 查看大小

image.png

Released four original articles · won praise 6 · views 2325

Guess you like

Origin blog.csdn.net/weixin_38179563/article/details/104055050