The article directories

  • help
    • man
    • help
  • directory
    • pwd
    • ls
    • cd
  • folder
    • mkdir
    • rmdir
  • file
    • touch
    • cp
    • rm
    • mv
    • >
    • >>
    • ln
    • history
  • According to
    • cat
    • more
    • less
    • head
    • tail
    • echo
  • To find the
    • find
    • locate
    • grep
  • unzip
    • gzip/gunzip
    • zip/unzip
    • tar
  • time
    • date
    • cal

help


man

Query the Linux Help manual

Such asman manTo viewmanInstruction help,man lsTo viewlsInstructions to help

help

Obtain help for shell built-in commands

help cdTo viewcdInstructions to help



In fact, baidu is more fragrant

directory


pwd

Print Working Directory

ls

Ls [OPTION] [FILE]

parameter role
-a Show all files and directories (hidden files at the beginning of the. Are also listed)
-l In addition to the file name, it also lists the file type, permission, owner, file size and other information in detail
-r Display documents in reverse order (originally in Alphabetical order)
-t List documents in the order in which they were created
-A Same as -a, but without listing “. (Current catalogue) and “…” (Parent directory)
-F Add a symbol after listed file names; For example, “*” is added to executable files and “/” is added to directories.
-R If there are files in the directory, the following files are also sequenced



cd

CD [dirName]

parameter instructions
dirName The target directory
~ or empty Your own home directory
. The higher the directory
.. /. Go up two levels of directory

folder


mkdir

Mkdir [-p] dirName

Optional parameter -p Indicates that multi-level directories are created at the same time

rmdir

Remove Directory abbreviation, Remove an empty Directoryrm -rf)

rmdir [-p] dirName

The -p parameter indicates that if a subdirectory is deleted and it becomes an empty directory, it will be deleted as well

file


touch

Modifies the time attribute of a file or directory, or creates one if it does not exist. touch [OPTION] FILE

parameter instructions
a Change the read time record of the file.
c If the destination file does not exist, no new file will be created. The same effect as –no-create.
d You can set the time and date in various formats.

cp

Copy Copy file or directory cp [options] source dest

parameter instructions
-a This option is typically used when copying directories, preserving links, file attributes, and copying everything under the directory. The action is equal to the dpR parameter combination
-d Preserve links when copying. The links in question are equivalent to shortcuts in Windows
-f Overwrites existing object files without prompting
-i In contrast to the -f option, a prompt is given before the object file is overwritten, asking the user to confirm whether the object file is overwritten, and the object file will be overwritten when “y” is answered
-p In addition to copying the contents of the file, the modification time and access rights are also copied to the new file
-r If the source file is a directory file, all subdirectories and files under the directory are copied
-l No files are copied, only link files are generated

rm

Remove For deleting a file or directory rm [options] name

parameter instructions
-i Ask for confirmation before deleting
-f Even if the original file property is set to read-only, it can be deleted directly without confirmation
-r Delete the directory and the following files one by one

mv

Move To Move or rename files and directories mv [options] source dest

parameter instructions
-b When the target file or directory exists, a backup is created for it before overwriting
-i If you specify that the source directory or file to be moved has the same name as the target directory or file, you are first asked whether to overwrite the old file
-f If you specify that the source directory or file to be moved has the same name as the target directory or file, the old file is overwritten without being asked
-n Do not overwrite any existing files or directories
-u The move operation is performed only when the source file is newer than the destination file or the destination file does not exist

>

Output redirection overwrites the contents of the original file

>>

Append, does not overwrite the contents of the original file, but appends to the end of the file.

ln

Link Files abbreviation, set up a synchronous Link, similar to the shortcut in Windows.

In Linux file systems, there are so-called links, which we can think of as aliases for files, and links fall into two categories: The hard link and the soft link are symbolic links. The hard link means that a file can have multiple names, while the soft link is to create a special file whose content points to the location of another file. Hard links exist in the same file system, while soft links can span different file systems. Soft links:

  • Soft links exist in the form of paths. Similar to shortcuts in the Windows operating system
  • Soft links can cross file systems, but hard links cannot
  • Soft links can link to a file name that does not exist
  • Soft links can link directories

Hard links:

  • Hard links exist as copies of files. But it doesn’t take up real space.
  • Hard links to directories are not allowed
  • Hard links can be created only in the same file system

ln [OPTION] TARGET

parameter instructions
-b Delete, overwrite previously established links
-d Allows superusers to make hard links to directories
-f To enforce
-i Interactive mode, the existence of the file prompts the user whether to overwrite
-n Think of symbolic links as generic directories
-s Soft links (symbolic links)
-v Displays detailed processing

history

View the history command has been executed, can also execute the history command! + Instruction number can execute the history instruction

According to

cat

Cat [OPTION] [FILE]

parameter instructions
-n Number all output lines starting with 1
-b Similar to -n, except that blank lines are not numbered
-s When more than two consecutive blank lines are encountered, replace them with one blank line
-E Display $at the end of each line
-T Displays the TAB character as ^I

Address of the blogger CSDN: wzlodq.blog.csdn.net/

more

Similar to CAT, it is displayed in the form of page by page, which is more convenient for users to read page by page. The most basic command is to press the “space” key to display the next page, and press the “B” key to display the back page. more [options] file

Common operations instructions
Enter N rows down, we need to define it. The default is 1 line
Ctrl+F Scroll down one screen
The blank space key Scroll down one screen
Ctrl+B Return to previous screen
= Prints the line number of the current line
: F Output the file name and the line number of the current line
V Invoke the vi editor
q Out of more

less

Similar to more, but you can browse the file at will, and less does not load the entire file before viewing it. less[options] file

Common operations instructions
/ string The ability to search down for “string”
? string The ability to search up “string”
b Turn the page up
d Turn back half a page
y Scroll forward one line
The blank space key Scrolling a page
The enter key Rolling line
[pagedown] Turn down a page
[pageup] Turn the page up

head

Display the beginning of the FILE (default top ten lines) head [OPTION] [FILE]

parameter instructions
-q Hide file name
-v Display file name
– c < number > The number of bytes displayed
Line – n < number > The number of rows displayed

tail

Tail [OPTION] [FILE] Displays the last part of the FILE (default last ten lines). The most commonly used is -f to monitor updates to the log FILE.

parameter instructions
-f Loop reads
-q Processing information is not displayed
-v Displays detailed processing information
– c < number > The number of bytes displayed
Line – n < number > Displays the last n lines of the file
– pid = pid This parameter is used with -f to terminate after the process ID,PID, dies
-s, –sleep-interval=S Used with -f to sleep for S seconds at each repeated interval

echo

Echo [short-option] [STRING]

parameter instructions
-n No output followed by a line break
-e Enable backslash escape explanation
-E Disable interpretation of backslash escapes

To find the


find

Find path-option [-print] [-exec-ok command] {} \ Find path-option [-print] [-exec-ok command] {} \

Commonly used parameters instructions
-amin n It has been read in the last n minutes
-anewer file A file that has been read later than the file file
-atime n Files that were read in the last n days
-cmin n It’s been modified in the last n minutes
-cnewer file A file that is newer than file file
-ctime n Files that have been modified in the last n days
-path p Ipath ignores case for files whose path names match P
-name name The file name matches the name of the file. Iname ignores case
-user< user name > Find all files belonging to the specified user name

We can use (and) to separate expressions and the following operations:

  • exp1 -and exp2
  • exp1 -or exp2
  • exp1, exp2
  • ! expr
  • -not expr

locate

Locate can quickly locate a file path. The Locate directive quickly locates a given file using the LOCATE database of all file names and paths established in the system. Because the Locate directive queries based on a database, the UPDATedb directive must be used to create the LOCATE database before the first run. locate [OPTION] PATTERN

parameter instructions
-b Matches only the base name of the pathname
-c Only the quantity found is printed
-d DBPATH Use the database specified by DBPATH instead of the default database
-n At most n outputs are displayed
-r Use basic regular expressions
-o Specifies the name of the data store
-i Ignore case

grep

Search the string file accords with a condition Often and the pipe “|” use collocation, said it would before the processing of a command output is passed to the back of the order processing. grep [OPTIONS] PATTERN [FILE]

parameter instructions
-n Displays the match and line number
-a Don’t ignore binary data
-a < display line number > Display the content after that line, except for the column that matches the template style
-e< Template Style > Specifies a string as the style to find the contents of a file
-h The name of the file to which the line belongs is not marked until the line that matches the style is displayed
-H Indicate the name of the file that the line belongs to before displaying the line that matches the style
-i Ignore character case

unzip

gzip/gunzip

Gzip compressed. Gz file, gunzip decompressed file.

parameter instructions
-a Use ASCII text mode
-d Unzip the file
-f Forcibly compress files. Regardless of whether a file name or hardlink exists and whether the file is a symbolic link
-l This section describes the information about compressed files
-L Display version and copyright information
-n When a file is compressed, the original file name and time stamp are not saved
-N When you compress a file, save the original file name and time stamp
-r Recursive processing, all files and subdirectories under the specified directory are processed together
-t Test whether the compressed file is correct
-v Display command execution process
-V Display version Information

In fact, gzip -d can extract files, gunzip is a hard link to gzip.



zip/unzip

Zip Generated. Zip file. Unzip decompressed file.

parameter instructions
-A Adjust the automatic decompression files that can be performed
-b< working directory > Specify a directory to temporarily store files
-d Deletes the specified file from the compressed file
-D No directory name is created in the compressed file
-f Update existing files
-F Try to repair the corrupted zip file
-g A compressed file is appended to an existing compressed file rather than creating a new compressed file
-j Save only file names and their contents, not any directory names
-L Display copyright information
-m After the file is compressed and added to the compressed file, the original file is deleted, that is, the file is moved to the compressed file
-q Command execution process is not displayed
-r Recursive processing, all files in the specified directory and subdirectories are processed together
-t< date time > Sets the date of the compressed file to the specified date
-T Check that each file in the backup file is correct
-v Display command execution process or display version information
-z Annotate the compressed file

tar

Tar Used to package backup files and generate.tar.gz files.

Commonly used parameters instructions
-c Create a new backup file
-c < Destination directory > Switch to the specified directory
-d Compare the differences between backup files and files on the file system
-f< Backup file > Specifying backup files
-v Display command execution process
-x Restore files from backup files
-z Process backup files through the gzip directive

time


date

Check the date and time

parameter time
% Print out the %
%H Hours (00… 23)
%I Hours (01… 12)
%k Hours (0… 23)
%l Hours (1… 12)
%M Minutes (00… 59)
%p Display local AM or PM
%r Direct display time (in 12-hour format, hh:mm: SS [AP]M)
%s The number of seconds to date since 00:00:00 UTC, January 1, 1970
%S Seconds (00… 61).
%T Direct display time (24 hours)
%X Equivalent to % H: % M: % S
%Z According to the time zone
%a What day (Sun… Sat)
%A What day (Sunday… Saturday)
%b Month (Jan… Dec)
%B Month (January… December)
%c Display date and time directly
%d (01… 31)
%D Direct display date (mm/ DD/YY)
%j The number of days of the year (001… 366).
%m (01 month… 12)
%U Week of the year (00… The first day of the week is Sunday.
%w Days of the week (0… 6)
%W Week of the year (00… (Using Monday as the first day of the week)
%x Direct display date (mm/ DD/YY)
%y The last two digits of the year (00.99)
%Y Full year (0000… 9999).

cal

Check the calendar



Original is not easy, please do not reprint (this is not rich visitors to add to the problem) blogger homepage: wzlodq.blog.csdn.net/ wechat public number: weow lo dong qiang if the article is helpful to you, remember a key three connect ❤