1,date Time management view system time
Date [MMDDHHMM[[CC]YY][.SS] Modify Time or date-s
+%d Display
+%d Show month/day/year with +%m/%d/%y
+%f Same as%y-%m-%d
+%m Month
+%h Hour
+%m Minute
+%s Second
+%t Time:same as%h:%m:%s
+%y year
%n New Line
Case 1:
[[Email protected] ~]# Date + "This year is%y-%m-%d%T"
This is 2016-03-19 18:56:07
Case 2:
[Email protected] ~]# date + "Thin year was%Y%nthis Monte is%d"
Thin year is 2016
This Monte is 19
2. View hardware Time
Clock
Hwclock
Hwclokc-w system time Write hardware time
-S read hardware time to System time
3, get the use of the command help:
Internal command
Help COMMAND
External command
--help Get brief Help information
Command Manual
Mans COMMAND
Man sub-section Whatis see which chapter the command belongs to
1: User command (/bin,/usr/sbin,/usr/local/sbin)
2: System call
3: library Call
4: Special files (device files)
5: File format (interpreting profile syntax)
6: Game
7: Miscellaneous Inconvenience classification
8: Management Command (/sbin,/usr/sbin,/usr/local/sbin)
Man command content
Name: command names and features brief description
Synopsis: Usage Notes
DESCRIPTION: A detailed description of the command function, which may include the meaning of each option
Options: Explaining the meaning of each option
Files: This command-related configuration file
Info COMMAND online Manual (less used)
Cd/usr/share/doc (Command document)
4,cal Calendar
5,echo
Internal command
Action: Show New Line (default new row)
-N does not show new rows
-E escapes the backslash
-e Disable Escape default
\ t Transverse tab
\v Portrait tab
Case 1:
[[email protected] ~]# echo "This year is Today's 19"
This was Today is 19
Case 2: Where-E is used to escape a backslash
[[email protected] ~]# ECHO-E "This year are \ntoday is 19"
This is 2016
Today is 19
Case 3:
[[email protected] ~]# ECHO-E "This year are \ttoday is 19"
This was Today is 19
Case 4:
[[email protected] ~]# ECHO-E "This year are \vtoday is 19"
This is 2016
Today is 19
6,printf
Internal command
Function: Format and print
printf does not enable new rows by default, and the backslash is escaped by default
\ nthe new line is enabled, the new row is not enabled by default, contrary to echo
Case 1:
[[email protected] ~]# printf "This year is Today's 19"
This was Today is 19[[email protected] ~]#
Case 2:
[[email protected] ~]# printf "This year is in Today is 19\n"
This was Today is 19
Case 3:
[Email protected] ~]# printf "This was 2016\ntoday is 19\n"
This is 2016
Today is 19
7,file
External command/usr/bin/file
Role: Identify file types, identify file encoding formats
-B: Lists file identification results, does not display file names
-L: View the corresponding file type for the soft connection
-F: Specify a name file with the contents of one or more file names, let file identify each file type in turn
Case 1:
[[Email protected] ~]# file X.txt
X.txt:ascii text
Case 2:
[Email protected] ~]# File-b x.txt
ASCII text
Case 3: Show file types for files listed in file
[Email protected] ~]# more X.txt
/root/list.txt
[Email protected] ~]# file-f x.txt
/root/list.txt:ascii text
File system:
Rootfs: Root file system/-> root
First level catalog file: LS/
1,/boot: System boot related files, kernel, INITRD, grub (bootloader)
2,/dev: Device file Linux system core idea everything is file
The CDROM and DVDs in the dev directory are file forms and are soft connected to another location
Device file chunking device (random access) and character device (linear access, in characters) mouse, display is a character device
Special files are not separated by size, LL will be viewed as device number
Device number: Main device number (major) and secondary device number (minor)
3,/ETC: Configuration file Most of the profiles are in this folder (the configuration file is saved in plain text format)
4,/home: User home directory, default/home/username each user will create their own home directory in the/home directory, root user special, family directory in the/root directory, for/root
5,/lib: library file
Static Library:. A
Dynamic libraries:. So (Shared object)
The library file cannot be executed separately because there is an execution portal, so it can only be called
Kernel module file/lib/modules
6,/media Mounting Mobile devices
/MNT mount additional temporary file system mount point directory
7,/opt: Optional directory, third-party program installation directory (formerly)
8,/proc: Pseudo file system, store kernel mapping file, only after the system boot will be content
9,/sys: Pseudo file system, hardware device related property mapping file
10,/tmp: Temporary files, not accessed every one months, data is automatically clear, any user can access/var/tmp
11,/var: Changeable file
12,/bin: Executable file, user commands (common basic commands, administrators and other users can use)
13,/sbin: Administrative Commands (System Startup Repair used, only administrators have permission to use)
14,/USR: Globally shared read-only files (System run-time use)
/usr/bin
/usr/sbin
/usr/lib
The following are third-party software use
/usr/local
/usr/local/bin
/usr/local/sbin
/usr/local/lib
File naming rules
1, length cannot exceed 255 characters
2, cannot use/when file name
3. Strictly case-sensitive
File Management
Directory Management
1,mkdir Creating a Folder
Hierarchy is required by default to create a hierarchy of directories
-P: Create multi-level catalogs at once
-V: Show Create directory procedure
Case 1: Creating a/tmp/x/m/tmp/y (a command creation)
[Email protected] ~]# mkdir-pv/tmp/x/m y
mkdir:created directory '/tmp/x '
mkdir:created directory '/tmp/x/m '
mkdir:created directory ' Y
or use the {} function to expand
[[email protected] ~]# Mkdir-pv/tmp/{x/m,y}
mkdir:created directory '/tmp/x '
mkdir:created directory '/tmp/x/m '
mkdir:created directory '/tmp/y '
Create A_b,a_c,d_b,d_c under Case 2:/tmp
[[email protected] ~]# Mkdir-pv/tmp/{a,b}_{b,c}
mkdir:created directory '/tmp/a_b '
mkdir:created directory '/tmp/a_c '
mkdir:created directory '/tmp/b_b '
mkdir:created directory '/tmp/b_c '
2,tree Viewing the directory tree
3,rmdir Remove directory, only empty directories can be deleted
File Management
1,touch: Modify Timestamp
Timestamp: 1, Access time 2, modification time 3, change time
-C: If the file does not exist, it will not be created and the file will be created by default
-A: Change access time only
-M: Change the modification time only
-T: Modify timestamp to specified time
Change time cannot be modified individually because any property of the file can affect the change time
2,stat: View file properties, including timestamp information
3, File editor create file
4,RM: Deleting Files and directories
-R: Recursive delete
-F: Force delete
-I; Interactive Delete will ask whether to delete
System default Modify RM command alias to Rm-i
5,cp:copy
Copy a file to a file
Copy multiple files to a directory
-R: Recursive replication
-I: Interactive
-F: Forced replication
-P: Preserve source file attributes, owner, group, timestamp
-A: Archive replication, often used for backup
-P: Maintain link-owned properties
-L: Copy the file that the link points to
6,mv:move
Moving files
7,install
Copying files, setting properties
-D: Create a Directory
-M: Specify permissions with execute permission by default
Cannot copy directory
8,DF Viewing disk usage size
9,du Viewing directories and sub-file sizes
-C Show Total
-H to k,m,g display
Text Processing
Text view
1,cat link file and output
-N: Show line numbers
-E: Display line terminator, for Linux, the text line terminator is $
2,tac:cat in turn, display with cat reverse
3,more: Usage is similar to cat, but more can be viewed by split screen
4,less: Split screen view, with more difference is less if not quit can flip up the screen
5,head: View Top N rows
6,tail: View after n rows n default to 10
-N: Specify before or after a display
-f:follow, when using the-f parameter, look at the end of the file, do not exit wait for new additions to appear
Text Processing
1,cut: Select the command, analyze a piece of data, take out what we want is to analyze the line rather than the entire
-D: Specifies the field delimiter, which is a tab by default
-F: Specify the fields to display
Case 1: Display the first segment of the top 5 rows of/tmp/passwd with: delimiter
[Email protected] ~]# CAT/TMP/PASSWD | Head-n 5 | Cut-d:-F 1
Root
Bin
Daemon
cd/
Lp
2,sed
3,awk
This article is from the "Advanced" blog, be sure to keep this source http://ccnepi.blog.51cto.com/2583348/1753291
Marco Linux Learning Notes