Linux Common commands:
Linux File system:
1. File names are strictly case sensitive
2. Files can use any character except/unexpectedly; special characters are not recommended
3. File name cannot be longer than 255 characters
4. Files with a. Start as hidden files
Working directory: Working directory
Home directory: Home
Common commands:
PWD: View current path, printing working directory
Show working directory
1.CD ~ Back to home directory//admin can switch to other people's home directory at will
CD ~username
CD-//Switch to previous directory
Echo $PWD
echo $OLDPWD//toggle between two variables
2.ls
-A: Show all files, including hidden files
-A: Displays except. and. All files except the
-l:--long long format, long format list, which displays detailed property information for a file:
-rw-r--r--. 1 root root 89458 October 14
rw-r--r--
rw-: File owner's permissions:
r--: Permissions for file groups
r--: Permissions for other users
1: Number of times a file has been hard linked
Root: The owner of the file
Root: The genus Group of the file
89458: Size of file, Unit is byte
-h:--human-readable: The file's
-d:--directory//Display the properties of a directory
-R: Reverse display,
-R: Recursive display, contents of subdirectories under Directory
3.cat; concatenate
File Text Viewing tool
Cat/etc/fstab
-N Display Line number
-e Display line terminator $, not very useful
4.tac text File View
Reverse View//First line, change to last line
5.file
Determine the file type:
File//View files Content type:
File
6.echo
-N No Line break
-e escape character in effect
Echo-e "Hello \nworld"
echo OPTIONS "STRING"
' Echo ' interprets the following backslash-escaped characters:
\aalert (Bell)
\bbackspace//delete the previous character
\csuppres s further output
\eEscape character
\fForm Feed
\n New Line newline character
\R carriage return
\t horizontal tab Horizontal tab
\vVertical tab Vertical tab
STRING:
Single quote: Strong reference, variable reference does not perform substitution
Double reference: Weak application, variable reference will be replaced
The escape character can be referenced in ""
7.shutdown
Shutdown OPTIONS time [WALL]
-H
-P
-R
-K warning, but no shutdown
-H time
12:00//
Now + 3min
+3//Three minutes later
-C Cancel Shutdown
Wall "Wolf"//Send broadcast message to all users logged in to the host
Shutdown-r +5//5min After shutdown, will prompt everyone
Shutdown-c//Cancel, will also notify everyone
Shutdown-r +5 "Hello everyone"//shutdown with prompt information
8. Date
1.date
Date [OPTION] ... [+format]//Specify display format
Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]//Set time
The year can be two-bit, and four-bit, seconds.
Date +%f-%t
2017-01-10-13:06:47
Date "+%f%T"//
2017-01-10 17:40:15
Date +%y-%m-%d-%h-%m-%s
Month and day time
Date +s//1970.1.1 00:00 to present number of seconds, Unix system start and end time
Date +%j//The day ordinal of a year
2.clock//hardware clock, coin cell
Hwclock//Links only
-S,--hctosys//HC write to Sys
-W,--SYSTOHC//sys write to HC
3.cal
cal-j 02 2017//02 Month for the first day of the year
Aa.
Linux: The date and time information is read from the hardware when the system starts, and is no longer associated with the hardware after the read is completed
Date: System clock
Clock: Hardware Clocks
9. Homework:
which//view the full path of the command
Whereis//Command binary file path, source path, manual path
-B Binary File path
-M manual Path
-S Source Path
Whatis//often see man help documentation, there are several public
W.H.O.
-B Boot Time
-H user when logged in, from which IP landed
-R Current Run level
W Several users log in, what are they doing
-H do not display headers
Summary:
1. Components of the program 4: binary files, library files, Help files, configuration files
2.ls,cat,echo
3.date, Hwclock
Getting Started with Linux (iii)