admin1.1
How to write a command line:
What is a command:
--linux command:
An instruction or program used in a class of functions;
Execution of the command depends on the interpreter (e.g. Bin/bash)
Categories of--LINUX commands:
-Internal command: part of the interpreter;
-External commands: Other programs outside the interpreter;
The general form of the command line:
-Command word--"option"--"parameter 1" "Parameter 2" ...
Example: "[Email protected]~" #ls-L/root/
Options: How to perform the control command;
---short options:-L,-A,-D,-c ...
---Multiple short options--composite options:-LH,-la,-ld ...
----long options:--help ...
Parameters: The command line action object, such as a directory or file;
-------------------------------------------------------
Quick Editing Tips:
TAB key AutoComplete: Can be filled with command words, options, parameters, file path, software name, service name.
Shortcut keys:
---ctrl+l----empty the entire screen;
---ctrl+u----emptied to the first line;
---ctrl+w----to delete a word back (whichever is the space);
---CTRL + C----Discard the currently edited command line;
---esc+.-----Paste the arguments of the previous command;
---------------------------------------------------------
Mount Mount Operation:
What is mounted:
Mount, Load:
Install devices such as discs, U-disks, partitions, and networked storage into a Linux directory.
Various command tools operate these devices by accessing the Linux directory;
Using the Mount command:
Format: Mount-----Device Path----mount point directory
Specific operation:
"[Email protected]~" #mkdir/abc create directory ABC;
"[Email protected]~" #ls/abc to view the catalogue ABC;
"[Email protected]~" #mount/dev/cdrom/abc mount device;
"[Email protected]~" #ls/ABC access to the device ABC content;
To unmount a mounted disc or partition:
#umount/abc/; unload equipment;
#ls/abc/; View the results;
----------------------------------------------------------、
To view and switch directories:
PWD---Purpose: view current working directory
CD----Purpose: Switch working directory format: CD "Destination Folder"
LS----Purpose: List document and attribute format: LS "option" "Directory or file name"
Common Command options:
-L: Display in long format;
-A: Displays all files, including hidden files that begin with the.
-D: Displays the properties of the directory itself; (cannot be used alone) (with L)
-H: Provides easy-to-read capacity units (often with L)
Use wildcard characters:
For indeterminate document names, denoted by special characters;
*: Any number of arbitrary characters;
? : single character;
Example: "[Email protected]/" #ls-D/m*
/media/mics/mnt
"[Email protected]/" #ls-d/m??
/mnt
For indeterminate document names, denoted by special characters;
"A-Z": one of multiple characters or continuous range, omitted if none;
----------------------------------------------------
New Document
mkdir: Create directory; Format: mkdir "-P" "/Path/" Directory name
"-P": indicates that the parent directory is created together;
Example: "[Email protected]/" #mkdir-P/vod/movie/cartoon
"[Email protected]/" #ls-R/vod
-r: Indicates recursive display;
A nickname for the command:
#alias myls= ' ls-ld '; define a nickname;
#unalias Myls to cancel the nickname;
To create a text file:
#touch/opt/1.txt Create 1.txt text files;
Delete : Format: RM "option"---file or directory;
#rm/opt/1.txt
Common Command options:
-I query delete;-r recursive delete;-F: Forced delete (highest priority)
Rename: The path does not change the movement ;
Format: MV "Options"---original File---destination path
Cases:
#mv opt/1.txt/opt/nds01
Copy, copy: format: CP "Options"--Original file--target path
Common Command options:
-R: Recursive, copy directory is required to have this item;
-P: Maintain the original file attribute permissions;
Cases:
#mkdir/ABC
#cp-R/boot/opt
----------------------------------------------------
Using Vim (text editor)
Format: Vim "/directory/filename"
Command mode (only see)
Input mode (input)
Last-line mode (save and exit)
Cases:
#vim/opt/haxi.txt
Last-line mode Wq save and exit
Last-line mode q! Force quit, do not save
This article is from the Linux OPS blog, so be sure to keep this source http://13401400.blog.51cto.com/13391400/1976243
The admin1.1 of the Linux operation and maintenance way