Linux basic commands-There are commands about the directory

Source: Internet
Author: User


1. View Help :

[[email protected] ~]# Man CD//view Help documentation for CD instructions

2. Display the current working directory :

[Email protected] ~]# pwd
/root

3. List the contents of the current directory: LS

[[email protected] ~]# ls [-aadffhilnrrst] directory name
[[email protected] ~]# ls [--color={never,auto,always}] Directory name
[[email protected] ~]# ls [--full-time] directory name

Parameters for use with LS:

-A: All files are listed together with the hidden file (files that begin with.) (common)
-A: All files, together with hidden documents, but not included. And.. These two directories
-D: Lists only the directory itself, not the file data in the directory (common)
-L: Long data string list, including file attributes and permissions and so on data; (common) (LL)
-N: Lists UID and GID instead of user and group name (UID and GID will be mentioned in account management!) )
-r: Reverse output of the sorting results, for example: the original file name from small to large, the reverse is from large to small;
-R: Listed along with the subdirectory contents, and all the files in that directory will be displayed;
-S: Sort by file size, not by filename;
-T: Sort by time, not by file name.
--color=never: Do not give color display according to the file characteristics;
--color=always: Display Color
--color=auto: Allow the system to determine whether to give color according to its configuration
--full-time: Output in full time mode (including year, month, day, hour, minute)

4. Switch Directories:

[[Email protected] ~]# CD///switch to root directory

5. Create a directory:

[[email protected] ~]# mkdir Oracle//Create Oracle directory in current directory

Parameters used in conjunction with mkdir:

-M: Set access permissions on the new directory, or you can use the chmod command to set
-P: Can be a path name. If some of the directories in the path do not already exist, and this option is added, the system will
Automatically set up directories that do not yet exist, i.e. multiple directories can be created at one time (cascade creation)
[[email protected] ~]# mkdir-p study/oracle/oc{a,p,m}
Create the study directory under the current directory, create the Oracle directory under the study directory, create it under the Oracle directory
OCA, OCP, OCM catalogue

6. Deleting a directory

[[email protected] ~]# rmdir Oracle//Delete Oracle Directory

7. Create a file

[[email protected] ~]# Touch Oracle//Create a file named Oracle

8. Delete files/directories

[[Email protected] ~]# RM Oracle//Delete files named Oracle

Parameters for use with RM:

-I: Ask for confirmation before deleting.
-F: Even if the original file attribute is set to read-only, it is deleted directly without confirmation.
-R: The directory and the following files are also deleted.
[[Email protected] ~]# RM *.log//Delete all files ending with ". Log"
[[email protected] ~]# RM-RF oracle///delete Oracle directory and cascade delete files in Oracle directory

9. Move Files/Directories

[[Email protected] ~]# MV oracle/opt//Move archive Oracle to directory/opt

10. copy Files/directories

[[email protected] ~]# CP [-ADFILPRSU] source file (source) target (destination)
[email protected] ~]# CP [options] Source1 source2 source3 .... directory

Parameters used with the CP:

-A: As-pdr means, please refer to the following instructions for PDR. (common)
-D: If the source file is the attribute of the link file, the link file property is copied instead of the file itself;
-I: If the target file (destination) already exists, the action will be asked (commonly used) when overwriting
-P: Copy the past along with the properties of the file, rather than using the default properties (backup is often used);
-R: Recursive continuous replication, used for the replication behavior of the directory; (Common)
Finally, note that if the source file has more than two, then the last destination file must be "directory"!

11. Open File

[Email protected] ~]# more Oracle.log
[email protected] ~]# less Oracle.log
[[email protected] ~]# tail-20f oracle.log//File tail output
[email protected] ~]# cat Oracle.log

Linux basic commands-There are commands about the directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.