Working with files and directories in Linux is a basic skill, just as important as the way we look at directories and the basic use of files in Windows, if we don't do anything else about directory and file operations. Of course, the graphical interface in Linux is also very easy to operate, but in the text processing interface need to use a lot of commands, below is my summary of these operations and integration, while listing some of the basic common operation commands, of course, I listed the command is not comprehensive, there are other needs to consult the giant, please see.
In this figure I divided four parts, namely 1, the Giant. 2, the operation of the file command. 3, the operation of the directory command. 4. Commands that can operate on files and directories at the same time.
One, Giant: This is the giant I mentioned above, the command listed in the diagram is just a few common, if you need to see more commands to help yourself, then you need to consult the Giants, in fact, this giant is a Linux under the General Command, not just the file and directory operation commands. Man page, Info page, command help, Whatis command They can help us to quickly understand the use of a command and parameter information. Very useful Oh, the master led the door, practice on the individual, this giant is the door.
Second, the file Operation command:
The operation of the file is as follows:
I have divided the main two pieces, namely: view and compression. For Views: 1, Cat/tac is used to view the contents of the file, and the cat and TAC in turn, it is the same way to view a cat in a positive sequence view TAC reverse view, plus-n can display line numbers. 2, Nl–b–a is equivalent to Cat–n. 3, more and less can be split-screen branch display, make viewing more convenient. 4. Head and tail can view a few lines of text before and after the file. For compression has: 1, compress is not used. 2, gzip and bzip2 operation methods are almost the same, but the compression method is different. 3, zip and unzip can also be used to compress and decompress.
Third, directory operation command:
The operations on the directory are as follows:
In fact, it can be divided into two pieces, one is to indicate that one is the basic operation. For the basic operation is: 1, switch CD, just as we click to open a directory, just a few restrictions on the operation. 2, create mkdir, the equivalent of creating a new folder, plus-P can create a layer of directory. 3, delete rmdir, delete a folder, the same-P will also delete a folder, because the directory is not empty when not available rmdir delete will need to use the RM–RF command, it can forcibly delete a directory. For a representation there are two points:. Represents the current directory, ... Represents the previous level of the directory.
Iv. commands that can operate on directories and files at the same time:
As shown in the following:
It is divided into basic operations commands, related query commands, and tar commands. 1, the basic operation has to view, copy, cut and delete; view as ls–ld followed by the folder to view, list all the files and folders, about Ls–ld followed by-time=atime and-time=ctime is used to view the most recent actions and creation time. Copy command CP to copy a file or directory between two directories. The MV and CP commands are related to the same usage. The RM command and CP are the same. 2. The view commands are: Which, whereis, locate, and find: for which and whereis, you can view the commands for these binary files. Locate can find not only the command but also the path where the file is located. Find can locate files that meet their requirements based on attributes. 3, for the tar is used for packaging, packaging and compression is different, packaging can be combined with compression, but the command is the difference; depending on the parameters of the tar followed, decide what to do; Package: CVF, view packaged file contents: TVF, Unpack: xvf, pack + compress: zcvf/ JCVF (take different commands depending on the type of compressed file), unpack + Unzip: ZXVF/JXVF (different commands depending on the type of compressed file).
At this point to some of the operation of the file and directory command to do a certain summary, but the amount of command is huge, many commands we do not need to remember all, but the common command is best to master, in addition we should learn to turn to the help of the few giants in the face of difficulties, This will be a very beneficial to our habits, see more help, less detours, but also hope that I can do the better!!
Learn about Linux with the birds--a summary of the commands for file and directory operations