linux常用指令

  • 保存ip地址
    1
    2
    3
    4
    5
    6
    sudo nano /etc/hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

    ssh

    1
    ssh name@ipname

scp

1
2
3
4
5
上传
scp -r 源地址 name@ipname:目的地址目录

下载
scp -r name@ipname:目的地址目录 源地址

./ 当前目录
~ 根目录

压缩文件指令

1
2
3
unzip 文件.zip
zip -r xxx.zip 文件目录
tar zxvf 文件

其他指令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
ps -ef|grep python   #当前运行的程序PID

tail -f out.log #持续看输出结果

cat # 文件内容

pwd # 当前文件地址

sudo passwd # 修改密码

watch

ifconfig # 端口

iwconfig # 网卡信息

df -h # 磁盘占用情况

ls -l # 详细信息

cd # 进入某文件目录

rm -f filename

具体使用

1
2
3
4
5
scp -r name@ip:/home/wkp/datasets/targe/images/bz_3647.jpg /home/wkp/wan_lab/旋转扩充数据集/YOLO_code/img

scp -r wkp@xmu_1:/home/wkp/datasets/targe/labels/classes.txt /home/wkp/wan_lab/旋转扩充数据集/YOLO_code/label

scp -r wkp@xmu_1:/home/wkp/datasets/targe/labels/3647.txt /home/wkp/wan_lab/旋转扩充数据集/YOLO_code/label

wacth

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Usage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>
-d, --differences[=cumulative] highlight changes between updates
(cumulative means highlighting is cumulative)
-h, --help print a summary of the options
-n, --interval=<seconds> seconds to wait between updates
-v, --version print the version number
-t, --no-title turns off showing the header

每隔一秒高亮显示网络链接数的变化情况

watch -n 1 -d netstat -ant 【-n 设置间隔,-d,difference,高亮显示不同】

watch -d 'ls /home/omd' 【-d 高亮显示】

watch -t 'ls /home/omd' 【-t会关闭watch命令在顶部的时间间隔】

watch -n 1 -d 'pstree|grep http'

实时查看模拟攻击客户机建立起来的连接数

watch -n 1 -d 'netstat -an | grep "21" | egrep "192.168.25.100"| wc -l'

监测当前目录中 scf' 的文件的变化

watch -d 'ls -l|grep scf'

10秒一次输出系统的平均负载

watch -n 1 -d "uptime"


看网口连接状态
watch -n 1 iwconfig wlx0ccf89606c44

wlx0ccf89606c44 IEEE 802.11 ESSID:"SSID"
Mode:Managed Frequency:2.462 GHz Access Point: EC:26:CA:2A:01:E4
Bit Rate=1 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=70/70 Signal level=-19 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:1 Invalid misc:10 Missed beacon:0