linux some instructions notes

Distinction space character-sensitive
virtual machine password RedHat
systemctl restart the service name to restart the service
systemctl start the service name to start the service
systemctl stop service names out of service
systemctl enable the service name is added to the startup items
systemctl status service names check the service status

systemd service name
systemctl Configuration Name

After the short-form merger -a -l merged into -al

Reboot to restart the service period
Poweroff shutdown

Ps view parameters
Ps -a -u -x merger process ps aux Show Details

Free to view memory usage cases free-h

Who name of the current user logged
Last View Log records all system

History View history command execution record! + Digital implementation of the above command a view of a free space
history -c clear historical operating instructions

sosreport for the collection of system configuration and schema information and diagnostic output document format sosreport

pwd displays the user is currently in the working directory format option pwd {}

path switching operation cd
cd - command to return to the time at which the directory
cd .. command to enter the parent directory
cd ~ command to switch to the current user's home directory
cd ~ username to switch to another user's home directory

ls displays files in the directory information in the format ls [options] [file]
ls -a parameter see all the files
property details, size ls -l parameters can view files and other
post-merger ls -al shows that when all the files and directory files details
cat command is used to view the plain text files (less contents), the format of "cat [option] [file]" wanted to show the way, line numbers when viewing text, may wish to append a cat -n command in the back parameter

more used to view the plain text files (more content), the format is "more [options] file"

N lines before the head command is used to view the plain text of the document in the format of "head [options] [file]"

tail command for viewing after the N line plain text document or continue to refresh the content in the format of "tail [options] [file]"

tr command is used to replace characters in a text file, the format of "tr [original character] [target character]."

wc command line number of specified text, words, bytes, the format of "wc [parameter] Text"
-l displays only the number of rows
-w display only the number of words
-c show only the number of bytes

Press cut command "column" extract text characters, the format of "cut [parameter] Text"

Comparing the plurality of difference diff command text file, the format of "diff [parameter] File"

Time touch command to create a blank file or set of files in the format of "touch [options] [file]"
-a modified only "access time" (atime)
-m to modify only "modification time" (mtime)
-d same time modify atime and mtime

mkdir command to create a blank directory format "mkdir [options] directory" mkdir -p parameter command may also be combined to create a file directory recursively nested in stacked relationship.

cp command to copy a file or directory, in the format "cp [options] source file destination." We copy the file operation should not be unfamiliar, the Linux system, the copy operation is divided into three specific cases:
if the target file is a directory, it will copy the source files into the directory;
if the target file is an ordinary file, you are asked Do you want to overwrite it;
if the target file does not exist, do a normal copy.
Effect parameters
-p retain the original file attributes
-d if the object is "linked files", the "file links" of the property reserved
-r recursive continuous replication (for directory)
-i If the target file exists asking to overwrite
-a corresponds -pdr (p, d, r is the above parameters)

mv command is used to cut the file or rename the file, the format is "mv [options] source [destination path | destination file name]" cut operation is different from the copy operation, because it will default to delete the source files, only keep the file after shearing.

rm command is used to delete a file or directory, in the format "rm [options] files" in the Linux system files are deleted, the system will default to ask you whether you want to perform the removal, if you do not always see this repeated confirmation , you can keep up with the -f option, after rm command to force deletion. In addition, you want to delete a directory, you need to add a command rm -r parameter in the back before they can, or can not afford to delete.

dd command in accordance with the specified data block size and number of files to copy or convert the file format "dd [parameter]."
                                               dd command parameters and their effect
parameter action
if the input file name
of the file name of the output
bs setting each "block" the size of the
count is set to be copied "block" number

The type of file command is used to view files in the format of "file filename

tar command is used to package a file compression or decompression, the format of "tar [options] [file]"
parameter role
-c create a compressed file
-x Extract the files
-t to see what files compressed within the package
-z with Gzip compression or unzip
-j bzip2 compression or decompression with the
-v display compression or decompression process
-f target file name
-p preserve the original permissions and attributes
-P use an absolute path to compress
-C specify the directory to unzip

grep command is used to perform a search keyword in the text, and display the results match the format of "grep [options] [file]"
parameter role
-b executable file (binary) as a text file (text) to search
- c only to find the number of lines
-i ignore case
-n show line number
-v Invert selection - lists only the bank did not "keyword" of.

find command to find the conditions for the specified file, the format of "find [Search Path] Operating conditions for finding"
find / -name file name
parameter contribution
-name matching name
-perm matching permission (mode as an exact match, i.e., comprising -mode can)
-user match the owner
-group match all groups
-mtime -n + n match modify the contents of the time (-n refers to within n days, + n n refers days ago)
time -atime -n + n match access to the file ( -n refers to within n days, + n n refers days ago)
-ctime -n + n match modify file permissions time (n -n refers within days, + n n refers days ago)
-nouser not match the owner of the file
- All groups nogroup match no files
-newer f1! file matching ratio f2 f1 than f2, but the new old file
--type b / d / c / p / l / f match the file type (hereinafter subtitle letters sequentially block device, directory, character device, piping, link files, text files)
size -size matching files (+ 50KB to 50KB look over the documents, and -50KB to find files less than 50KB of)
-prune ignore a directory
-exec ...... { } \; may be further processed after the command with search results for ( Wen will demo)

Spacer cut -d -f file name column number

$? Is displayed on a statement whether the value of success
$$ If successful execution in front of the rear
|| if it fails to perform in front of the back
! Negate

      Vim commonly used commands
Command Function
dd removed (cut) the entire line cursor
5dd removed (cut) 5 lines starting from point
yy copy the entire line cursor
5yy replication 5 lines starting from point
n to display the search command is positioned next to a string of
N displays the search command to locate a string
u undo the last operation
p previously deleted (dd) or copy (yy) through data pasted to the cursor back
line mode is mainly used for storage or exit the file, and set the Vim editor working environment, but also allows the user to perform an external Linux commands or jump to a specific number of lines written document. To switch to the last line mode, enter a command mode in the colon it. Available command line mode as shown in Table 4-2.
Table 4-2 command line mode available in the
command role
: w save
and: q
: q Force Quit (discard the changes the contents of the document)!
: WQ forced to save and exit!
: The SET NU display line numbers
: set nonu not display line No
: command to execute the command
: integer jumps to the line
: s / one / two current cursor row replace the first one TWO
: s / one / two / one G all the line where the cursor is currently replacing two
: S% / one / two / G are all replaced by one full two
strings from the bottom of the search string in the text?
/ Search string in the text string from top to bottom

After opening practice.txt document, the default mode is the command to enter the Vim editor. At this point can only execute commands in this mode, and not freely enter the text, we need to switch to input mode can only be written in the document. After entering the input mode, you can freely enter the text, Vim text editor does not put your input as command execution

Comparison operator is an operation of integer numbers only, can not operate with a digital string, file contents, etc., and can not assume the use in daily life equal sign, greater-than, less-than sign or the like is determined. Because of the equal sign character conflict with the assignment command, respectively greater than and less-than output redirection command number and character input conflict redirect command character. Use must therefore integer comparison operators to operate. Available integer comparison operators shown in Table 4-4.
Table 4-4 integer comparison operators available
operator action
-eq is equal
-ne not equal
-gt is greater than
if less than -lt
-le is equal to or smaller than
if greater than or equal -ge

linux users species

1: the UID administrator the root: 0
2: User the UID: 1 ~ 000
. 3: Common User UID: 1000 ~

                             Linux system common directory name and the corresponding content
content directory name should be placed in the file
/ boot boot required documents - the kernel, the boot menu and the necessary configuration files
/ dev storage of any device with an interface as a file
/ etc configuration files
/ home user's home directory
command / bin can hold a single-user mode also operate
libraries used when / lib boot function and / bin and / sbin following command to invoke
the command / sbin required during start
/ media for mount the device file directory
/ opt to place third-party software
home directory / root system administrator
/ data directory srv some network services
/ tmp "share" temporary directory that anyone can use the
/ proc virtual file system, such as system kernel, process, device and network status and other external
software / usr / local user-installed
/ usr / sbin Linux system will not be used to boot the software / command / script
/ usr / share help and documentation can also be placed to share file
/ var main storage of that change frequently, such as log
time / lost + found an error occurs when the file system, some of the missing file fragment Stored here

Physical device naming rules
common hardware device and file name of
the hardware device file name
IDE devices / dev / HD [AD]
the SCSI / the SATA / the U-disk / dev / sd [ap]
Floppy / dev / fd [0-1]
Printer / dev / lp [0-15]
CD-ROM / dev / cdrom
mouse, / dev / mouse
tape / dev / st0 or / dev / ht0

 The mount command parameters and effect
parameters acting
-a all mounted in / etc / fstab file system defined
type specified file system -t

fdisk command
on a Linux system, manage disk device most commonly used method will undoubtedly fdisk commands. fdisk command is used to manage disk partition, format is "fdisk [disk name]", which provides a set of add, delete, convert the partition functions in a "one-stop service partition." However, with the foregoing explanation of different written directly behind the command parameters, the parameters of this command (see Table 6-5) is interactive, it is particularly convenient when the hard disk device management, can be dynamically adjusted according to demand.
Table 6-5 fdisk command parameters and effect
parameters of the role of
m to view all available parameters
n add new partitions
d delete a partition information
l lists all available types of partitions
t changing a partition type
p view the partition table information
w save and exit
q quit without saving

Guess you like

Origin blog.51cto.com/14632062/2456896