Linux study notes-common Linux commands and vim commands

Linux commands

cd 改变目录
cd / 跳转到当前磁盘根目录
cd ~ 跳转到当前用户的home目录
cd .. 返回上一级目录
pwd 显示当前路径
ls 显示当前目录文件
ll 显示当前目录所有文件详细信息
mkdir src 创建目录
rm -r src 删除目录
rm 1.js 删除文件
touch 1.js 新建文件
mv index.html src 移动文件
reset 重新初始化终端/清屏
clear 清屏
history 查看历史命令
help 帮助
exit 退出
#代表注释

# cat写入文件
cat >test.txt << EOF
> 123
> 4567
> EOF

# cat显示文件
cat test.txt 
123
4567

vim command

Vim is a text editor developed from vi. Basically, vi/vim is divided into three modes, namely Command mode , Insert mode and Last line mode .

vi filename       //打开filename文件

 i Switch to the input mode to input characters; the
input mode is used to edit the document, press ESC  in the input mode toexit the input mode and switch to the command mode;there are the following commonly used commands in the command mode: 

:w   //保存文件
:w myfile.txt   //保存至myfile.txt文件
:q   //退出编辑器,如果文件已修改请使用下面的命令
:q!  //退出编辑器,且不保存
:wq  //退出编辑器,且保存文件

 

Guess you like

Origin blog.csdn.net/qq_14997473/article/details/109184808