随笔分类 - linux shell
摘要:1、系统 [root@centos7pc1 vim-8.2.1862]# hostnamectl Static hostname: centos7pc1 Icon name: computer-vm Chassis: vm Machine ID: d44b8799f26a411a87bb728b10
阅读全文
摘要:001、if [root@centos7pc1 test]# ls test.sh [root@centos7pc1 test]# cat test.sh ## 测试脚本,if判断 #!/bin/bash read -p "please input an num:" NUM if [ $NUM -g
阅读全文
摘要:方法1: 1、查看ip [root@centos7pc1 test]# ifconfig | head ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.65.153 netmask 255.255.255
阅读全文
摘要:1、系统 [root@centos7pc1 test]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-no
阅读全文
摘要:测试文件 root@PC1:/home/test2# touch file.txt root@PC1:/home/test2# mkdir data root@PC1:/home/test2# ls data file.txt root@PC1:/home/test2# ll -h total 12
阅读全文
摘要:linux中printf命令用于格式化输出。 示例 001、 liujiaxin01@PC1:~/test2$ printf "姓名:%s\n身高:%dcm\n体重:%.2fkg\n" "小明" "180" "75.5" 姓名:小明 ## %s表示格式化为字符串strings; %d表示格式化为整数
阅读全文
摘要:1、 root@PC1:/home/test2# cat a.txt 1 2 3 4 5 root@PC1:/home/test2# awk '{printf("%s%\n", $1)}' a.txt awk: run time error: not enough arguments passed
阅读全文
摘要:001、 root@PC1:/home/test2# pwd ## 一个正常的linux命令 /home/test2 root@PC1:/home/test2# pwd; echo "xxx" ##;前执行正常,后面的命令能够正常执行 /home/test2 xxx root@PC1:/home/t
阅读全文
摘要:linux中sleep命令用于将当前动作延迟一段时间: 001、示例: root@PC1:/home/test2# date ## date命令显示当前日期 2022年 05月 04日 星期三 08:10:15 CST root@PC1:/home/test2# date && sleep 10 &
阅读全文
摘要:SECONDS变量用于记录从当前shell开始运行所流逝的秒数。 示例: root@PC1:/home/test# echo $SECONDS 1178 root@PC1:/home/test#echo $SECONDS && sleep 10 && echo $SECONDS 1204 1214
阅读全文
摘要:1、查看系统 [root@centos7pc1 test]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@centos7pc1 test]# hostnamectl Static hostname: cento
阅读全文
摘要:1、-O , 指定下载文件的名称 示例: [root@centos7pc1 test]# ls [root@centos7pc1 test]# wget -O xxx.zip https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_2022
阅读全文
摘要:1、系统 root@liujiaxinpc1:/home/test# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04
阅读全文
摘要:1、查看系统及代码 root@liujiaxinpc1:/home# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04
阅读全文
摘要:来源:https://blog.csdn.net/bigdog_1027/article/details/78924768 Ubuntu安装后默认的官方源是美国的服务器,但是美国服务器在国内安装软件等会有较大的限制。所以我们需要将默认的源切换为国内源。一般来说,常用的国内源有阿里源(这是中国官方源)
阅读全文
摘要:1、 001、apt-get是老版的命令,apt是新版的命令。 002、apt包含了apt-get、apt-cache等等,用起来更方便。 003、apt刚刚出来,所以允许有apt-get和apt共存,向后兼容,以后apt-get就要淘汰了。 来源:https://zhidao.baidu.com/
阅读全文
摘要:1、源(软件网址) /etc/apt/sources.list ## 指定了软件下载的地址 2、更新本地软件包管理器软件列表(可以在包管理器中查看) sudo apt-get update 3、安装本地软件包管理器软件列表中的软件(将软件列表中的软件和已安装的软件对比,需要更新则安装更新) sudo
阅读全文
摘要:linux 中 netstat命令用于统计网络相关信息。 常用命令示例: 1、查看IP [root@rhelpc1 test]# netstat | head ## 查看本机IP Active Internet connections (w/o servers) Proto Recv-Q Send-
阅读全文
摘要:1、 -a: 列出所有用户 -u:列出状态 -x:列出更详细的信息 通常使用 ps -aux | grep "xxx" 查看特定的进程 ps -ef | grep “xxx”查看特定进程 示例: root@PC1:/home/test# ps -aux | grep "admixture" ## 查
阅读全文
摘要:1、 root@PC1:/home/test# echo "aaabbb" aaabbb root@PC1:/home/test# echo -n "aaabbb" ## -n的作用是不要在最后自动换行 aaabbbroot@PC1:/home/test#
阅读全文

浙公网安备 33010602011771号