Linux常用命令学习笔记:常用命令

Linux常用命令学习笔记:常用命令

1.find基本使用方法

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格式压缩包的解压与压缩基本使用方法

压缩包管理:

  1. zip管理命令
  2. gzip与gunzip
  3. rar
  4. tar高级打包命令

zip格式压缩包

zip -r bb.zip bb hello   # 将bb文件夹和hello文件打包成bb.zip
zip -rf bb hello 
unzip bb.zip

gz格式压缩包

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后缀文件安装来软件
  • 源代码安装

apt-get安装

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

ifconfig

查看ip信息,eth0代表本地第一块网卡

sudo ifconfig eth0 ip

ping

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.110

netstat -an | grep port号 查看网络连接状态

netstat -an| grep 80

5.常用指令

date日期指令

kylepade@Ubuntu:~$ date  # 
20211018日 星期一 07:47:29 CST

umask 文件权限补码

umask -S
umask

echo 输出变量或字符串

echo $BASH
echo hello

alias 命令

alias -l 

关机重启:
立即关机:shutdown -h now
关机:init 0
关机:powerof
重启:reboot

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

少年沛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值