Linux Getting Started _2-basic commands

Source: Internet
Author: User
Tags time zones set time time and date

Getting Started with Linux-basic commands Catalogue? date commands date? Modify time zone? Calendar command cal? Shutdown Start command Halt,reboot,poweroff? WhoAmI, who, who am I, W screen echo? How do I use it? How do I use the {}? TAB completion? History commandDay Command DateLinux: System boot, startup time and date information from hardware read, after reading, hardware-independent system clock hardware clock Date: System clock     Display Date Time: Date [OPTION] ... [+format] Format formatting character %F full date; same as%y-%m-%d %T time; same as%h:%m:%s%s seconds since 1970-01-01 00:00:00 UTC +%y display year +%m display month +%d display day +%h display +%m display minute +%s display seconds +%w Show Week Set Date time: Date [MMDDHHMM[[CC]YY][.SS]]Day of the month and year. seconds Hwclock/clock Hardware ClockDisplay or set the hardware clock-S:--HCTOSYS-W:--SYSTOHCModify Time ZoneTime zone file location:/usr/share/zoneinfo/The time zone is in use:/etc/localtime CentOS 6:Ln-f/usr/share/zoneinfo/america/new_york/etc/localtimeln-f/usr/share/zoneinfo/asia/shanghai/etc/localtime CentOS 7:Timedatectl View the current time zone Timedatectl list-timezone View all time zones timedatectl Set-timezone america/new_york set time zonetimedatectl set-timezone Asia/shanghaiCalendar Command calCAL Displays the month calendar Cal yyyy displays the calendar for the specified year CAL-Y displays the calendar for the current year cal-3 shows the calendar for the month of the month CAL-1 with the CAL display month calendar cal mm YYYY displays the calendar for the specified year, monthshutdown Start Command Halt,reboot,poweroffHalt or poweroff shutdown centos7:poweroff reboot reboot Reboot-f Direct power off and restart. shutdown   Shutdown–r (reboot) restart Shutdown–h (halt) shutdown shutdown–c (cancel) cancel shutdown (performed at another terminal) shutdown +0 Direct shutdown shutdown +xx x X minutes after shutdown shutdown hh:mm specified time offWhoAmI, who, who am I, WWHOAMI Display current user name who am I displays the currently logged in terminal information who displays the current terminal information for all logins W displays details of all currently logged-in terminals ScreenI call it a hidden process, we can iterate through a process, and when our items are closed, the program in screen is still not interrupted. Screen enters the screen name with the current terminal name. hostname prefix screen-s screenname Set the screen name and enter the hidden process Screen–x [Session] Join screen session ctrl+a,d Peel the current screen session (press CTRL + A and press ctrl+d) Screen-ls or--list View all of the current screenScreen-r Screenname restores a screen. ctrl+d or exit Exit current screen (session)Echo-N does not wrap-e (default) does not explain \ - e explanation \\a alarm \b Backspace \c do not break line \ n newline, enter \ r from the beginning of the line, move the beginning but not the newline \ t enter tab \ \ Enter a \ echo "$VAR _name" variable will be replaced, weak reference echo ' $VAR _name ' variables are not replaced, strong referencesHow to use the $The $ variable name refers to the value of the variable $ () or "the result of the reference command execution $[] operation ${variable name} or" $ variable name "When the variable name starts and ends, it is used to delimit the range of the variable name and reference the variablehow to use {}{A.. Z} indicates that the letter {1..9999} that references the specified range refers to a number {1,3,5} that references the specified range, each of which refers to each character touch Du{1,2,3}.duduTab CompletionCompletion: Used to make up a command or path \2tab all files under the root list ~2tab all files listed under the home directory. 2TAB all files in the current directory are listed, including hidden files *2tab all files in the current directory, not including hidden files $2tab Show all current environment changes AmountHistory CommandHistory [-c] [-D offset] [n] history-anrw [filename] history-ps arg [arg ...] -C: Empty command history-doffset: Delete the specified offset command in history N: Show the recent n history-A: Append this session to the new command history list to history file-N: Read unread rows to History list in history file-r: Read History file Append to History list-W: Save History list to specified history file-P: expands history parameter to multiple lines, but does not exist in the history list-S: Expand Historical parameters into a row, appended to the history list history Displays the current terminal's historical record!!    Repeat the previous command!-n repeat the nth command!n repeat the nth command ctrl+p equals the UP ARROW key to turn the previous command.    CTRL + N equals the down ARROW key, and the next command is flipped out. Ctrl+j equals Enter to execute the current command!:0 Executes the previous command (remove parameter)!string repeats the previous command preceded by "string"!? String repeats the previous command containing string    !string:p prints only the history of the command beginning with string, not the contents of the!$:p printout!$ (the last parameter of the previous command)!*:p the contents of the PrintOut!* (all parameters of the previous command) ^string delete the first s in the previous command Tring ^string1^string2 Replace the first string1 in the previous command with a string2!:gs/string1/string2 replace all string1 in the previous command with string2

ctrl-r to search for commands in command history    (Reverse-i-search) ':      Ctrl+g: Exiting from historical search mode      To recall the last parameter in the previous command:!$ representsESC,. (Click the ESC key and then release and click.)     ALT +. (Hold down the ALT key while clicking.)     Command history-related environment variables histsize: Number of Histfile: Specify history file, default to ~/.bash_history Histfilesize: History Number of commands history file Histtimeform at= "%F%T" Show Time histignore= "STR1:STR2: ..." Ignore string1.string2 history

Control the history of the command record method: Histcontrol

Environment variables:  

ignoredups default CONTROL, ignoring duplicate commands, continuous and identical to "repeat"

Ignorespace ignores all commands beginning with whitespace ignoreboth equivalent to ignoredups, ignorespace combination erasedups Delete Duplicate command store in/etc/profile or ~/.bash_profileOther ways to use command!^: Use the first parameter of the previous command to cmd command!$: Use the last parameter of the previous command to do cmd parameter command!*: Use all parameters of the previous command to do the cmd parameter C Ommand!:n: Use the nth parameter of the previous command to cmd the command!n:^ call the first parameter of the nth order!n:$ to invoke the last parameter of the nth command, command!n:m to invoke the second of the nth command The parameter command!n:* invokes all the parameters of the nth command!string:^ search for a command starting with string from the command history and obtains its first parameter, command!string:$, from the command history to Stri Ng starts the command and gets its last parameter command!string:n from the command history, searching for the commands starting with string, and getting its nth parameter command!string:* from the command history, searching for commands starting with string and obtaining Take all of its parameters

Linux Getting Started _2-basic commands

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.