Learning Linux command must-see (a)
One: What is Linux
Linux command is a Linux system management commands. For Linux systems, for both the central processor, memory, disk drives, keyboard, mouse, or user and other is a file, Linux system administration command is the core of its normal operation. Linux commands are of two types in the system: the built-in shell commands and Linux commands.
In the Linux operating system, one thing to note is that, linux commands (including file name, etc.) is required for the case, if the command does not enter the case, then the system will not make you expect the response to.
Two: Linux command line format
1, using a common command format
Command word [options] Parameters
Options
Short format options: a "-" symbol to guide the plurality of single-use character options may be bonded together (eg: ls -l ls -al);
Long command format options: a "-" sign guide (eg: - help).
parameter
Processed command word;
It can be a content file name, directory name or user name, etc.;
The number may be zero or more.
[root @ localhost ~] # meaning:
root: the current system user login
@: Separator
localhost: hostname
~: Catalog your current location
The # key: Indicates administrator
$: Ordinary users
2, Linux command line editing
Tab key: automatically filled
Backslash "\": force a line break
Shortcut Ctrl + U: to empty the beginning of the line u
Shortcut Ctrl + K: Clear to end of line
Shortcut Ctrl + L: clear screen
Shortcut Ctrl + C: cancel the edit command
3. The method of obtaining command help
Internal command help: Bash internal command to view the help information
--help: for most external command
Use the man command to read the manual: Use the arrow and down arrow keys to scroll the text;
Use the Page Up and Page Down keys to flip;
Press Q to exit or reading environment, press "/" Find what.
Three: Common directory / file manipulation commands
1, switch the working directory cd
cd. handover to the target position
If targeting cd ~ position, switch to the current user's home directory
cd - Change to the directory where the last execution before the cd command
Check the parent directory cd ..
cd ../../ view the parent directory
cd / root directory
2, show directory listing command ls
Ls -l show details of files
ls -a view hidden files
ls -A view hidden files, in addition to ..
ls -d display of information in this catalog
ls -h-friendly form with information display unit
ls -R inverse normalizing display (if there is a subdirectory, the subdirectory will in turn show)
pwd displays the user's current working directory
3, color-coded file type
Blue ---- directories, folders red green ---- ---- compressed executable file / command file / script
Sky Blue ---- soft link file / shortcut file huang color ---- device file / disk files Black / White ---- data file
4, statistical directory and file space occupancy du
du [options] [file or directory
-a statistical disk space occupied by all files
-h displays statistics (default count in kB)
-S size of the space occupied by only the statistics of the total size of each subdirectory is not a statistical file
For example: du -sh / var / log / statistics var / log files total amount of space
5, mkdir to create a directory
For example: mkdir test Create a test directory under the current directory
mkdir -p / aa / bb / cc create directories aa, aa subdirectory under bb, cc bb subdirectory under
6, create a file (touch) and delete (rm)
touch test.txt test.txt create a file in the current directory
touch demo {1..10} .txt create multiple new empty file
rm -f test.txt delete files text.txt
rm -r recursively deleted, delete the directory and its subdirectories under the directory
rm -rf remove the directory and its subdirectories under the directory
7, copy a file or directory cp
-f overwrite the target file with that name does not remind, copy and paste
-i file overwrite the destination with the same name and remind the user to confirm
Permission to maintain the source file when -p copy, change attributes
-r must use this option when copying directories recursively copy all the files indicate
8, to find data find file or directory
Find -name by file name
Find -size by file size
By file owner to find -user
Find -type by file type
File type: File (f), the directory (d), a block device file (b), a character device file (c)
9, view the file contents
cat from the first line displays the file contents
more display file contents page by page for full screen page display file contents
less and more similar, but more is better than extensions more
head to see the beginning part of the contents of the file (default 10 lines) Example: head -n filename (n represents a few lines)
tail end view of a small part of the file
10, the statistics file contents wc
Count the number of words in the document and other information
-l count the number of rows
-w count the number of words
-c count the number of bytes
wc and du difference:
wc: How much of the statistical content
File size statistics: du
11, filing tar command
-C: create a tarball -x: extract the -f: execute -v: Displays detailed process -p: keep the original file permissions
-t: See compressed content -C: decompression path -Z: gzip format -j: bzip2 format
Compression command: gzip, bzip2
-q: high compression ratio -d: Unzip the file
12, three operating modes vim editor
a: Representative after insertion cursor
i: inserted before the cursor representatives
o: Representative insertion cursor next line
O: Representative cursor on the inserted line
Basic operation command mode:
home key or ^, the numbers 0: Jump to the first line of the file or $ End key: jump to the end of the line 1G or gg: jump to the first line of the file
G: the end of the line to jump to the file #G: jump to the first line of the file #
: Set nu line numbers displayed in the editor
: Set nonu cancel the line number
: Set nu! Cancel line number
13, Linux boot levels mean init0-6
init 0: Shutdown
init 1: single-user mode (only root for maintenance)
init 2: multi-user mode without network interface characters
init 3: Full multiuser mode there is a network interface characters
init 4: Safe Mode (reserved)
init 5: multi-user mode graphical interface
init 6: Restart (reboot)
There are a lot of learning linux command, back to more and more practice will not forget, but also to understand the meaning of each command representatives will know what needs to be configured.