linux命令

Linux 命令

一 查看端口

netstat -anp |grep {port}
netstat -tunlp |grep {port}
netstat -tulp |grep {port}
lsof -i: {port}
echo “” | telnet ip port

二 vi/vim 操作

a 输入
ESC 命令模式
:set nonu 取消行号

三 常规操作

cat
tail
head
less
more
mv
cp
scp
sed
awk
crontab
xargs
nohup
cut
find
grep
watch
mkdir
touch


四 机器的资源


查看CPU个数:cat /proc/cpuinfo | grep “physical id” | uniq | wc -l
查看CPU核数:cat /proc/cpuinfo | grep “cpu cores” | uniq
查看CPU型号:cat /proc/cpuinfo | grep ‘model name’ |uniq
查看内存总数:cat /proc/meminfo | grep MemTotal
ps -ef |gerp 进程号
top


五 解压和压缩


压缩
tar –cvf jpg.tar *.jpg //将目录里所有jpg文件打包成tar.jpg
tar –czf jpg.tar.gz *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用gzip压缩,生成一个gzip压缩过的包,命名为jpg.tar.gz
tar –cjf jpg.tar.bz2 *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用bzip2压缩,生成一个bzip2压缩过的包,命名为jpg.tar.bz2
tar –cZf jpg.tar.Z *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用compress压缩,生成一个umcompress压缩过的包,命名为jpg.tar.Z
rar a jpg.rar *.jpg //rar格式的压缩,需要先下载rar for linux
zip jpg.zip *.jpg //zip格式的压缩,需要先下载zip for linux

解压
tar –xvf file.tar //解压 tar包
tar -xzvf file.tar.gz //解压tar.gz
tar -xjvf file.tar.bz2 //解压 tar.bz2
tar –xZvf file.tar.Z //解压tar.Z
unrar e file.rar //解压rar
unzip file.zip //解压zip

总结
1、.tar 用 tar –xvf 解压
2、
.gz 用 gzip -d或者gunzip 解压
3、.tar.gz和.tgz 用 tar –xzf 解压
4、.bz2 用 bzip2 -d或者用bunzip2 解压
5、
.tar.bz2用tar –xjf 解压
6、.Z 用 uncompress 解压
7、
.tar.Z 用tar –xZf 解压
8、.rar 用 unrar e解压
9、
.zip 用 unzip 解压


六 清空日志


$ : > filename
$ > filename
$ echo “” > filename
$ echo > filename
个人推荐最简单的方式,直接 > filename.

cat /dev/null > file.log
**

七 命令上传文件*

**
机器的 接收端
nc -lp {port} > global.conf
端口指定一个没有被占用的 global.conf这个是你要上传的文件
本地的终端 发送端
nc {机器IP} {port} < global.conf
接收的ip+port
注意的大于号和小于号的方向
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值