Mkdir directory name => create a directory
Rmdir empty directory name => delete an empty directory
RM file name => delete one or more files
Rm-RF non-empty directory name => delete everything in a non-empty directory
Touch file name => Create an empty file
Rename a file (folder)/move a file (folder) to a specified folder
Execution format: mV source destination
Example:
MV file1 file2 => change file1 to file2.
MV file1 dir1 => move the file file1 to the directory dir1, and the file name is still file1.
MV dir1 dir2 => If the directory dir2 exists, move the directory dir1 and all its files and subdirectories to the directory dir2 with the new directory name dir1. If the directory dir2 does not exist, change dir1 and all its files and subdirectories to the directory dir2.
The RENAME command is used to rename a file. As shown in the following example, rename can be used to rename a single file in batches. At the same time, it is worth noting that the RENAME command contains three parameters instead of the two parameters that many people think.
In the above example, the use of batch Rename for two types of files is given. In fact, rename is used in combination with wildcards, and its function is more powerful than that shown in the above example. Basic wildcards include the following:
? Can replace a single character
* Replace multiple characters
[Charset] can replace any single character in the charset set
The following is an example:
If the folder contains these files foo1,..., foo9, foo10,..., foo278
Rename Foo foo0 Foo?
Then it will only rename the foo1 to foo9 file to foo01 to foo09, because? The wildcard character can only replace a single character. Therefore, the renamed file contains only four characters in length, and foo in the file name is replaced with foo0.
Continue to use
Rename Foo foo0 Foo ??
In this case, all the files from foo01 to foo99 in the folder are renamed to foo001 to foo099, while the names of foo100 and later files remain unchanged because of wildcards? So only the file with a length of five characters is renamed, And the foo in the file name is replaced with foo0.
If you continue to use
Rename Foo foo0 Foo *
All files from foo001 to foo278 are renamed to foo0001 to foo0278. Because wildcard * can replace multiple characters, all files starting with Foo are renamed, replace Foo with foo0 in the file name.
Let's take a look at the usage of the wildcard [charset], or continue in the folder mentioned above, and execute the following command
Rename foo0 Foo foo0 [2] *
All files from foo0200 to foo0278 are renamed to foo200 to foo278, And the foo0 in the file name is replaced with Foo.
In use, the three wildcards can be used together. For other specific usage, you only need to constantly explore them.
Forcibly clear the recycle bin
Versions earlier than ubuntu8.04
Sudo Rm-fr $ home/. Trash /*
Ubuntu 8.04
Sudo Rm-fr $ home/. Local/share/trash/files /*
The following is how to use the touch command:
-A: only change the access time
-C, -- no-create does not create any files
-D, -- date = string uses <string> to indicate the time rather than the current time
-F (ignore)
-M: only change the modification time
-R, -- reference = the file uses the specified <File> time attribute instead of the current time.
-T stamp uses the [[CC] YY] mmddhhmm [. SS] format instead of the current time
-- Time = the time specified by word: Access, atime, and use are both equal to-.
But modify and mtime are equal to-M.
-- Help: displays the help information and leaves
-- Version: displays the version information and leaves.
Note that the-D and-T options can be in different time/date formats.
Create and delete files and folders in Ubuntu, and forcibly clear the recycle bin