Linux学习笔记1

Linux 操作基本指令

vi编辑文件:

:w                    /* save not exit */

:w newfilename /* save as use name "newfilename" */ 

:q                    /* exit, only the file not changed */

:q!                   /* exit not save file, all change will been give up */ 

创建文件:

$touch a.txt

如果a.txt不存在,生成一个新的空文档a.txt。如果a.txt存在,那么只更改该文档的时间信息。

$cp a.txt b.txt 

cp是copy的简写,用来复制文件。在工作目录下,将a.txt复制到文件b.txt

$rm a.txt

rm是remove的缩写,用于删除文件。删除a.txt

文件显示:

$cat filename

显示文件

$head -1 filename

显示文件第一行

$tail -5 filename

显示文件倒数第五行

$wc filename

统计文件中的字符、词和行数

$who

显示当前登陆用户

压缩文件:

$zip file.zip file1 file2

将file1和file2压缩到file.zip

$unzip file.zip

解压缩file.zip

原文地址:https://www.cnblogs.com/alansheng/p/4503496.html