Linux 使用

基础命令

mv

用法

参数 注解 参数 注解
-b 覆盖前为目标文件创建备份。 -f 强制覆盖目标文件而不询问。
-i 覆盖目标文件前询问用户是否确认 -n 不要覆盖已有文件。
-u 当源文件比目标文件更新时,执行覆盖 -v 显示执行过程详细信息
-Z 设置文件安全上下文

参考示例

对指定文件进行剪切后粘贴(重命名)操作:mv File1.cfg File2.cfg
将指定文件移动到/etc目录中,保留文件原始名称:mv File2.cfg /etc
将指定目录移动到/etc目录中,并定义新的目录名称:mv Dir1 /etc/Dir2
将/home目录中所有的文件都移动到当前工作目录中,若遇到文件已存在则直接覆盖:mv -f /home/*

拓展包

关闭终端屏幕

关闭屏幕:
setterm -blank force

重新开启屏幕(通常不需要,但可以用来测试):
setterm -blank poke

常用配置

开启 root 及root用户ssh权限

设置root账户密码
sudo passwd root

开启root用户远程ssh登录
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo systemctl restart ssh

Ubuntu24 配置静态IP

切换工作路径
cd /etc/netplan

编辑文件 50-cloud-init.yaml
nano 50-cloud-init.yaml

文件内容

{
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp3s0:
            dhcp4: true
    version: 2
    wifis:
        wlp2s0:
            access-points:
                QWRT_037E57_5G:        #Wifi名
                    password: ******** #wifi密码
            dhcp4: false
            addresses:
              - 10.0.0.100/24
            routes:
              - to: default
                via: 10.0.0.1
            nameservers:
              addresses:
                - 144.144.144.144
                - 8.8.8.8

}

应用新的网络配置:
sudo netplan apply
重新启动网络服务:
sudo systemctl restart systemd-networkd

posted @ 2024-08-21 00:51  NAfei  阅读(38)  评论(0)    收藏  举报