linux common instruction set

linux common instruction set

1.1 cd command to switch directories 

Syntax: cd <Path>

Meaning: cd change directory is an abbreviation of; behind the cd command with a path, the path for switching the current user is located, where the path can be either absolute or a relative path.

Example:

cd / system / bin represented by the switch to / system / bin path.

CD logs handoff to the logs path.

cd / handoff to the root directory.

cd ../ handoff to the path layer.

1.2 ls command lists all files in the current directory

Syntax: ls <parameter> <path>

Meaning: ls is a list of abbreviations; ls command may be followed by a path or parameter may not follow, represent lists all files in the current directory or path. The most commonly used parameter is the "-l", which is "ls -l" command.

Example:

ls / display all files and folders in the root directory.

ls -l / data displays detailed information about all the documents and files / data path to the folder.

ls -l displays detailed information about all documents and files in the current folder path

ls * l wc display the current directory number of files below.

1.3 cat command reads the contents of the file

Format: cat <file>

Meaning: cat is short for concatenate. It represents the contents of the file and read the file stitching.

Example:

cat / sys / devices / system / cpu / online online file read / sys / devices / system / cpu / path contents.

cat test.txt test.txt read the current path of the file contents.

1.4 rm command to delete a file or folder

Command Format: rm <file> or rm -r <folder>

Meaning: rm is the remove of abbreviations. Used to delete a file or folder, common parameters -r -f, -r means to delete a directory, can also be used to delete files, -f indicates a mandatory delete, do not need to confirm. Similarly, before deleting the files need to ensure that the current user has permission to modify the current path.

Example:

rm -rf path delete path.

rm test.txt 删除test.txt。

 

1.5 mkdir command to create a folder

Format: mkdir folder

Meaning: mkdir make directory is an abbreviation of. Used to create the folder. Before you can create folders need to ensure that the current user has permission to modify the current path.

Example:

mkdir / data / path to create a folder in the path / data path.

mkdir -pa / b / c The parameter -p used to create multi-level folder, the phrase command represents a folder created in the current path, and a folder contains subfolders b, b under the folder contains subfolders and c.

 

1.6 cp command to copy a file or folder

Syntax: cp <file> <target file> or cp -r <folder> <target folder>

Meaning: cp is copy acronym. For copying a file or folder.

Example:

cp / data / logs / data / local / tmp / logs in the copy logs / data path to the next / data / local / tmp path.

cp 1.sh / sdcard / copied to the 1.sh / sdcard the current path.

 

1.7 kill command to end the process

Syntax: kill PID code

Meaning: the end of the current process

Example:

First ps au see the process by entering the command, find the need to terminate the process PID through the kill PID can be, as I have here want to terminate the process is vim test.py, PID is found in 3163, we can enter the end of this kill 3163 program, if not end, it can force kill -9 PID code by the end of that kii -9 3163

In addition to these seven commands, there are many common commands such as pwd command, you can view the current path, this is useful for mobile data collection or organize your files list when; tar command, this file can be compressed; unzip command, this can for file decompression, in fact, there are many such commands, we need to continue proficient in use of the process, we need to constantly review study.

1.8 documents show command
more: display file contents with page;

less: display file contents with page;

grep: query in the file, grep -n "Find what" the file name;

 

| [Conduit command]: and the linux unix system | Pipe command is, on the results of a command to | back a command for processing.

    Example: grep -n "Find what" filename | more

cat: after connecting the output to a screen file or string plus> fileName to another file.

head: Format: head [-n | c num] fileName, Description: displaying content file header. Without parameters, shows the most first 10 rows.

tail: Format: tail [-n | c num] fileName, Description: Displays the end of the file content. Without parameters, displays the last 10 lines.

cut: Format: cut -cnum1-num2 filename, Description: display counting from the beginning of each line to num1 num2 characters.

1.9 File Search commands the Find
the Find: search for files and directories

    In linux, because the file system is level-style structure consisting of, so to find specific files and directories is not an easy thing in the whole system. The find command can solve these problems.

    1, in the search for a specific directory and display files and directories specified name.

    find / -name man: This means that from the root directory to start the search for the man the name of the file or directory.

    2, in the search for some time to be accessed / changed files or directories

    find / home-amin -10: ten minutes to access files or directories

    find / home-atime -10: ten hours the file or directory memory taken

    find / home-cmin -10: ten minutes changed files or directories

    find / home-ctime -10: change in 10 hours over a file or directory

    3, specify the size of the file search

    find / home-size + 10k: This means that the size of the find / home directory for the 10K file.

Other command
who: Format: who - [husfV] [user ]. Description: Displays which user logs into the system, the terminal information includes user ID, are to be displayed, on-line time, slack time, CPU usage, and the like actions. Related command: who am i: show who the current user Yes.

    sleep: Format: sleep [--help] [--version] number [smhd]. Description: sleep may be used to delay the operation of the current period.

    kill: Format: kill [-s signal] pid ... or kill -l [signal]. Description: kill send a specific signal (signal) to the process ID for the process pid. Done based on the specific operation signal, if not specified, the default is sent to terminate (the TERM) signal.

    ps: Format: ps [options] [--help]. Description: Displays the name of the process, taking up resources, status.

    top: Description: Displays CPU usage, memory size, memory usage, process status.

commonly used shortcut commands
1, tab = completion

    2, ctrl + l -: clear the screen, similar to the clear command

    3, ctrl + r -: Find command history (history); ctrl + c = termination

    4, ctrl + k = delete here to the end of all content

    5, ctrl + u = delete all the content here to start

    6, linux help command in: man, info, - help [[root @ localhost ~] # man ls; [root @ localhost ~] # info ls; [root @ localhost ~] # ls -help]. Exit help, press the shortcut key q

 

Guess you like

Origin www.cnblogs.com/yu753526303/p/12532879.html