Common commands:
Linux File system:
1, the file name strictly distinguishes the character casing;
2, the file can use any character except/;
3, the file name can not exceed 255 characters;
4. The file that starts with. is a hidden file;
.: Current directory;
.: The top level directory of the current directory;
/etc/sysconfig/
.: Sysconfig
..:/etc
Working directory: Working directory
Home directory: Home
Common commands:
Pwd:printing working Directory
Show working directory
Cd:change Directory
CD [/path/to/somedir]
CD: Switch home directory;
Note: in bash, ~ denotes home directory;
CD ~: Switch back to your home directory
CD ~username: Switch to the home directory of the specified user;
CD-: Switch back and forth between the last directory and the current directory;
Related environment variables
$PWD: Current Working directory
$OLDPWD: Last working directory
Ls:list, listing the contents of the specified directory
ls [OPTION] ... [FILE] ...
-A: Displays all files, including hidden files;
-A: Displays except. and. All documents other than the
-L:--long, long format list, which displays detailed attribute information of the file;
-rw-r--r--. 1 root root 8957 October 19:34 boot.log
-: File type,-, D, B, C, L, S, p
rw-r--r--
rw-: The permission of the owner of the file;
r--: Permissions of the file group;
r--: Other users (not the owner, belong to the group) of the Authority;
1: Number indicates the number of times the file has been hard-linked;
Root: The owner of the file;
Root: The genus of the file;
8957: number indicates the size of the file, in bytes;
October 14 19:34: The time the file was last modified;
Boot.log: File name
-H,--human-readable: The file size unit conversion, after the conversion results may be non-accurate values;
-D: View the directory itself rather than its internal file list;
-r:reverse, reverse display;
-r:recursive, recursive display;
Cat:concatenate
file text Viewing tool;
Cat/etc/fstab
cat/etc/passwd
Cat [OPTION] ... [FILE] ...
-N: The number of text lines to display;
-E: Displays the line terminator $;
Tac
file text Viewing tool;
Tac/etc/fstab
tac/etc/passwd
TAC [OPTION] ... [FILE] ...
-N: The number of text lines to display;
-E: Displays the line terminator $;
File: View the document content type;
file [file] ...
Echo: Echoing
echo [Short-option] ... [STRING] ...
-N: No line break;
-E: Let the escape character take effect;
\ n: Line break
\ t: Tab
String can use quotation marks, single and double quotation marks are available;
Single quotes: Strong references, variable references do not perform substitutions;
~]# Echo ' $SHELL '
Double quotes: Weak references, variable references are replaced;
~]# echo "$SHELL"
Note: Regular symbols for variable references
${name}
Shutdown or restart command: shutdown
Shutdown [OPTIONS ...] [TIME] [WALL ...]
OPTIONS:
-h:halt
-r:reboot
-c:cancel
Time:
Now
hh:mm
+m
+0
WALL
Date-related commands:
Linux: The date and time information is read from the hardware when the system starts, and after the reading is completed, it is no longer associated with the hardware;
System clock
Hardware clock
Date: System clock
Display Date Time: Date [OPTION] ... [+format]
Format: Formatting characters
%F
%T
%Y
%m
%d
%H
%M
%s
%s: from January 1, 1970 (Unix) 0 points 0 minutes 0 seconds to the command execution that moment elapsed the number of seconds;
...
Set Date time: Date [MMDDHHMM[[CC]YY][.SS]]
Hwclock, clock: Hardware clocks
Display or set the hardware clock
-S,--hctosys: Hardware-based, the system is adjusted to the same time as the hardware;
-W,--SYSTOHC: The hardware time is adjusted to be the same as the system clock, whichever is the system;
Cal: Calendar
Cal [[month] year]
Common commands for the Linux Foundation