- Linux常用命令学习笔记:常用命令
- 1.find基本使用方法
- option
- 具体操作:
- 2.zip、gzip、rar格式压缩包的解压与压缩基本使用方法
- zip格式压缩包
- gz格式压缩包
- rar格式的压缩包
- 3.软件安装和卸载
- apt-get安装
- dpkg根据deb安装包来安装软件
- 源代码安装
- 4.网络管理工具
- ifconfig
- ping
- nslookup 通过域名找到ip
- netstat -an | grep port号 查看网络连接状态
- 5.常用指令
- date日期指令
- umask 文件权限补码
- echo 输出变量或字符串
- alias 命令
find dir [option]option
-name 按照名字查找 -type 按照类型查找 -f 普通文件 -d 目录文件 -l 符号连接 -b 块设备 -c 字设备 -p 管道设备 -s 本地套接字 -size 按照大小 -maxdepth 到某一级具体操作:
find ./ -maxdepth 1 -size +1M
find ./ -maxdepth 1 -size +1M -exec ls -l{};
find ./ -maxdepth 1 | xargs ls -l
xargs 是find命令的好搭档
find ./ -type f | grep *.c find ./ -type f | grep "main" *c find ./ -type f | grep -rn "main" *c cat *.c | grep main grep -v connect # -v 排除过滤2.zip、gzip、rar格式压缩包的解压与压缩基本使用方法
压缩包管理:
- zip管理命令
- gzip与gunzip
- rar
- tar高级打包命令
zip -r bb.zip bb hello # 将bb文件夹和hello文件打包成bb.zip zip -rf bb hello unzip bb.zipgz格式压缩包
tar [option] 压缩包名字 -c 压缩文件 -v 显示信息 -j 其他一致 -zgz 格式 -bzip 格式
tar jcvf bb.tar.bzip2 bb tar jcxf bb.tar.bzip2
压缩
tar zcvf bb.tar.gz bb
z 压缩包 c 压缩文件 v 压缩信息 f 指定文件夹rar格式的压缩包
- -a 代表压缩
- -r 代表递归子目录
rar a -r 压缩包原料 #压缩 rar x 压缩包名字 #释放3.软件安装和卸载
安装软件主要分为以下三种方式:
- apt-get自动安装软件,需要知道软件名
- dpkg根据.deb后缀文件安装来软件
- 源代码安装
sudo apt-get update #更新源 sudo apt-get install ... # sudo apt-get remove ... #卸载命令 sudo apt-get clean #清除包dpkg根据deb安装包来安装软件
sudo dpkg -i xxx.deb #来安装包 sudo dpkg -r xxx.deb #来移除安装包源代码安装
ta r zxvf sshpass-1.05.tar.gz #解压元代码包 ls -lrt cd sshpass-1.05 #访问被解压文件 ./configure #对环境进行检查,创建makefile,检查编译环境 make #编译源代码,生成库和可执行文件 sudo make install #把库和可执行程序安装到系统路径下 sudo make distclean #删除和卸载文件4.网络管理工具
- ifconfig
- ping
- nslookup
- netstat -an|grep port
查看ip信息,eth0代表本地第一块网卡
sudo ifconfig eth0 ipping
ping -c 3 #只ping4次 ping www.baidu.com #ping 百度nslookup 通过域名找到ip
kylepade@Ubuntu:~$ nslookup > www.baidu.com Server: 127.0.0.53 Address: 127.0.0.53#53 Non-authoritative answer: www.baidu.com canonical name = www.a.shifen.com. Name: www.a.shifen.com Address: 163.177.151.109 Name: www.a.shifen.com Address: 163.177.151.110netstat -an | grep port号 查看网络连接状态
netstat -an| grep 805.常用指令 date日期指令
kylepade@Ubuntu:~$ date # 2021年 10月 18日 星期一 07:47:29 CSTumask 文件权限补码
umask -S umaskecho 输出变量或字符串
echo $BASH echo helloalias 命令
alias -l
关机重启:
立即关机:shutdown -h now
关机:init 0
关机:powerof
重启:reboot



