Linux command format:
COMMAND [OPTIONS...] [ARGUMENTS...]
Naming [options...] [parameters...]
echo command
Function: Display characters
grammar:
echo [-neE] [string]
Options:
-E (default) does not support \ explain function
-n do not wrap
-e enables interpretation of \ characters
Display variable
echo "$VAR_NAME" variable will be replaced, weak reference
Echo'$VAR_NAME' variable will not be replaced, strong quote
screen
Function: Linux screen command is used for multiple windows management programs.
grammar:
screen [-AmRvx -ls -wipe][-d <job name>][-h <number of lines>][-r <job name>][-s <shell>][-S <job name>]
Options:
-A Adjust all windows to the size of the current terminal.
-d<job name> Take the specified screen job offline.
-h<number of lines> Specify the number of lines in the window's buffer.
-m Even if the screen operation is currently in operation, it is still mandatory to create a new screen operation.
-r<job name> Resume offline screen jobs.
-R Attempt to resume offline jobs first. If no offline job is found, a new screen job is created.
-s<shell> Specifies the shell to be executed when creating a new window.
-S<job name> Specifies the name of the screen job.
-v Display version information.
-x Resume the previously offline screen job.
-ls or --list displays all current screen operations.
-wipe Check all current screen jobs and delete screen jobs that are no longer available.
Examples:
Create a new screen session
screen –S [SESSION]
Join the screen session
screen –x [SESSION]
Exit and close the screen session
exit
Strip the current screen session
Ctrl+a,d
Show all open screen sessions
screen -ls
Resume a screen session
screen -r [SESSION]
date
Function: display or set the date and time of the system
Two clocks of Linux
System clock: It is carried out by the Linux kernel through the operating frequency of the CPU
Hardware clock: motherboard
Time parameters:
%: Print out%
%n: next line
%t: Tab
%H: hour (00..23)
%I: hour (01..12)
%k: hour (0..23)
%l: hour (1..12)
%M: minute (00..59)
%p: display local AM or PM
%r: display time directly (12 hour format, format is hh:mm:ss [AP]M)
%s: The number of seconds since January 1, 1970 00:00:00 UTC
%S: second (00..61)
%T: display time directly (24 hour format)
%X: equivalent to %H:%M:%S
%Z: display time zone
Date parameters:
%a: Day of the week (Sun..Sat)
%A: Day of the week (Sunday..Saturday)
%b: month (Jan..Dec)
%B: Month (January..December)
%c: display date and time directly
%d: day (01..31)
%D: display date directly (mm/dd/yy)
%h: same as %b
%j: the day of the year (001...366)
%m: month (01..12)
%U: The week of the year (00..53) (when Sunday is the first day of the week)
%w: the day of the week (0..6)
%W: The first few weeks of the year (00..53) (when Monday is the first day of the week)
%x: display date directly (mm/dd/yy)
%y: the last two digits of the year (00.99)
%Y: complete year (0000..9999)
Examples:
date display and set system time
date +%s
date -d @1509536033
hwclock, clock: display hardware clock
-s, --hctosys Take the hardware clock as the standard, correct the system clock
-w, --systohc Take the system clock as the standard, correct the hardware clock
时区:ll /etc/localtime
List time zones: timedatectl list-timezones
Display calendar: cal –y
Synchronization server time: ntpdate ip address
ifconfig
The ifconfig command is used to display or set network devices.
ifconfig can set the status of network devices, or display the current settings.
grammar:
ifconfig [network device][down up -allmulti -arp -promisc][add<address>][del<address>][<hw<network device type><hardware address>][io_addr<I/O address>][ irq<IRQ address>][media<network media type>][mem_start<memory address>][metric<number>][mtu<byte>][netmask<subnet mask>][tunnel<address>][ -broadcast<address>][-pointopoint<address>][IP address]
Options:
add<address> Set the IPv6 IP address of the network device.
del<address> Delete the IPv6 IP address of the network device.
down Turn off the specified network device.
<hw<Network device type><Hardware address> Set the type and hardware address of the network device.
io_addr<I/O address> Set the I/O address of the network device.
irq<IRQ address> Set the IRQ of the network device.
media<network media type> Set the media type of the network device.
mem_start<memory address> Set the starting address occupied by the network device in the main memory.
metric<number> specifies the number to be added when calculating the number of transfers of the data packet.
mtu<byte> Set the MTU of the network device.
netmask<subnet mask> Set the subnet mask of the network device.
tunnel<address> Establish the communication address of the tunnel between IPv4 and IPv6.
up Start the specified network device.
-broadcast<address> Treat the data packet sent to the specified address as a broadcast data packet.
-pointopoint<address> establishes a direct connection with the network device at the specified address. This mode has a security function.
-promisc Turn off or start the promiscuous mode of the specified network device.
[IP address] Specify the IP address of the network device.
[Network Device] Specify the name of the network device.
Examples:
Display network device information
ifconfig
Start and close the specified network card
ifconfig eth0 down
ifconfig eth0 up
export
The export command is used to set or display environment variables. When executing a program in the shell, the shell provides a set of environment variables. Export can add, modify or delete environment variables for the subsequent execution of the program. The effect of export is limited to this login operation.
parameter:
-f represents the function name in [variable name].
-n Delete the specified variable. The variable is not actually deleted, but it will not be output to the execution environment of subsequent instructions.
-p List all environment variables assigned to the program by the shell.
Examples:
List the current environment variable values
export -p
Define environment variables and assign values
export MYENV=7