1.cd:[-l 丨 [-p[-e]] [dir]
CD DIR: Switch the working directory to
CD: Switch The working directory to the home directory of the currently logged in user
CD-: Switch working directory to previous working directory: Switch back and forth between two directories;
CD ~: Switch working directory to home directory
CD ~username: Switch The working directory to the home directory where the user "username" is being developed, limited to the root user
2.PWD:PWD[-LP]
Print the name of the current working dirctory
3.ls:
In the Linux file system, all with "." The beginning of the file name, all means hidden files;
Options:
-A: Displays all files, including hidden files;
-A: Displays except "." and ".." All files, including hidden files;
-D: The contents of the directory are not displayed and only the directory name is displayed;
-L,--Long: Displays detailed properties of a file in long format
Drwxr-xr-x. 2 root root 18 December 06:50 account
D: File type identification
Rwxr-xr-x: Permission settings for files;
RWX: The owner of the file has permissions
R-x: Permissions of the genus Group of the file
R-x: The permissions that other users have on the file
.: Indicates whether the file has a special attribute;
2: Indicates the number of times the file was hard-connected;
Root: Indicates the owner of the file
Root: Represents a group of files
18: Indicates the size of the file
December 23 06:50: Time the file was last modified
Account: File name
In the device file
BRW-RW----. 1 root disk 8, 0 March 13:30 SDA
8: Main device number (major), which identifies the device type, and then determines which driver to load;
0: This device number (minor)
The device number uses a 8-bit binary representation, and the default representation range is 0-255
-H: And L are used simultaneously, easy to read file size format, usually using 1024 binary conversion
-r: Reverse output result
-R: Recursively displays content in directories and subdirectories
-Z: Display the file's SELinux security context (Secrity context)
LS Exit status code:]# echo $? : You can view the exit status code
0: Successful execution
1: There are minor problems in the execution process such as sub-directories cannot be accessed etc.
2: There is a serious problem in the execution process, such as the destination file or directory does not exist
4.mkdir:
Options
-P: When creating a directory, if its parent directory does not exist, it is created first;
-V: Displays the execution of the command when the command is executed
5.rmdir:
Only empty directories can be deleted, non-empty directories cannot be deleted, and non-directory files cannot be deleted;
-P: Delete the directory if its parent directory is deleted.
-V: Displays the execution of the command when the command is executed
6.RM:
Options
-I: Prompt for interactive removal with users
-F: Force delete without any hint
-R: can be recursively deleted
7.touch: Timestamp used to modify the file
Options
-C: Do not create the file (do not create this file without the-c)
-T: Modification time is ...
8.stat
-C Format: Display specific properties of a file in a specific format
9.nano text Editing tool, simple text document editing without formatting specifications need to knock yourself
^: de-Char, which represents the CTRL key
^+o: Saving document content
^+x: Launch editor
10.cat: can view file contents
-B: Row-by-line numbering for non-empty rows
-N: Number by row for all rows
-S: Merge blank rows, merge multiple lines of white space behavior row
-E: Displays the line terminator at the end of each line in the document, denoted by "$";
Note: If no parameters are given, the operation is done with standard input and the ^+d exits with the last.
Reverse output of 11.tac:cat
12.head: Show the first part of the file
-N #: Displays the first n rows of the file, or it can be abbreviated to-#
-C #[b 丨 k 丨 m 丨 g]: Displays the first # Characters of a file
1b=512byte 1k=1024byte
If no option is added, the first 10 lines of the file are displayed by default;
13.tail: Show the back part of the file
-F: Always monitor the changes at the end of the file, using ^+c launch;
Other commands like the head command
14.more, less paging displays the contents of the file (less can be viewed with N)
-------------------------
Date time-related commands:
15 Hardware Clock:
Hwclock,clock:
-S,--hctosys: Set the system clock as a reference to the hardware clock
-W,--SYSTOHC: Set the hardware clock as a reference to the system clock
--set--date "Time": Sets the hardware clock to the times represented by
16 System Clock: Date
Modify system time:]# date-s "2017-11-11 10:10:10"
]# Date "111110102017.10"
%F: Full format date: year-month-day
%s: timestamp, the number of seconds elapsed from January 1, 1970 to the current system time;
%T: Full time format: minutes: Seconds
+ cal: Show Calendar of the month
-y displays year-round calendars
NTP server: Network Time Protocol
18. Shutdown command
Halt, Poweroff: Force shutdown shut down all program power may corrupt process data
Shutdown
-H: Shut down the system
-R: Reboot (reboot)
Time:
Absolute time: 12:00
Relative time: +#, executed after # minutes
+0=now immediately
19. Logout, log out
Exit: End the current shell
Logout
^+d
20.cp:cp[option] ... SOURCE DEST (Single source replication)
Cp[option] ... SOURCE ... DIRECTORY (Multi-source replication)
Options
-D: Copy the source if it is a symbolic link file, copy the symbolic link file directly to the target location instead of the file it is linked to
-P: The ability to retain file permissions, ownership, and timestamp information when copying files;
-R,-r: The ability to recursively copy directories and files in a directory;
-A: equivalent to the combination of-DPR options;
Attention:
1. A minimum of two parameters are required to use the CP command:
2. Typically, the last parameter is the target of this replication;
3. If a single source replication, the target can not exist, the target can be non-directory files;
4. If you are making multi-source replication, the destination must be a directory and the file name cannot be changed during replication;
21.MV:
MV [OPTION] ... SOURCE DEST
MV [OPTION] ... SOURCE ... DIRECTORY
Options:
-F: Forcibly overwrite the target location to rename the file;
-----------------------------------------------------------------------
All of these are lessons summary, in the course of their own review when found that more or less a small error, take the CP, copy files to the target directory should be added "/" after the target directory. Very small details, reflect that they really lack of practice, just visible that point of practice time is far from enough, usually need to practice more, often think of the role of each command, to use the command to express their words. Practise more, practise more and practise more.
Linux Basic Command Summary