本文主要是介绍Linux cal-date-ping-关机|重启-ping-strace-mkpasswd,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Linux里查看日历(cal)
[root@jack ~]# cal八月 2022
日 一 二 三 四 五 六1 2 3 4 5 67 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
[root@jack ~]# cal 20222022 一月 二月 三月
日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六1 1 2 3 4 5 1 2 3 4 52 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 129 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19
16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26
23 24 25 26 27 28 29 27 28 27 28 29 30 31
30 31 四月 五月 六月
日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六1 2 1 2 3 4 5 6 7 1 2 3 43 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11
10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18
17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25
24 25 26 27 28 29 30 29 30 31 26 27 28 29 30 七月 八月 九月
日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六1 2 1 2 3 4 5 6 1 2 33 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24
24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30
31 十月 十一月 十二月
日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六1 1 2 3 4 5 1 2 32 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 109 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
查看Linux内核的版本
[root@jack ~]# uname -r
4.18.0-240.el8.x86_64
[root@jack ~]# uname -a
Linux jack 4.18.0-240.el8.x86_64 #1 SMP Fri Sep 25 19:48:47 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
删除用户
[root@jack ~]# userdel -r chenyammin # 删除用户
-r 删除用户的家目录和邮箱
关机:
init 0
halt
power off
shutdown -h now
重启:
init 6
reboot
shutdown -r now
Windows里的定时关机
win+r --》输入cmd
shutdown -t 600 -s 600秒后关机
shutdown -a 取消关机
cls 清除屏幕
C:\Users\wei>ipconfigWindows IP 配置以太网适配器 以太网:媒体状态 . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :无线局域网适配器 本地连接* 1:媒体状态 . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :无线局域网适配器 本地连接* 10:媒体状态 . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :以太网适配器 VMware Network Adapter VMnet1:连接特定的 DNS 后缀 . . . . . . . :本地链接 IPv6 地址. . . . . . . . : fe80::be8a:2f0b:c1cc:3b06%20IPv4 地址 . . . . . . . . . . . . : 192.168.66.1子网掩码 . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . :以太网适配器 VMware Network Adapter VMnet8:连接特定的 DNS 后缀 . . . . . . . :本地链接 IPv6 地址. . . . . . . . : fe80::3208:216a:4fa:3615%12IPv4 地址 . . . . . . . . . . . . : 192.168.102.1子网掩码 . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . :无线局域网适配器 WLAN:连接特定的 DNS 后缀 . . . . . . . :本地链接 IPv6 地址. . . . . . . . : fe80::2147:4cc:64e7:8d1%15IPv4 地址 . . . . . . . . . . . . : 192.168.1.105子网掩码 . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . : 192.168.1.1以太网适配器 蓝牙网络连接:媒体状态 . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :
ping 用来测试网络的连通性,网络是否畅通。
[root@aliyun ~]# ping www.google.com
PING www.google.com (162.125.32.5) 56(84) bytes of data.
^C
--- www.google.com ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 5999ms[root@aliyun ~]# [root@aliyun ~]# ping -c 1 -w 1 -v www.baidu.com
ping: socket: Permission denied, attempting raw socket...
PING www.a.shifen.com (180.101.50.242) 56(84) bytes of data.
64 bytes from 180.101.50.242 (180.101.50.242): icmp_seq=1 ttl=50 time=12.2 ms--- www.a.shifen.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 12.265/12.265/12.265/0.000 ms
[root@sc ~]# hostname
sc
[root@sc ~]# hostnamectl set-hostname sanchuang
[root@sc ~]# hostname
sanchuang[root@jack ~]# city=changsha # 定义变量city赋值changsha
[root@jack ~]# echo $city # 输出变量的值
changsha
[root@jack ~]# unset city # 取消定义变量city
[root@jack ~]# echo $city # 变量被取消后,会是空值 -->没有内容、不会报错[root@sc ~]# [root@jack lianxi]# printf "hello world"
hello world[root@jack lianxi]# printf "hello world\n"
hello world
[root@jack lianxi]# printf "%d\n" "'a"
97
[root@jack lianxi]# printf "\x61\n"
amd5sum :背后就是产生一个固定长度的字符串md5sum - compute and check MD5 message digest[root@jack lianxi]# echo 123 |md5sum
ba1f2511fc30423bdbb183fe33f3dd0f -
[root@jack lianxi]# echo 12323rref |md5sum
f72ae3eb75e71986f3432edc3e1dadf4 -
[root@jack lianxi]# md5sum a.txt
545d09145f11ddca673a5f9a222b7ff4 a.txt
[root@jack lianxi]# cat a.txt
qijf
fjsoHash,一般翻译做散列、杂凑,或音译为哈希,是把任意长度的输入通过散列算法变换成固定长度的输出,该输出就是散列值。
简单的说就是一种将任意长度的消息压缩到某一固定长度的消息摘要的函数。
strace 命令是一款用于跟踪Linux系统调用和信号的工具,可以帮助开发者排除程序运行时的问题。
[root@ansible_nfs ~]# yum install strace -y
strace - trace system calls and signals[root@sc ~]# strace ls >1.txt
execve("/bin/ls", ["ls"], 0x7fffa0f11f90 /* 19 vars */) = 0
brk(NULL) = 0x15b8000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e8a000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (没有那个文件或目录)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=29473, ...}) = 0
mmap(NULL, 29473, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7efe96e82000
close(3) = 0
open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220j\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=155744, ...}) = 0
mmap(NULL, 2255216, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe96a43000
mprotect(0x7efe96a67000, 2093056, PROT_NONE) = 0
mmap(0x7efe96c66000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7efe96c66000
mmap(0x7efe96c68000, 6512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efe96c68000
close(3) = 0
open("/lib64/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\26\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=20048, ...}) = 0
mmap(NULL, 2114112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe9683e000
mprotect(0x7efe96842000, 2093056, PROT_NONE) = 0
mmap(0x7efe96a41000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efe96a41000
close(3) = 0
open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\37\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=37064, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e81000
mmap(NULL, 2130560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe96635000
mprotect(0x7efe9663c000, 2097152, PROT_NONE) = 0
mmap(0x7efe9683c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7efe9683c000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`&\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2156592, ...}) = 0
mmap(NULL, 3985920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe96267000
mprotect(0x7efe9642b000, 2093056, PROT_NONE) = 0
mmap(0x7efe9662a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c3000) = 0x7efe9662a000
mmap(0x7efe96630000, 16896, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efe96630000
close(3) = 0
open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=402384, ...}) = 0
mmap(NULL, 2494984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe96005000
mprotect(0x7efe96065000, 2097152, PROT_NONE) = 0
mmap(0x7efe96265000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x60000) = 0x7efe96265000
close(3) = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19248, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e80000
mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe95e01000
mprotect(0x7efe95e03000, 2097152, PROT_NONE) = 0
mmap(0x7efe96003000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7efe96003000
close(3) = 0
open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\23\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19896, ...}) = 0
mmap(NULL, 2113904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe95bfc000
mprotect(0x7efe95c00000, 2093056, PROT_NONE) = 0
mmap(0x7efe95dff000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7efe95dff000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200m\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=142144, ...}) = 0
mmap(NULL, 2208904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7efe959e0000
mprotect(0x7efe959f7000, 2093056, PROT_NONE) = 0
mmap(0x7efe95bf6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7efe95bf6000
mmap(0x7efe95bf8000, 13448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7efe95bf8000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e7f000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e7d000
arch_prctl(ARCH_SET_FS, 0x7efe96e7d840) = 0
access("/etc/sysconfig/strcasecmp-nonascii", F_OK) = -1 ENOENT (没有那个文件或目录)
access("/etc/sysconfig/strcasecmp-nonascii", F_OK) = -1 ENOENT (没有那个文件或目录)
mprotect(0x7efe9662a000, 16384, PROT_READ) = 0
mprotect(0x7efe95bf6000, 4096, PROT_READ) = 0
mprotect(0x7efe95dff000, 4096, PROT_READ) = 0
mprotect(0x7efe96003000, 4096, PROT_READ) = 0
mprotect(0x7efe96265000, 4096, PROT_READ) = 0
mprotect(0x7efe9683c000, 4096, PROT_READ) = 0
mprotect(0x7efe96a41000, 4096, PROT_READ) = 0
mprotect(0x7efe96c66000, 4096, PROT_READ) = 0
mprotect(0x61a000, 4096, PROT_READ) = 0
mprotect(0x7efe96e8b000, 4096, PROT_READ) = 0
munmap(0x7efe96e82000, 29473) = 0
set_tid_address(0x7efe96e7db10) = 20324
set_robust_list(0x7efe96e7db20, 24) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7efe959e6860, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7efe959ef630}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7efe959e68f0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7efe959ef630}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/sys/fs/selinux", 0x7ffce50d1f20) = -1 ENOENT (没有那个文件或目录)
statfs("/selinux", 0x7ffce50d1f20) = -1 ENOENT (没有那个文件或目录)
brk(NULL) = 0x15b8000
brk(0x15d9000) = 0x15d9000
open("/proc/filesystems", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e89000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 343
stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7ffce50d1ab0) = -1 ENOENT (没有那个文件或目录)
read(3, "", 1024) = 0
close(3) = 0
munmap(0x7efe96e89000, 4096) = 0
access("/etc/selinux/config", F_OK) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106176928, ...}) = 0
mmap(NULL, 106176928, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7efe8f49d000
close(3) = 0
ioctl(1, TCGETS, 0x7ffce50d1e80) = -1 ENOTTY (对设备不适当的 ioctl 操作)
ioctl(1, TIOCGWINSZ, 0x7ffce50d1f50) = -1 ENOTTY (对设备不适当的 ioctl 操作)
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
getdents(3, /* 7 entries */, 32768) = 208
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
fstat(1, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7efe96e89000
write(1, "1.txt\nfeng.txt\nmobile_phone.txt\n"..., 42) = 42
close(1) = 0
munmap(0x7efe96e89000, 4096) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++[root@sc ~]# ls
1.txt
date 是Linux里查看时间的命令
%Y year 年
%m month 月
%d day 天
%H hour 小时
%M minute 分钟
$S seconde 秒
[root@jack lianxi]# date +%Y%m%d
20220821
mkpasswd生成随时密码工具:(make passwd)
-l 指定长度 length
-d 指定使用数字 digit
-c 小写字母 character
-C 大写字母 character
-s 特殊字符 special character
[root@jack lianxi]# yum provides mkpasswd
上次元数据过期检查:2:51:14 前,执行于 2022年08月23日 星期二 16时35分42秒。
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
expect-5.45.4-5.el8.x86_64 : A program-script interaction and testing utility
仓库 :baseos
匹配来源:
文件名 :/usr/bin/mkpasswd
[root@jack lianxi]# yum install expect -yNAMEmkpasswd - generate new password, optionally apply it to a user[root@jack lianxi]# mkpasswd -l 50
-l 指定密码的长度
rdxvv5rtkwebvzpdilslUrsrlimnqjzrjBirispfvit%ct2mna
命令替换
var=$(命令)
[root@aliyun ~]# echo $(seq 5)
1 2 3 4 5
这篇关于Linux cal-date-ping-关机|重启-ping-strace-mkpasswd的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!