第2天重点
1 xshell mobaxterm,FinalShell 远程连接软件
1> 双击可多个远程
2 命令分类: 别名,内部,外部
2.1> 可用type查看是否内部或者外部命令
noise@noise:~$ type nano
nano is /bin/nano #这个是外部命令,需要自行安装 (yum -y install nano)
noise@noise:~$
noise@noise:~$ type pwd
pwd is a shell builtin #这是shell内部命令
noise@noise:~$ type egrep
egrep is aliased to `egrep --color=auto‘ #这是alias别名,可行定义,可用alias查看所有别名
3 常用命令:
date,
clock,
echo,
reboot
hostname,
hostnamectl,
timedatectl,
nano , -> nano test.file -> ctrl + x 退出。
screen ,-> 分屏
poweroff ,
halt ,
who,whoami ,-> 显示当前user
w , 显示当前存在的用户进程
type ,->显示命令类型
alias -> 别名
lscpu,free,lsblk,uname -r ,cat /etc/os-release lsb_release -a -> 显示系统,比如CPU,内存,磁盘,操作系统等等
1 # date 本身有很多参数,比如%F,%T 2 noise@noise:~$ date --help 3 Usage: date [OPTION]... [+FORMAT] 4 or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 5 Display the current time in the given FORMAT, or set the system date. 6 7 Mandatory arguments to long options are mandatory for short options too. 8 -d, --date=STRING display time described by STRING, not ‘now‘ 9 --debug annotate the parsed date, 10 and warn about questionable usage to stderr 11 -f, --file=DATEFILE like --date; once for each line of DATEFILE 12 -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format. 13 FMT=‘date‘ for date only (the default), 14 ‘hours‘, ‘minutes‘, ‘seconds‘, or ‘ns‘ 15 for date and time to the indicated precision. 16 Example: 2006-08-14T02:34:56-06:00 17 -R, --rfc-email output date and time in RFC 5322 format. 18 Example: Mon, 14 Aug 2006 02:34:56 -0600 19 --rfc-3339=FMT output date/time in RFC 3339 format. 20 FMT=‘date‘, ‘seconds‘, or ‘ns‘ 21 for date and time to the indicated precision. 22 Example: 2006-08-14 02:34:56-06:00 23 -r, --reference=FILE display the last modification time of FILE 24 -s, --set=STRING set time described by STRING 25 -u, --utc, --universal print or set Coordinated Universal Time (UTC) 26 --help display this help and exit 27 --version output version information and exit 28 29 FORMAT controls the output. Interpreted sequences are: 30 31 %% a literal % 32 %a locale‘s abbreviated weekday name (e.g., Sun) 33 %A locale‘s full weekday name (e.g., Sunday) 34 %b locale‘s abbreviated month name (e.g., Jan) 35 %B locale‘s full month name (e.g., January) 36 %c locale‘s date and time (e.g., Thu Mar 3 23:05:25 2005) 37 %C century; like %Y, except omit last two digits (e.g., 20) 38 %d day of month (e.g., 01) 39 %D date; same as %m/%d/%y 40 %e day of month, space padded; same as %_d 41 %F full date; same as %Y-%m-%d 42 %g last two digits of year of ISO week number (see %G) 43 %G year of ISO week number (see %V); normally useful only with %V 44 %h same as %b 45 %H hour (00..23) 46 %I hour (01..12) 47 %j day of year (001..366) 48 %k hour, space padded ( 0..23); same as %_H 49 %l hour, space padded ( 1..12); same as %_I 50 %m month (01..12) 51 %M minute (00..59) 52 %n a newline 53 %N nanoseconds (000000000..999999999) 54 %p locale‘s equivalent of either AM or PM; blank if not known 55 %P like %p, but lower case 56 %q quarter of year (1..4) 57 %r locale‘s 12-hour clock time (e.g., 11:11:04 PM) 58 %R 24-hour hour and minute; same as %H:%M 59 %s seconds since 1970-01-01 00:00:00 UTC 60 %S second (00..60) 61 %t a tab 62 %T time; same as %H:%M:%S 63 %u day of week (1..7); 1 is Monday 64 %U week number of year, with Sunday as first day of week (00..53) 65 %V ISO week number, with Monday as first day of week (01..53) 66 %w day of week (0..6); 0 is Sunday 67 %W week number of year, with Monday as first day of week (00..53) 68 %x locale‘s date representation (e.g., 12/31/99) 69 %X locale‘s time representation (e.g., 23:13:48) 70 %y last two digits of year (00..99) 71 %Y year 72 %z +hhmm numeric time zone (e.g., -0400) 73 %:z +hh:mm numeric time zone (e.g., -04:00) 74 %::z +hh:mm:ss numeric time zone (e.g., -04:00:00) 75 %:::z numeric time zone with : to necessary precision (e.g., -04, +05:30) 76 %Z alphabetic time zone abbreviation (e.g., EDT) 77 78 By default, date pads numeric fields with zeroes. 79 The following optional flags may follow ‘%‘: 80 81 - (hyphen) do not pad the field 82 _ (underscore) pad with spaces 83 0 (zero) pad with zeros 84 ^ use upper case if possible 85 # use opposite case if possible 86 87 After any flags comes an optional field width, as a decimal number; 88 then an optional modifier, which is either 89 E to use the locale‘s alternate representations if available, or 90 O to use the locale‘s alternate numeric symbols if available. 91 92 Examples: 93 Convert seconds since the epoch (1970-01-01 UTC) to a date 94 $ date --date=‘@2147483647‘ 95 96 Show the time on the west coast of the US (use tzselect(1) to find TZ) 97 $ TZ=‘America/Los_Angeles‘ date 98 99 Show the local time for 9AM next Friday on the west coast of the US 100 $ date --date=‘TZ="America/Los_Angeles" 09:00 next Fri‘ 101 102 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 103 Full documentation at: <http://www.gnu.org/software/coreutils/date> 104 or available locally via: info ‘(coreutils) date invocation‘ 105 106 noise@noise:~$ date 107 Fri Apr 16 14:16:10 CST 2021 108 noise@noise:~$ echo `date +%F` 109 2021-04-16 110 noise@noise:~$ touch `date +%F-%T`.LOG 111 noise@noise:~$ ls 112 2021-04-16-14:19:23.LOG
1 [root@centos8 ~]# clock 2 2021-04-16 14:23:24.633755+08:00 3 [root@centos8 ~]# clock --help 4 5 Usage: 6 clock [function] [option...] 7 8 Time clocks utility. 9 10 Functions: 11 -r, --show display the RTC time 12 --get display drift corrected RTC time 13 --set set the RTC according to --date 14 -s, --hctosys set the system time from the RTC 15 -w, --systohc set the RTC from the system time 16 --systz send timescale configurations to the kernel 17 -a, --adjust adjust the RTC to account for systematic drift 18 --predict predict the drifted RTC time according to --date 19 20 Options: 21 -u, --utc the RTC timescale is UTC 22 -l, --localtime the RTC timescale is Local 23 -f, --rtc <file> use an alternate file to /dev/rtc0 24 --directisa use the ISA bus instead of /dev/rtc0 access 25 --date <time> date/time input for --set and --predict 26 --update-drift update the RTC drift factor 27 --noadjfile do not use /etc/adjtime 28 --adjfile <file> use an alternate file to /etc/adjtime 29 --test dry run; implies --verbose 30 -v, --verbose display more details 31 32 -h, --help display this help 33 -V, --version display version 34 35 For more details see hwclock(8).
1 [root@Centos8 ~]# hostnamectl --help 2 hostnamectl [OPTIONS...] COMMAND ... 3 4 Query or change system hostname. 5 6 -h --help Show this help 7 --version Show package version 8 --no-ask-password Do not prompt for password 9 -H --host=[USER@]HOST Operate on remote host 10 -M --machine=CONTAINER Operate on local container 11 --transient Only set transient hostname 12 --static Only set static hostname 13 --pretty Only set pretty hostname 14 15 Commands: 16 status Show current hostname settings 17 set-hostname NAME Set system hostname 18 set-icon-name NAME Set icon name for host 19 set-chassis NAME Set chassis type for host 20 set-deployment NAME Set deployment environment for host 21 set-location NAME Set location for host 22 [root@Centos8 ~]# hostnamectl set-hostname Centos9 23 [root@Centos8 ~]# exit 24 Last login: Fri Apr 16 14:25:45 2021 from 10.0.0.1 25 [root@Centos9 ~]#
4 安装 CentOS 6