About Linux commands - 1
Linux commands Daquan
Name: cat
Access: all users use: cat [-AbeEnstTuv] [- help] [- version] fileName
Note: the file was transmitted after the string connecting the basic output (screen or additions> fileName to another file)
Parameters:
- n or - number one started by the output of all the rows #
- b or - number-nonblank and - n similar, but not for the blank lines #
- s or - squeeze-blank when faced with a row over two lines of the blank lines on his substitution for the blank lines
- v or - show-nonprinting
Example:
cat-n textfile1> textfile2 the textfile1 line with the contents of the file, enter the file textfile2
cat-b textfile1 textfile2>> textfile3 the textfile1 and textfile2 line with the contents of the file (no blank lines) will be followed by additional content to textfile3
Name: cd
Access: all users
Use: cd [dirName]
Description: transform working directory to dirName. One method that can be dirName as the absolute path or relative path. If the directory names omitted, the transformation to a user's home directory (that is, just login at the directory).
In addition, "~" said the home directory means "." It is said that at present the directory ,".." said the current location of the directory on a directory.
Example: Skip to the / usr / bin /:
cd / usr / bin
Skip to their home directory:
cd ~
Skip to the current directory on the two-tier:
cd ../..
Command name: chmod
Access: all users
Use: chmod [-cfvR] [- help] [- version] mode file…
Note: Linux / Unix file access is divided into three: the file owner, group, other. Chmod can use to control how the files were accessed by others.
To include:
mode: permission string, the format is as follows: [ugoa ...][[ -=][ rwxX]… ][,...], which u said that the file owner, g and that the file Owners belong to the same group (group) who, o that other people outside of, a three both said yes.
Increase the authority said, - that abolition of authority, competence = that the only set.
r that can read, w indicated that they could write, x said executable, X said that only when the file is a subdirectory or the file has been set for the run-off.
- c: If the file permissions has indeed changed, the changes show that only moves
- f: If the file permissions can not be changed should not display an error message
- v: shows that the permission to change the details
- R: the current directory of all files and subdirectories for the same permission to change (that is, to delivery to change the way one by one.)
- Help: Show Help
- Version: show version
Example: the file can be read all file1.txt as:
chmod ugo r file1.txt
File1.txt all files can be read as:
chmod a r file1.txt
File1.txt and file2.txt file as the file owner, instead of belonging with a group can write, but other people will not be allowed outside the write:
chmod ug w, ow file1.txt file2.txt
Ex1.py set to be only the file owner can be implemented:
chmod u x ex1.py
Under the current directory of all files and subdirectories are set to anyone who can read:
chmod-R a r *
In addition chmod can also use that authority figures such as chmod 777 file
Grammar for: chmod abc file
Including a, b, c all for a number, respectively, said User, Group, and Other privileges.
r = 4, w = 2, x = 1
To attribute the rwx 4 2 1 = 7;
To attribute the rw-4 2 = 6;
To attribute the rx 4 1 = 7.
Example:
chmod a = rwx file
And
chmod 777 file
The same effect
chmod ug = rwx, o = x file
And
chmod 771 file
The same effect
If the chmod 4755 filename will enable this program is the root privilege
Command name: chown
Terms of Use: root
Use: chmod [-cfhvR] [- help] [- version] user [: group] file…
Note: Linux / Unix is the system work more and more, all the files there are owners. Chown can use the file owner to change. In general, this directive is only by the system administrator (root) used by the general user does not have permission to change other people's files owner, and no privileges to their own files as the owner to others. Only system administrator (root) have this privilege.
To include:
user: a new file with the user IDgroup: a new file with the user groups (group)-c: if the file owner has indeed changed, the changes show that only moves - f: If the owner can not file Changes were also not display an error message - h: the only link (link) to make changes, rather than the real point to link the file - v: shows that the owner changed the details - R: the current directory of all files and subdirectories For the owner of the same changes (that is, to delivery to change the way one by one) - help: Show Help - version: show version
Example:
File1.txt will file the owner of the user groups as users jessie:
chown jessie: users file1.txt
Under the current directory of all files and subdirectories with both groups of users as users lamport:
chmod-R lamport: users *
Name: cp
Access: all users
Use:
cp [options] source dest
cp [options] source… directory
Description: will copy a file to another file, or copy a few files to another directory.
Of the
- a state of the file, as far as possible, all to access information, such as the status quo to be copied.
- r if the source contains a directory name, will be Yijie directory of files were copied to the destination.
- f if the destination has the same file name of the file exists, then the copy be deleted before copying again.
Example:
Copy the file aaa (there), and named bbb:
cp aaa bbb
All the C language programs in sub-Finished copy to:
cp *. c Finished
Name: cut
Access: all users
Usage: cut-cnum1-num2 filename
Description: shows run from the beginning of each line from num1 to num2 text.
Example:
shell>> cat example
test2
this is test1
shell>> cut-c0-6 example # # print run from the beginning of the first six months of characters
test2
this i
Name: find
Usage: find
Instructions for use:
The file system within the expression of the files listed. You can mean the file name, type, time, size, access information, such as different combinations, only completely consistent with the will be listed.
According to find the following rules judgement path and expression, the first in the command line - (),! before the part of the path, followed by expression. If the path is empty string using the current path, if the expression is empty string is used - print as the default expression
expression may have the option to use as many as 20 to 30 months, only introduced in this part of the most commonly used.
- mount,-xdev: only checks and designated in the same directory under the file system files, to avoid other files listed in the file system
- amin n: n minutes in the past have been read
- anewer file: file later than the file had been read the file
- atime n: n in the past days have read the file
- cmin n: n minutes in the past been revised
- cnewer file: the file than the file updated files
- ctime n: n days in the past have modified the file
- empty: empty files - gid n or-group name: gid is n or group name is the name
- ipath p,-path p: p path name of the file, ipath will ignore case
- name name,-iname name: file name with the file name. iname ignores case
- size n: n is the file size units, b representative group of 512 yuan block, c expressed characters, k said kilo bytes, w is two bytes. - type c: c file types are files.
d: Contents
c: fonts installed file
b: block device file
p: anonymous receptacles out
f: general files
l: symlink
s: socket
- pid n: process id of the file is n
You can use () will be separated expressions, and use the following operators.
exp1-and exp2
! Expr
- not expr
exp1-or exp2
exp1, exp2
Example:
The current directory and subdirectories under the file name extension is all the c file listed.
# Find.-Name "*. c"
Will present its directory of all subdirectories of its next general file lists
# Find.-Ftype f
The current directory and subdirectories of all within the last 20 minutes updated file lists
# Find.-Ctime -20
Name: less
Access: all users
Use:
less [Option] filename
Description:
less the role and more are very similar, can be used to browse the contents of text files, the difference is less allows users to scroll back here have read the most, because less is not at the beginning of the entire student files , In the event of large files opened, the instrument than the general editor (such as vi) to the quick.
Example:
Command name: ln
Access: all users
Use: ln [options] source dist, one option for the format:
[-bdfinsvF] [-S backup-suffix] [-V (numbered, existing, simple)]
[- help] [- version] [-]
Note: Linux / Unix file system, the so-called link (link), we can be regarded as the alias files, and links can be divided into two types: hard link (hard link) and soft-link (symbolic link), Hard link is the meaning of a file can have multiple names, and the soft link is a way of a special file, the file is pointing to another file. There is a hard link with a file system, which links can be soft across different file system.
ln source dist is a link (dist) to the source, On the use of hard or soft link Links decision by the parameters.
Be it hard or soft Links link will never be a copy of the original file, use only a very small amount of disk space.
- f: Links at the first and dist file with the file name deleted - d: to allow system administrators of their own hard Links directory - i: delete dist in the same file name of the file first to ask - n: in Soft link, will dist generally regarded as the files - s: a soft-Links (symbolic link)-v: link in the show before the file name - b: Links will be overwritten when the file or delete a backup -- S SUFFIX: will be the backup files with the suffix SUFFIX - V METHOD: the designated backup way - help: Show Help - version: show version examples:
Yy files will produce a symbolic link: zz
ln-s yy zz
Yy files will produce a hard link: zz
ln yy xx
Name: locate
Access: all users use: locate [-q] [-d] [- database =]
locate [-r] [- regexp =]
locate [-qv] [-o] [- output =]
locate [-e] [-f]
locate [-Vh] [- version] [- help]
Description:
locate users can quickly search the file system within a specified files. The method is to create a system including all the file name and path of the database, and then find time for just this database, rather than the actual depth of the file system.
In general distribution, the establishment of the database are automatically placed on the implementation of contab. In general use, as long as users use
# Locate your_file_name
The type it. Parameters:
- u
- U
The creation of a database, - u will start from the root, - U you can specify a starting position.
- e
Will be excluded from the scope of the search.
- l
If this is a. Safe Mode is activated. In safe mode, the user will not see authority not be able to see the files. This will only slow down, because we must locate the actual file system to obtain permission to file information.
- f
Will be a specific file system excluded, for example, we have no grounds to the proc file system on the file in the database.
- q
Quiet mode, will not show any error messages.
- n
Show up output.
- r
The use of regular expressions to find the conditions.
- o
Specify the name of inventory data.
- d
The path designated database
- h
Showing support message
- v
Show more information
- V
Show your version of the message Example:
locate chdrv: to find all the files called chdrv
locate-n 100 a.out: a.out called for all the files, but most show only 100
locate-u: setting up a data bank
Name: ls
Access: all users
Use: ls [-alrtAFR] [name ...]
Description: Show designated directory content (the current working directory contains lists of files and subdirectories).
- a show all files and directories (ls-designate will file or directory name starts with "." regarded as the hidden files, are not listed)
- l In addition to file names, will file types, powers, the owner, the file size of the information set out in detail
- r file to show the opposite order (in accordance with the original English alphabetical order)
- t files in accordance with the priorities established time list
- A the same - a, but does not list "." (The current directory) and ".." (parent directory)
- F listed in the file name followed by a symbol, for example, the executable file and then "*", the directory will increase "/"
- R directory if there are files, the following list of the files were Yijie
Example:
Lists all the current working directory s name is the beginning of the file, the more the more behind the new row:
ls-ltr s *
Will / bin directory of all of the following directory and file detailed information follows:
ls-lR / bin
Under the current working directory lists all the files and directories; directory in the name added "/", in the name of the executable file and "*":
ls-AF
Name: more
Access: all users use: more [-dlfpcsu] [-num] [ / pattern] [ linenum] [fileNames ..]
Description: similar to cat, but will be a display of a user-friendly page by page reading, and is the most basic instruction on Space (space) Jiuwang Next, the b key will be back (back) A show, but also the function of the search string (and similar vi), the use of documentation, please h.
Parameters: - num a show that the number of lines
- d prompts the user, the screen shown below [Press space to continue, q to quit.], if the user pressed the wrong button, it displays [Press h for instructions.] rather than beep
- l met cancel special characters ^ L (feed characters) will suspend the function
- f calculated lines, with the number of rows in fact, not wrapped after the number of lines (some of the single word is too long would be extended to two lines or two more)
- p not to scroll the display each page, but to clear the screen after the display content
with-c - p similar, the difference is to display content to remove other old data
- s when faced with a row over two lines of blank lines on his substitution for the blank lines
- u do not show the quotes (based on environmental variables TERM designated terminal vary)
/ Archives show that in each of the string before the search (pattern), then the string after starting to show
num num line from the beginning to show
fileNames to display the contents of the file, for the plural number of examples:
more-s testfile-by-page testfile of the contents of the file, if a row over two lines of blank lines blank lines while his show.
more 20 testfile from the first 20 lines beginning to show testfile of the contents of the file.
Name: mv
Access: all users
Use:
mv [options] source dest
mv [options] source… directory
Description: a file will be moved to another file, or a number of files moved to another directory.
Parameters: - i have the same name if the destination file, then check whether the old file coverage.
Example:
Aaa changed its name to the file bbb:
mv aaa bbb
Will all go to the C language programs in sub-Finished:
mv-i *. c
Name: rm
Access: all users
Use: rm [options] name…
Description: delete files and directories.
Of the
- i asked to confirm the deletion of the former one by one.
- f even if the original files read-only attribute set, delete, one by one without confirmation.
- r directory and below will also file one by one to delete.
Example:
Delete all C-language program file; asked to confirm the deletion of the former one by one:
rm-i *. c
Will be Finished in sub-subdirectories and delete all the files:
rm-r Finished
Name: rmdir
Access: in the current directory to have the appropriate permissions for all users
Use: rmdir [-p] dirName
Description: delete empty directories.
Parameters:-p when subdirectory be deleted after it has become empty directory, then delete the way together.
Example:
Will be working directory, called AAA subdirectories delete:
rmdir AAA
In the working directory of BBB directory, delete the subdirectory named Test. If the Test deleted, BBB directory become empty directory, BBB also be deleted.
rmdir-p BBB / Test
Name: split
Access: all users
Use: split [OPTION] [INPUT [PREFIX]]
Description:
A file will be split into several. Output from the INPUT split into a fixed-size file and the file name followed by PREFIXaa, PREFIXab ... PREFIX default is `x. If not INPUT file or `-, read from standard input into the information.
Kuang soliciting
- b,-bytes = SIZE
SIZE value for each output file size, in units of byte.
- C,-line-bytes = SIZE
The output of each file, the largest single byte few.
- l,-lines = NUMBER
NUMBER value of output for each file size of the number of rows.
- NUMBER
And - l NUMBER the same.
- Verbose
In each output file was opened, print debug information to the standard error output.
- Help
Supplementary information and then leave the show.
- Version
List version information and then leave.
SIZE units can be added: b on behalf of 512, k representatives 1 K, m on behalf of 1 Meg.
Example:
PostgresSQL large database backup and restore:
Postgres allowed to form a result of your system files greater than the maximum capacity, so to dump to form a single file may be a problem, use the split to separate files.
% Pg_dump dbname | split-b 1m - filename.dump.
Reload
% Createdb dbname
% Cat filename.dump .* | pgsql dbname
Name: touch
Access: all users
Use:
touch [-acfm]
[-r reference-file] [- file = reference-file]
[-t MMDDhhmm [[CC] YY] [. ss]]
[-d time] [- date = time] [- time = (atime, access, use, mtime, modify)]
[- no-create] [- help] [- version]
file1 [file2 ...]
Description:
touch commands to change the time to file records. ls-l can display the file records of the time.
Parameters:
a change in record time to read the files.
m file amendments to change the time record.
c If the purpose of the file does not exist, would not create a new file. And - no-create the same effect.
f not to use, and the other is to unix system and the compatibility of reservations.
r the use of reference file records of the time, and - file the same effect.
d set the time and date, you can use a variety of formats.
t set up a file records of the time, date and format of the same order.
- No-create do not create new files.
- Help format set out instructions.
- Version listed version of the message.
Example:
The simplest use, the files will be recorded when the time is now. If the file does not exist, the system will create a new file.
touch file
touch file1 file2
Will file to record the time at 18:03 on May 6, Year 2000. Time can make reference to the format of command date, at least enter MMDDHHmm, is on the hours and minutes.
touch-c-t 05061803 file
touch-c-t 050618032000 file
Will file a change in record time and referencefile the same.
touch-r referencefile file
Will file into the record time at 18:03 on May 6, Year 2000. Time can use am, pm or 24-hour format, date can use other formats such as the 6 May 2000.
touch-d "6:03 pm" file
touch-d "05/06/2000" file
touch-d "6:03 pm 05/06/2000" file
About Linux commands (1)
cat cd
chmod chown
cp cut
Name: cat
Access: all users use: cat [-AbeEnstTuv] [- help] [- version] fileName
Note: the file was transmitted after the string connecting the basic output (screen or additions> fileName to another file)
Parameters:
- n or - number one started by the output of all the rows #
- b or - number-nonblank and - n similar, but not for the blank lines #
- s or - squeeze-blank when faced with a row over two lines of the blank lines on his substitution for the blank lines
- v or - show-nonprinting
Example:
cat-n textfile1> textfile2 the textfile1 line with the contents of the file, enter the file textfile2
cat-b textfile1 textfile2>> textfile3 the textfile1 and textfile2 line with the contents of the file (no blank lines) will be followed by additional content to textfile3
Name: cd
Access: all users
Use: cd [dirName]
Description: transform working directory to dirName. One method that can be dirName as the absolute path or relative path. If the directory names omitted, the transformation to a user's home directory (that is, just login at the directory).
In addition, "~" said the home directory means "." It is said that at present the directory ,".." said the current location of the directory on a directory.
Example: Skip to the / usr / bin /:
cd / usr / bin
Skip to their home directory:
cd ~
Skip to the current directory on the two-tier:
cd ../..
Command name: chmod
Access: all users
Use: chmod [-cfvR] [- help] [- version] mode file…
Note: Linux / Unix file access is divided into three: the file owner, group, other. Chmod can use to control how the files were accessed by others.
To include:
mode: permission string, the format is as follows: [ugoa ...][[ -=][ rwxX]… ][,...], which u said that the file owner, g and that the file Owners belong to the same group (group) who, o that other people outside of, a three both said yes.
Increase the authority said, - that abolition of authority, competence = that the only set.
r that can read, w indicated that they could write, x said executable, X said that only when the file is a subdirectory or the file has been set for the run-off.
- c: If the file permissions has indeed changed, the changes show that only moves
- f: If the file permissions can not be changed should not display an error message
- v: shows that the permission to change the details
- R: the current directory of all files and subdirectories for the same permission to change (that is, to delivery to change the way one by one.)
- Help: Show Help
- Version: show version
Example: the file can be read all file1.txt as:
chmod ugo r file1.txt
File1.txt all files can be read as:
chmod a r file1.txt
File1.txt and file2.txt file as the file owner, instead of belonging with a group can write, but other people will not be allowed outside the write:
chmod ug w, ow file1.txt file2.txt
Ex1.py set to be only the file owner can be implemented:
chmod u x ex1.py
Under the current directory of all files and subdirectories are set to anyone who can read:
chmod-R a r *
In addition chmod can also use that authority figures such as chmod 777 file
Grammar for: chmod abc file
Including a, b, c all for a number, respectively, said User, Group, and Other privileges.
r = 4, w = 2, x = 1
To attribute the rwx 4 2 1 = 7;
To attribute the rw-4 2 = 6;
To attribute the rx 4 1 = 7.
Example:
chmod a = rwx file
And
chmod 777 file
The same effect
chmod ug = rwx, o = x file
And
chmod 771 file
The same effect
If the chmod 4755 filename will enable this program is the root privilege
Command name: chown
Terms of Use: root
Use: chmod [-cfhvR] [- help] [- version] user [: group] file…
Note: Linux / Unix is the system work more and more, all the files there are owners. Chown can use the file owner to change. In general, this directive is only by the system administrator (root) used by the general user does not have permission to change other people's files owner, and no privileges to their own files as the owner to others. Only system administrator (root) have this privilege.
To include:
user: a new file with the user IDgroup: a new file with the user groups (group)-c: if the file owner has indeed changed, the changes show that only moves - f: If the owner can not file Changes were also not display an error message - h: the only link (link) to make changes, rather than the real point to link the file - v: shows that the owner changed the details - R: the current directory of all files and subdirectories For the owner of the same changes (that is, to delivery to change the way one by one) - help: Show Help - version: show version
Example:
File1.txt will file the owner of the user groups as users jessie:
chown jessie: users file1.txt
Under the current directory of all files and subdirectories with both groups of users as users lamport:
chmod-R lamport: users *
Name: cp
Access: all users
Use:
cp [options] source dest
cp [options] source… directory
Description: will copy a file to another file, or copy a few files to another directory.
Of the
- a state of the file, as far as possible, all to access information, such as the status quo to be copied.
- r if the source contains a directory name, will be Yijie directory of files were copied to the destination.
- f if the destination has the same file name of the file exists, then the copy be deleted before copying again.
Example:
Copy the file aaa (there), and named bbb:
cp aaa bbb
All the C language programs in sub-Finished copy to:
cp *. c Finished
Name: cut
Access: all users
Usage: cut-cnum1-num2 filename
Description: shows run from the beginning of each line from num1 to num2 text.
Example:
shell>> cat example
test2
this is test1
shell>> cut-c0-6 example # # print run from the beginning of the first six months of characters
test2
this i
Name: find
Usage: find
Instructions for use:
The file system within the expression of the files listed. You can mean the file name, type, time, size, access information, such as different combinations, only completely consistent with the will be listed.
According to find the following rules judgement path and expression, the first in the command line - (),! before the part of the path, followed by expression. If the path is empty string using the current path, if the expression is empty string is used - print as the default expression
expression may have the option to use as many as 20 to 30 months, only introduced in this part of the most commonly used.
- mount,-xdev: only checks and designated in the same directory under the file system files, to avoid other files listed in the file system
- amin n: n minutes in the past have been read
- anewer file: file later than the file had been read the file
- atime n: n in the past days have read the file
- cmin n: n minutes in the past been revised
- cnewer file: the file than the file updated files
- ctime n: n days in the past have modified the file
- empty: empty files - gid n or-group name: gid is n or group name is the name
- ipath p,-path p: p path name of the file, ipath will ignore case
- name name,-iname name: file name with the file name. iname ignores case
- size n: n is the file size units, b representative group of 512 yuan block, c expressed characters, k said kilo bytes, w is two bytes. - type c: c file types are files.
d: Contents
c: fonts installed file
b: block device file
p: anonymous receptacles out
f: general files
l: symlink
s: socket
- pid n: process id of the file is n
You can use () will be separated expressions, and use the following operators.
exp1-and exp2
! Expr
- not expr
exp1-or exp2
exp1, exp2
Example:
The current directory and subdirectories under the file name extension is all the c file listed.
# Find.-Name "*. c"
Will present its directory of all subdirectories of its next general file lists
# Find.-Ftype f
The current directory and subdirectories of all within the last 20 minutes updated file lists
# Find.-Ctime -20
Name: less
Access: all users
Use:
less [Option] filename
Description:
less the role and more are very similar, can be used to browse the contents of text files, the difference is less allows users to scroll back here have read the most, because less is not at the beginning of the entire student files , In the event of large files opened, the instrument than the general editor (such as vi) to the quick.
Example:
Command name: ln
Access: all users
Use: ln [options] source dist, one option for the format:
[-bdfinsvF] [-S backup-suffix] [-V (numbered, existing, simple)]
[- help] [- version] [-]
Note: Linux / Unix file system, the so-called link (link), we can be regarded as the alias files, and links can be divided into two types: hard link (hard link) and soft-link (symbolic link), Hard link is the meaning of a file can have multiple names, and the soft link is a way of a special file, the file is pointing to another file. There is a hard link with a file system, which links can be soft across different file system.
ln source dist is a link (dist) to the source, On the use of hard or soft link Links decision by the parameters.
Be it hard or soft Links link will never be a copy of the original file, use only a very small amount of disk space.
- f: Links at the first and dist file with the file name deleted - d: to allow system administrators of their own hard Links directory - i: delete dist in the same file name of the file first to ask - n: in Soft link, will dist generally regarded as the files - s: a soft-Links (symbolic link)-v: link in the show before the file name - b: Links will be overwritten when the file or delete a backup -- S SUFFIX: will be the backup files with the suffix SUFFIX - V METHOD: the designated backup way - help: Show Help - version: show version examples:
Yy files will produce a symbolic link: zz
ln-s yy zz
Yy files will produce a hard link: zz
ln yy xx
Name: locate
Access: all users use: locate [-q] [-d] [- database =]
locate [-r] [- regexp =]
locate [-qv] [-o] [- output =]
locate [-e] [-f]
locate [-Vh] [- version] [- help]
Description:
locate users can quickly search the file system within a specified files. The method is to create a system including all the file name and path of the database, and then find time for just this database, rather than the actual depth of the file system.
In general distribution, the establishment of the database are automatically placed on the implementation of contab. In general use, as long as users use
# Locate your_file_name
The type it. Parameters:
- u
- U
The creation of a database, - u will start from the root, - U you can specify a starting position.
- e
Will be excluded from the scope of the search.
- l
If this is a. Safe Mode is activated. In safe mode, the user will not see authority not be able to see the files. This will only slow down, because we must locate the actual file system to obtain permission to file information.
- f
Will be a specific file system excluded, for example, we have no grounds to the proc file system on the file in the database.
- q
Quiet mode, will not show any error messages.
- n
Show up output.
- r
The use of regular expressions to find the conditions.
- o
Specify the name of inventory data.
- d
The path designated database
- h
Showing support message
- v
Show more information
- V
Show your version of the message Example:
locate chdrv: to find all the files called chdrv
locate-n 100 a.out: a.out called for all the files, but most show only 100
locate-u: setting up a data bank
Name: ls
Access: all users
Use: ls [-alrtAFR] [name ...]
Description: Show designated directory content (the current working directory contains lists of files and subdirectories).
- a show all files and directories (ls-designate will file or directory name starts with "." regarded as the hidden files, are not listed)
- l In addition to file names, will file types, powers, the owner, the file size of the information set out in detail
- r file to show the opposite order (in accordance with the original English alphabetical order)
- t files in accordance with the priorities established time list
- A the same - a, but does not list "." (The current directory) and ".." (parent directory)
- F listed in the file name followed by a symbol, for example, the executable file and then "*", the directory will increase "/"
- R directory if there are files, the following list of the files were Yijie
Example:
Lists all the current working directory s name is the beginning of the file, the more the more behind the new row:
ls-ltr s *
Will / bin directory of all of the following directory and file detailed information follows:
ls-lR / bin
Under the current working directory lists all the files and directories; directory in the name added "/", in the name of the executable file and "*":
ls-AF
Name: more
Access: all users use: more [-dlfpcsu] [-num] [ / pattern] [ linenum] [fileNames ..]
Description: similar to cat, but will be a display of a user-friendly page by page reading, and is the most basic instruction on Space (space) Jiuwang Next, the b key will be back (back) A show, but also the function of the search string (and similar vi), the use of documentation, please h.
Parameters: - num a show that the number of lines
- d prompts the user, the screen shown below [Press space to continue, q to quit.], if the user pressed the wrong button, it displays [Press h for instructions.] rather than beep
- l met cancel special characters ^ L (feed characters) will suspend the function
- f calculated lines, with the number of rows in fact, not wrapped after the number of lines (some of the single word is too long would be extended to two lines or two more)
- p not to scroll the display each page, but to clear the screen after the display content
with-c - p similar, the difference is to display content to remove other old data
- s when faced with a row over two lines of blank lines on his substitution for the blank lines
- u do not show the quotes (based on environmental variables TERM designated terminal vary)
/ Archives show that in each of the string before the search (pattern), then the string after starting to show
num num line from the beginning to show
fileNames to display the contents of the file, for the plural number of examples:
more -s testfile 逐页显示testfile 之档案内容,如有连续两行以上空白行则以一行空白行显示。
more 20 testfile 从第20 行开始显示testfile 之档案内容。
名称:mv
使用权限:所有使用者
使用方式:
mv [options] source dest
mv [options] source… directory
说明:将一个档案移至另一档案,或将数个档案移至另一目录。
参数:-i 若目的地已有同名档案,则先询问是否覆盖旧档。
范例:
将档案aaa 更名为bbb :
mv aaa bbb
将所有的C语言程式移至Finished 子目录中:
mv -i *.c
名称:rm
使用权限:所有使用者
使用方式:rm [options] name…
说明:删除档案及目录。
把计�
-i 删除前逐一询问确认。
-f 即使原档案属性设为唯读,亦直接删除,无需逐一确认。
-r 将目录及以下之档案亦逐一删除。
范例:
删除所有C语言程式档;删除前逐一询问确认:
rm -i *.c
将Finished 子目录及子目录中所有档案删除:
rm -r Finished
名称:rmdir
使用权限:于目前目录有适当权限的所有使用者
使用方式: rmdir [-p] dirName
说明: 删除空的目录。
参数: -p 是当子目录被删除后使它也成为空目录的话,则顺便一并删除。
范例:
将工作目录下,名为AAA 的子目录删除:
rmdir AAA
在工作目录下的BBB 目录中,删除名为Test 的子目录。若Test 删除后,BBB 目录成为空目录,则BBB 亦予删除。
rmdir -p BBB/Test
名称:split
使用权限:所有使用者
使用方式:split [OPTION] [INPUT [PREFIX]]
说明:
将一个档案分割成数个。而从INPUT 分割输出成固定大小的档案,其档名依序为PREFIXaa, PREFIXab…;PREFIX 预设值为`x。若没有INPUT 档或为`-,则从标准输入读进资料。
匡兜�
-b, –bytes=SIZE
SIZE 值为每一输出档案的大小,单位为byte。
-C, –line-bytes=SIZE
每一输出档中,单行的最大byte 数。
-l, –lines=NUMBER
NUMBER 值为每一输出档的列数大小。
-NUMBER
与-l NUMBER 相同。
–verbose
于每个输出档被开启前,列印出侦错资讯到标准错误输出。
–help
显示辅助资讯然后离开。
–version
列出版本资讯然后离开。
SIZE 可加入单位: b 代表512, k 代表1K, m 代表1 Meg。
范例:
PostgresSQL 大型资料库备份与回存:
因Postgres 允许表格大过你系统档案的最大容量,所以要将表格dump 到单一的档案可能会有问题,使用split进行档案分割。
% pg_dump dbname | split -b 1m - filename.dump.
重新载入
% createdb dbname
% cat filename.dump.* | pgsql dbname
名称:touch
使用权限:所有使用者
使用方式:
touch [-acfm]
[-r reference-file] [--file=reference-file]
[-t MMDDhhmm[[CC]YY][.ss]]
[-d time] [--date=time] [--time={atime,access,use,mtime,modify}]
[--no-create] [--help] [--version]
file1 [file2 ...]
说明:
touch 指令改变档案的时间记录。 ls -l 可以显示档案的时间记录。
参数:
a 改变档案的读取时间记录。
m 改变档案的修改时间记录。
c 假如目的档案不存在,不会建立新的档案。与–no-create 的效果一样。
f 不使用,是为了与其他unix 系统的相容性而保留。
r 使用参考档的时间记录,与–file 的效果一样。
d 设定时间与日期,可以使用各种不同的格式。
t 设定档案的时间记录,格式与date 指令相同。
–no-create 不会建立新档案。
–help 列出指令格式。
–version 列出版本讯息。
范例:
最简单的使用方式,将档案的时候记录改为现在的时间。若档案不存在,系统会建立一个新的档案。
touch file
touch file1 file2
将file 的时间记录改为5 月6 日18 点3 分,公元两千年。时间的格式可以参考date 指令,至少需输入MMDDHHmm ,就是月日时与分。
touch -c -t 05061803 file
touch -c -t 050618032000 file
将file 的时间记录改变成与referencefile 一样。
touch -r referencefile file
将file 的时间记录改成5 月6 日18 点3 分,公元两千年。时间可以使用am, pm 或是24 小时的格式,日期可以使用其他格式如6 May 2000 。
touch -d “6:03pm” file
touch -d “05/06/2000″ file
touch -d “6:03pm 05/06/2000″ file”














