仅以博客形式记录linux所学,不足之处继续优化
linux系统的常用命令格式基本上是以 cmd(command) 选项 参数 的形式书写
例如screen、date、ifconfig等命令
1 Usage: date [OPTION]... [+FORMAT] 2 or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 3 Display the current time in the given FORMAT, or set the system date. 4 5 Mandatory arguments to long options are mandatory for short options too. 6 -d, --date=STRING display time described by STRING, not 'now' 7 -f, --file=DATEFILE like --date once for each line of DATEFILE 8 -I[TIMESPEC], --iso-8601[=TIMESPEC] output date/time in ISO 8601 format. 9 TIMESPEC='date' for date only (the default), 10 'hours', 'minutes', 'seconds', or 'ns' for date 11 and time to the indicated precision. 12 -r, --reference=FILE display the last modification time of FILE 13 -R, --rfc-2822 output date and time in RFC 2822 format. 14 Example: Mon, 07 Aug 2006 12:34:56 -0600 15 --rfc-3339=TIMESPEC output date and time in RFC 3339 format. 16 TIMESPEC='date', 'seconds', or 'ns' for 17 date and time to the indicated precision. 18 Date and time components are separated by 19 a single space: 2006-08-07 12:34:56-06:00 20 -s, --set=STRING set time described by STRING 21 -u, --utc, --universal print or set Coordinated Universal Time (UTC) 22 --help display this help and exit 23 --version output version information and exit 24 25 FORMAT controls the output. Interpreted sequences are: 26 27 %% a literal % 28 %a locale's abbreviated weekday name (e.g., Sun) 29 %A locale's full weekday name (e.g., Sunday) 30 %b locale's abbreviated month name (e.g., Jan) 31 %B locale's full month name (e.g., January) 32 %c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) 33 %C century; like %Y, except omit last two digits (e.g., 20) 34 %d day of month (e.g., 01) 35 %D date; same as %m/%d/%y 36 %e day of month, space padded; same as %_d 37 %F full date; same as %Y-%m-%d 38 %g last two digits of year of ISO week number (see %G) 39 %G year of ISO week number (see %V); normally useful only with %V 40 %h same as %b 41 %H hour (00..23) 42 %I hour (01..12) 43 %j day of year (001..366) 44 %k hour, space padded ( 0..23); same as %_H 45 %l hour, space padded ( 1..12); same as %_I 46 %m month (01..12) 47 %M minute (00..59) 48 %n a newline 49 %N nanoseconds (000000000..999999999) 50 %p locale's equivalent of either AM or PM; blank if not known 51 %P like %p, but lower case 52 %r locale's 12-hour clock time (e.g., 11:11:04 PM) 53 %R 24-hour hour and minute; same as %H:%M 54 %s seconds since 1970-01-01 00:00:00 UTC 55 %S second (00..60) 56 %t a tab 57 %T time; same as %H:%M:%S 58 %u day of week (1..7); 1 is Monday 59 %U week number of year, with Sunday as first day of week (00..53) 60 %V ISO week number, with Monday as first day of week (01..53) 61 %w day of week (0..6); 0 is Sunday 62 %W week number of year, with Monday as first day of week (00..53) 63 %x locale's date representation (e.g., 12/31/99) 64 %X locale's time representation (e.g., 23:13:48) 65 %y last two digits of year (00..99) 66 %Y year 67 %z +hhmm numeric time zone (e.g., -0400) 68 %:z +hh:mm numeric time zone (e.g., -04:00) 69 %::z +hh:mm:ss numeric time zone (e.g., -04:00:00) 70 %:::z numeric time zone with : to necessary precision (e.g., -04, +05:30) 71 %Z alphabetic time zone abbreviation (e.g., EDT) 72 73 By default, date pads numeric fields with zeroes. 74 The following optional flags may follow '%': 75 76 - (hyphen) do not pad the field 77 _ (underscore) pad with spaces 78 0 (zero) pad with zeros 79 ^ use upper case if possible 80 # use opposite case if possible 81 82 After any flags comes an optional field width, as a decimal number; 83 then an optional modifier, which is either 84 E to use the locale's alternate representations if available, or 85 O to use the locale's alternate numeric symbols if available. 86 87 Examples: 88 Convert seconds since the epoch (1970-01-01 UTC) to a date 89 $ date --date='@2147483647' 90 91 Show the time on the west coast of the US (use tzselect(1) to find TZ) 92 $ TZ='America/Los_Angeles' date 93 94 Show the local time for 9AM next Friday on the west coast of the US 95 $ date --date='TZ="America/Los_Angeles" 09:00 next Fri' 96 97 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 98 For complete documentation, run: info coreutils 'date invocation'
利用date来设置时间
date -s "20200807 12:00:00"
1 Use: screen [-opts] [cmd [args]] 2 or: screen -r [host.tty] 3 4 Options: 5 -4 Resolve hostnames only to IPv4 addresses. 6 -6 Resolve hostnames only to IPv6 addresses. 7 -a Force all capabilities into each window's termcap. 8 -A -[r|R] Adapt all windows to the new display width & height. 9 -c file Read configuration file instead of '.screenrc'. 10 -d (-r) Detach the elsewhere running screen (and reattach here). 11 -dmS name Start as daemon: Screen session in detached mode. 12 -D (-r) Detach and logout remote (and reattach here). 13 -D -RR Do whatever is needed to get a screen session. 14 -e xy Change command characters. 15 -f Flow control on, -fn = off, -fa = auto. 16 -h lines Set the size of the scrollback history buffer. 17 -i Interrupt output sooner when flow control is on. 18 -l Login mode on (update /var/run/utmp), -ln = off. 19 -ls [match] or 20 -list Do nothing, just list our SockDir [on possible matches]. 21 -L Turn on output logging. 22 -m ignore $STY variable, do create a new screen session. 23 -O Choose optimal output rather than exact vt100 emulation. 24 -p window Preselect the named window if it exists. 25 -q Quiet startup. Exits with non-zero return code if unsuccessful. 26 -Q Commands will send the response to the stdout of the querying process. 27 -r [session] Reattach to a detached screen process. 28 -R Reattach if possible, otherwise start a new session. 29 -s shell Shell to execute rather than $SHELL. 30 -S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>. 31 -t title Set title. (window's name). 32 -T term Use term as $TERM for windows, rather than "screen". 33 -U Tell screen to use UTF-8 encoding. 34 -v Print "Screen version 4.01.00devel (GNU) 2-May-06". 35 -wipe [match] Do nothing, just clean up SockDir [on possible matches]. 36 -x Attach to a not detached screen. (Multi display mode). 37 -X Execute <cmd> as a screen command in the specified session.
在linux使用过程中,如果有人想请你帮忙,可以使用screen程序来操作,使你和被帮助人的终端设备同步打印相同的信息,相当于终端共享,便于解决问题。
screen -S help 开启一个名为help的screen的页面
screen -ls 查看当前是否有人建立screen页面
screen -x help 通过help名来加入screen。
加入之后便可以两个终端同步打印输入输出的信息。