Some instructions on Linux system

Source: Internet
Author: User
Tags time and date

Ifconfig,echo,tty,startx,export,pwd,history,shutdown,poweroff,reboot,hwclock,date
Ifconfig
Format: ifconfig [network Devices] [parameters]
Purpose: View and configure network devices

Parameters
-A view opened port information
-S Display summary information (similar to netstat-i)
-promisc sets whether the Promisc mode of the NIC is supported, and if this parameter is selected, the NIC will receive all packets sent to it in the network
-allmulti Settings Support multicast mode, if you select this parameter, the NIC will receive all multicast packets in the network
Add to configure the IPV6 address for the specified NIC
Del deletes the IPV6 address of the specified network card
Up to start the specified network device/NIC
Down to disable specified network device/NIC
ARP settings specify whether the NIC supports ARP protocol

Instance
[[email protected] ~]# ifconfig
Eno16777736:flags=4163<up,broadcast,running,multicast > MTU
inet 192.168.1.102 netmask 255.255.255.0 broadcast 192.168.1.255
Inet6 Fe80::20c:29ff:fe f2:969 Prefixlen ScopeID 0x20<link>
ether 00:0c:29:f2:09:69 Txqueuelen (Ethernet)
RX PAC Kets 185 bytes 16045 (15.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 149 bytes 29983 (2 9.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Lo:flags=73<up,loopback,running> MTU 65536
inet 127.0.0.1 netmask 255.0.0.0
Inet6:: 1 prefixlen ScopeID 0x10Loop Txqueuelen 0 (Local Loopback)
RX Packets 8 bytes (800.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX Packets 8 bytes (800.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Description: eno16777736: Nic Name

inet 192.168.1.102:ipv4 Address
Netmask 255.255.255.0: Mask
Ether 00:0c:29:f2:09:69:mac Address
Broadcast 192.168.1.255: Broadcast Address

[Email protected] ~]# ifconfig eno16777736 up
Open port
[Email protected] ~]# ifconfig eno16777736 down
Close port
[Email protected] ~]# ifconfig eno16777736 Add 33ffe:3240:800:1005::2/64
Configuring IPv6 Addresses
[Email protected] ~]# ifconfig eno16777736 del 33ffe:3240:800:1005::2/64
Delete IPv6 address
[Email protected] ~]# ifconfig eth0 hw ether 00:aa:bb:cc:dd:ee

Modify MAC Address
[Email protected] ~]# ifconfig eno16777736 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255
Configure the IP address for the ENO16777736 network card: 192.168.120.56, plus the child mask: 255.255.255.0, plus a broadcast address: 192.168.120.255
[[email protected] ~]# ifconfig eno16777736 ARP
Open the ARP protocol for the port
[Email protected] ~]# ifconfig eno16777736-arp
ARP protocol for closing ports

Echo
Format: Echo [-ne][string] or echo [--help][--version]
Purpose: Display text

Parameters
-N Do not wrap in the last line
-E If the following characters appear in the string, they are handled in particular, not as a general
Text output:
\a issued a warning sound;
\b Delete the previous character;
\c finally not add the line break symbol;
\f the line but the cursor remains in its original position;
\ n Wraps and the cursor moves to the beginning of the line;
\ r The cursor moves to the beginning of the line, but does not wrap;
\ t Insert tab;
\v is the same as \f;
\ \ insert \ character;
\NNN inserts the ASCII character represented by the NNN (octal);
Help Display Help
–version displaying version information

Tty
Format: TTY [OPTION]
Purpose: Prints the file name of the terminal that is connected to the standard input.

Parameters
-S--quiet--silent//does not print anything, only returns an exit status

Export
Format: Export [-fnp][variable name]=[variable setting value]
Purpose: Set Environment variables

Parameters
-F represents the function name in [variable name].
-n Deletes the specified variable. The variables are not actually deleted, but are not exported to the execution environment of the subsequent directives.
-p lists all the environment variables that the shell assigns to the program.

Instance
[Email protected] ~]# export
Declare-x histcontrol= "Ignoredups"
Declare-x histsize= "1000"
Declare-x home= "/root"
Declare-x hostname= "Localhost.localdomain"
Declare-x lang= "en_US. UTF-8 "
Declare-x lessopen= "| | /usr/bin/lesspipe.sh%s "
Declare-x logname= "Root"
      Declare-x ls_colors= "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01: Or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01        ; 31:*.arc=01;31:*.arj=01; 31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01; 31:*.zip=01;31:*.z=01;31:*. Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31 :*. TBZ 2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:* . alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*. Gif=01;35:*.bmp=01;35:*.pbm=0 1;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*. tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:* . m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01; 35:*.MP4=01;35:*.M4V=01;35:*.MP4V=01;35:*.VOB=01;35:*.QT=01;35:*.NUV=01;35:*.WMV=01;35:*.ASF=01;35:*.RM=01;35: *.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.      yuv=01;35:*.cgm=01;35:*. emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*. midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*. Spx=01;36:*.xspf=01;3 6: "
Declare-x mail= "/var/spool/mail/root"
Declare-x oldpwd
Declare-x path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
Declare-x pwd= "/root"
Declare-x selinux_level_requested= ""
Declare-x selinux_role_requested= ""
Declare-x selinux_use_current_range= ""
Declare-x shell= "/bin/bash"
Declare-x shlvl= "1"
Declare-x ssh_client= "192.168.1.101 49601 22"
Declare-x ssh_connection= "192.168.1.101 49601 192.168.1.102 22"
Declare-x ssh_tty= "/dev/pts/0"
Declare-x term= "Xterm"
Declare-x user= "Root"
Declare-x xdg_runtime_dir= "/run/user/0"
Declare-x xdg_session_id= "2"

Pwd
Format: pwd [OPTION]
Purpose: Prints the full file name of the current working directory.

Parameters
-L directory connection link, output connection path
-P Output Physical path

Instance
[Email protected] bin]#/bin/pwd
/usr/bin
[Email protected] bin]#/bin/pwd-p
/usr/bin
[Email protected] bin]#/bin/pwd-l
/bin

History
Format:
Purpose: Mainly used to display historical instruction record content, release the order in the history record

Parameters
N: number, to list the most recent n-pen commands
-C: Eliminate all history content in the current shell
-A: Add the current New History command to Histfiles, and if there is no histfiles, the default write ~/.bash_history
-r: Read Histfiles's contents into the current Shell's history memory
-W: Writes current history memory content to Histfiles

Instance
[[Email protected] ~]# history 10
Show the last 10 commands
[[email protected]] #!99 (! And 99 no spaces in the middle)
Execute line 99th of the History List command
[[email protected]] #!!
Executes the previous command
[[Email protected]]# History | More
List all history on a per-screen basis:
[[Email protected]]# history-c
Clear History list

Shutdown
Format: Shutdown [-effhknr][-t seconds] [TIME] [warning message]
Purpose: Securely shuts down or restarts the Linux system, prompting a warning message to all logged-in users on the system before the system shuts down
This command can only be used by super users

Parameters
-C when the "shutdown-h 11:50" command is executed, the shutdown instruction can be interrupted by pressing the + key.
-F does not execute fsck when restarting.
-F to perform fsck upon restart.
-H shuts down the system.
-K simply sends out information to all users, but does not actually shut down.
-N does not invoke the INIT program to shut down, but by shutdown itself.
-R shutdown after reboot.
Number of seconds between-t< seconds > send out warning message and delete information.
[TIME] Set how long after the shutdown instruction is executed.
[Warning message] information to be transmitted to all logged-in users.

Instance
[[Email protected]]# shutdown–r +10
The system shuts down after 10 minutes and restarts immediately.
[Email protected]]# shutdown–h Now
System shuts down immediately

Reboot
Format: Reboot [-n] [-W] [-d] [-f] [-I.]
Purpose: Restart Linux system

Parameters
-D do not write data to the record file when restarting/var/tmp/wtmp
-F Force reboot, do not invoke the function of shutdown instruction
-H put all the hard drives in standby mode before the system shuts down or Poweroff
-I shut down network settings and then restart the system
-N Save the data and then restart the system
-W tests only, does not really turn the system back on, only writes the reboot data to the Wtmp record file in the/var/log directory

Hwclock
Format: hwclock [function] [option ...]
Purpose: Display and set hardware clock

Parameters
--adjust Hwclock is recorded in the/etc/adjtime file each time the hardware clock is changed. The--adjust parameter allows the Hwclock to estimate the deviation of the hardware clock based on previous records and use it to correct the current hardware clock.
--DEBUG displays detailed information on Hwclock execution.
--directisa Hwclock presets To access hardware clocks from/DEV/RTC devices. If not accessible, this parameter can be used to access the hardware clock directly with the I/O instruction.
The--hctosys adjusts the system clock to match the current hardware clock.
--set--date=< Date and time > Set hardware clock.
--show Displays the time and date of the hardware clock.
The--SYSTOHC adjusts the hardware clock to coincide with the current system clock.
The--test only tests the program without actually changing the hardware clock.
--UTC to use GMT, add this parameter, and Hwclock will perform the work of the conversion.
--version Displays version information.

Date
Format:
Date [OPTION] ... [+format]
Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]

Use: can be used to display or set the date and time of the system

Tag List
Time aspects
%: Printed%
%n: Next line
%t: Jump Grid
%H: Hours (00-23)
%I: Hours (01-12)
%k: Hours (0-23)
%l: Hours (1-12)
%M: minutes (00-59)
%p: Show local AM or PM
%r: Direct Display time (12-hour format, HH:MM:SS [ap]m)
%s: Number of seconds from January 1, 1970 00:00:00 UTC to date
%s: Seconds (00-60)
%T: Direct Display time (24-hour system)
%x: Equivalent to%h:%m:%s
%Z: Show Time zone
Date aspects
%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: Show date directly (MM/DD/YY)
%h: With%b
%j: The first day of the Year (001-366)
%m: Month (01-12)
%u: Week of the Year (00-53) (Sunday is the first day of the week)
%w: Day of the Week (0-6)
%W: Week of the Year (00-53) (with Monday as the first day of the week)
%x: Show date directly (MM/DD/YY)
%y: Last two digits of the year (00.99)
%Y: Full year (0000-9999)
Parameters
-D datestr: Displays the time set in the DATESTR (non-system time)
--HELP: Display Auxiliary message
-S DATESTR: Set the system time to the time set in Datestr
-U: Show current GMT
--version: Show version number

Instance
[[Email protected] ~]# Date
Fri Jul 7 13:00:25 EDT 2017
Show time
[Email protected] ~]# date-d next-day +%y%m%d
20170823
[Email protected] ~]# date-d next-day +%f
2017-08-23
[Email protected] ~]# date-d next-day ' +%f%T '
2017-08-23 09:44:16
[Email protected] ~]# date-d next-month +%y%m
201709

Some instructions on Linux system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.