Think before you speak, read before you think.

Tag: linux.tips

  • dd创建大文件制作iso启动盘

    by

    in

    生成一个2GB的文件 dd if=/dev/zero of=test bs=1024k count=2048 生成一个10GB的文件 dd if=/dev/zero of=test bs=1024k count=10240 dd if=/dev/zero of=test bs=8M count=128 mac下用dd制作启动u盘 确定盘符 ➜  quick diskutil list /dev/disk0 #:                       TYPE NAME                    SIZE       IDENTIFIER 0:     …

  • linux设置静态ip及dns

    debian设置静态ip #vim /etc/network/interfaces auto eth0 iface eth0 inet static address 219.230.144.244 netmask 255.255.255.192 gateway 219.230.144.254 dns-nameservers 8.8.8.8 重启网络服务 /etc/init.d/networking restart ubuntu 20.04 cat /etc/netplan/00-installer-config.yaml # This is the network config written by ‘subiquity’ network: ethernets: enp4s0: dhcp4: false addresses: – 192.168.1.66/24 gateway4: 192.168.1.1 nameservers: addresses: [192.168.1.1, 223.5.5.5] version: 2 netplan apply centos设置静态ip #vim /etc/sysconfig/network-scripts/ifcfg-eth0  有时会是ifcfg-em1…

  • 连接vps上的ssh

    创建一个权限最低的用户 useradd -M -s /bin/false username 创建该用户的密码: passwd username windows使用MyenTunnel,输好用户名,密码,ip,端口 linux使用ssh -N -D 7070 username@yourserver.com 在linux下使用密钥认证可以免输密码,而且参考使用ssh_config,创建并在~/.ssh/config里写入以下内容,参考:http://www.lainme.com/doku.php/blog/2011/01/%E4%BD%BF%E7%94%A8ssh_config jpuyy@ubuntu $ vim ~/.ssh/config Host vps User jpuyy Hostname jpuyy.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsavps DynamicForward 7070 这时在shell下使用 $ssh vps 更有一步登天之感。 其他工具 autossh可以在ssh断掉后重连 sudo apt-get install autossh autossh -M 2000 -N -v  username@hostip plink可以直接指定密码 ssh需要手动输入,因为把密码表现在history中相当恐怖 sudo apt-get install putty-tools plink…

  • linux几个掌握系统信息的命令

    查看CPU信息 /proc/cpuinfo 里面有flag信息,如果有lm,则支持64位 系统负载命令 uptime w htop top 都可查看 ————23:41:57 up 4:42, 3 users, load average: 0.00, 0.00, 0.00 ————当前时间 运行时间 用户数 系统负载 (最近1分钟、5分钟、15分钟系统的负载) 查看硬盘信息命令 fdisk -l JOBS使用 # jobs 查看后台运行的进程 # fg %n 让后台运行的进程n到前台来,再Ctrl+c即可终止该程序. # bg %n 让进程n到后台去; 如 root@debian:~# nohup ping g.cn & [1] 9576 root@debian:~# nohup: 忽略输入并把输出追加到”nohup.out” root@debian:~# jobs [1]+ Running nohup…