Linux use some basic commands and parameters

Basic commands

1.ls command (full name list)

ls functions : List of non-directory file entry, then every directory "to display the" File (understood as the ls command will expand this catalog down two)
ls syntax : # ls [parameters] [directory name] Note: [] represents the parameter is optional, if only # ls command indicates that the current directory is said to have directory
ls common parameters :
1. display as the -l long format (long form), listing the type of file, permissions, number of links, owner, group, size, time, name;
2. -a displays all files that contain hidden files;
3. -la show all files, including all hidden files;

2.cd command

cd functions : switch the current working directory to another directory under
cd syntax : # cd path Note: The path here has an absolute path (/) and relative path (... / or ./) in two ways, you can follow their own diet write
cd common parameters :
1.CD [relative or absolute path];
2.cd ~ (or parameters) into the user's home directory;
3.cd - prior to entering this Catalog;
4.cd ... Back parent directory;
5.CD ... / ... return to the two directories (you can always add ... back / return more upper-level directory);
6.cd / into the root directory;
. 7.cd current directory;

3.pwd command (full name Print Working Directory)

pwd functions : Displays the path name of the working directory
pwd syntax : # pwd [-L | -P]
pwd common parameters :
. 1. If the L-PWD environment variable contains the file name is not included (points) or ... (little) absolute pathname of the current directory, the value of PWD environment variable is displayed. Otherwise, -L and -P flag logo were running;
2. P-display absolute pathname of the current directory. Absolute path to the -P flag is displayed together does not contain the name of the file related to the type of symbolic link path in absolute pathname.

4.mkdir command (full name make directory)

pwd functions : to create a folder or a directory create nonexistent
pwd syntax : # mkdir
mkdir common parameters :
1. m-: rights profile;
Example: [root @ bigdata sbin] # mkdir -m 777 test3 Create a folder test3, and give read and write permissions
2.-p: help you need directly recursive directory build up
cases: [root @ bigdata sbin] # mkdir -p test / test1 / test2 now established under test test1 test2 followed by the establishment

5.touch command

pwd functions :
Function 1: used to create the file;
function 2: the existing file time stamp is updated to the current system time (default), their data will be preserved intact
pwd syntax : # touch [ option] filename
pwd common parameters :
1.-A or -time = atime or -time = access or -time = use change only the access time.
2.-c or -no-create do not create any document.
3.-d with the specified date and time, not time now.
4.-f This argument ignores not be processed, only responsible for resolving compatibility issues BSD version of the touch command.
5.-m or -time = mtime -time = modify or change only the time variation.
6.-r the date of the document or directory specified time, date and time of all set to reference the same directory or file.
7.-t with the specified date and time, not time now.

6.cp command (full name of the copy)

cp function : Copy a file or directory
cp syntax : # cp [options] filename [directory name to copy files]
cp common parameters :
1.-A or --archive effect of this parameter and specify "-dpR" parameter the same;
2. --backup-b or delete, covering the destination file to back up, back up files or directories also establish a symbolic link, and a link to the source file or directory of the source file or directory. Without this out, the copying process if encountered in a symbolic link, will direct copy source file or directory;
3.-F or --force forcibly copy a file or directory, regardless of whether the file or directory object already exists;
4 .-i --interactive ask first or overwrite the file before the user;
5. the establishment -l --link hard link or the source file, rather than copy the file;
attributes or --preserve retention 6. -p source file or directory, including the owner, owning group, permissions and time;

7.mv command (full name move)

mv functions : to move a file or rename the file
syntax of mv : # mv [options] source file or directory target file or directory
mv common parameters :
1.-B: For file cover, the front cover is backed up;
2.-f: force the mandatory sense, if the target file already exists, but will not be asked directly cover;
3.-I: If the target file (Where do you want) already exists, asking to overwrite;
4. U-: if destination file already exists, and relatively new source, will update (update);
5. the -t: mv specified destination directory, which can be useful when moving a plurality of source files to a directory, in which case the former target directory, after the source file;

8.rm command (full name remove)

rm functions : Delete a directory of one or more files or directories
rm syntax : # [options] filename or directory name directory rm
rm common parameters :
1. d-directory may still delete data (only super user);
2. F-skip file does not exist, no information is displayed forcibly deleted;
must be confirmed before 3.-i perform the delete operations;
4.-R & lt / R & lt layer also delete all directories under the directory ;

9.vim command

vim functions : simple terms is to open with the specified editing tools specified file, if you want to open the file does not exist, it will create a new blank file open
vim syntax : # vim [options] [directory /] file name
vim common parameters :
1.w: (the Write) save;
2.Q: (quit) quit if allowed to exit without saving;
3.q :( quit) forced to quit without saving exit;!
4.wq :( write & quit) save and exit;
5.x: save and exit;
6.:e:(edit) will open the built-in browser to browse the files in the current directory, the file name will be added later to open the file
7.:n file name: (new) new file;
NOTE: these operating parameters are carried out in the last line in the file open;

10.cat command

cat functions :
Function 1: once to display the entire file, distinguished in vim, it opens a way in the operating current operation, that is, use the command places; syntax : $ cat filename
function Two: Create a file from the keyboard; grammar : $ cat> filename
function three: several files into one file; syntax : c a t f i l e 1 f i l e 2 > f i l e cat file1 file2> file Note: here fact, and # before the command is the same, just a different account you log on Linux systems, using # super administrator, $ ordinary users to use
cat common parameters:
1 . -n or -number number of lines starting at 1 all outputs of the serial number;
2. B--n or -number-nonblank and similar, but not numbered blank lines;
3. -s -squeeze-blank, or when the case of to more than two successive blank lines, with a blank line on the substitution of one line;
4.-V or -show-nonprinting

The desire to help more farmers are the code, which is sort of my own, if something goes wrong you can shout!

Published 15 original articles · won praise 10 · views 584

Guess you like

Origin blog.csdn.net/weixin_44439445/article/details/102944290