查看文件夹大小:
du -h –max-depth=1
给 ubuntu 17.10 虚拟机设置静态ip:
编辑 /etc/netplan/01-netcfg.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 | # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no dhcp6: no addresses: [192.168.8.95/24] gateway4: 192.168.0.1 nameservers: addresses: [8.8.4.4] |
Linux创建swap分区(用文件作为Swap分区)
1.创建要作为swap分区的文件:增加1GB大小的交换分区,则命令写法如下,其中的count等于想要的块的数量(bs*count=文件大小)。
1 | dd if=/dev/zero of=/root/swapfile bs=1M count=1024 |
2.格式化为交换分区文件:
1 | mkswap /root/swapfile #建立swap的文件系统 |
3.启用交换分区文件:
1 | swapon /root/swapfile #启用swap文件 |
4. SCP 传输文件
1 | SCP [-i /key-path] file user@remote:/directory |
5. 查看文件前几行,后几行
1 2 | head -n 10 /path/to/file tail -n 10 /path/to/file |