Linux - 命令记录 - 霜冷的秘密基地

Linux - 命令记录

日常琐碎 0 评

简述:记录一些常用的Linux命令和Linux排错,以便查阅

常用命令

  • 修改网卡mac

    ifconfig wlan0 down
    macchanger -r wlan0

  • 重启网卡

    ip link set dev wlan0 up

  • 设置开机启动服务

    update-rc.d enable ssh
    systemctl enable ssh

  • 开放与关闭查看端口

    firewall-cmd --zone=public --list-ports # 查看所有开放端口
    firewall-cmd --zone=public --add-port=5672/tcp --permanent # 开放5672端口
    firewall-cmd --zone=public --remove-port=5672/tcp --permanent # 关闭5672端口
    firewall-cmd --reload # 配置立即生效
    firewall-cmd.png

  • 关闭防火墙

    systemctl stop firewalld.service

  • 查看监听的端口

    netstat -lnpt

  • 查看5672端口被什么进程占用了

    netstat -lnpt |grep 5672 # centos默认木有netstat,使用yum install -y net-tools安装

  • 查看进程信息

    ps 6832

  • 终止进程

    kill -9 6832

解决Linux网卡错误

10月 05 14:42:31 centos systemd[1]: Failed to start LSB: Bring up/down networking.

# 错误
重启虚拟机后,重启网络服务失败,查看日志:
[root@centos network-scripts]# systemctl status network.service
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 二 2021-10-05 14:42:31 CST; 16s ago
Docs: man:systemd-sysv-generator(8)
Process: 4658 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

10月 05 14:42:31 centos network[4658]: RTNETLINK answers: File exists
10月 05 14:42:31 centos network[4658]: RTNETLINK answers: File exists
10月 05 14:42:31 centos network[4658]: RTNETLINK answers: File exists
10月 05 14:42:31 centos network[4658]: RTNETLINK answers: File exists
10月 05 14:42:31 centos network[4658]: RTNETLINK answers: File exists
10月 05 14:42:31 centos network[4658]: RTNETLINK answers: File exists
10月 05 14:42:31 centos systemd[1]: network.service: control process exited, code...=1
10月 05 14:42:31 centos systemd[1]: Failed to start LSB: Bring up/down networking.
10月 05 14:42:31 centos systemd[1]: Unit network.service entered failed state.
10月 05 14:42:31 centos systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

# 解决
禁用NetworkManager即可

systemctl stop NetworkManager
systemctl disable NetworkManager

安装homebrew

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

设置:
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

brew安装jdk8

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
or
brew install homebrew/cask-versions/adoptopenjdk8

Aria2

/usr/local/Cellar/aria2/1.36.0: 23 files, 4.0MB

Centos - ip

cd /Library/Preferences/VMware Fusion/vmnet8
cat nat.conf
cat dhcpd.conf

互联网时代的波涛汹涌
快来做第一个评论的人吧~
0:00