linux命令学习汇总

创建文件夹
mkdir test01

创建文件
touch test01.txt

查看文件(当前屏展示)
more test01.txt

查看文件(文件全部内容)
cat test01.txt

修改文件
vim test01.txt

修改后保存
:wq

修改后不保存
:q!

从root切换用户至lye
su - lye  

从lye切换至root需要密码
su - root 

搜索
grep "" test01.txt

查询grep的帮助
man grep

删除文件夹及内容
rm -rf test01

清屏
clear

创建用户
useradd abc
passwd 123

改变用户组
chgrp lye test01

改变文件所有者
chown lye test01

改变文件权限
chmod lye test01

查找一个文件夹下的目录结构
find tmp -type f

查看当前文件夹所在目录结构
pwd

解压文件
unzip mampbusi.war -d mampbusi

查询被占用的端口
lsof -i:端口号

netstat -apn | grep 4040

杀掉端口:
kill -9 端口

查询服务进程
ps aux | grep mampbusi

查看当前目录全部文件大小
ls -lht

查看某一个文件大小
ls -lh app.log

查看磁盘空间(以M为单位)
df -m

修改当前用户密码
passwd

上传下载文件(没有需要先安装)
安装指令:
yum install lrzsz

上传指令:
rz

下载指令:
sz

下载的内容存储在X/Y/Zmodem下
清空文件中的内容
:>test.txt

>test.txt



猜你喜欢

转载自liushuiwuyan.iteye.com/blog/2281702
今日推荐