Create and delete files and folders in ubuntu, and forcibly clear the recycle bin method mkdir directory name & gt; create a directory www.2cto. comrmdir empty directory name & gt; delete an empty directory rm file name & gt; delete one or more files rm & amp; n... create and delete files and folders in ubuntu, force clear recycle bin method mkdir directory name => create a directory www.2cto.com rmdir empty directory name => delete an empty directory rm file name => delete a file or multiple files rm-rf not empty directory name => delete all touch file names in a non-empty directory => create an empty file and rename the file (folder) /move the file (folder) to the specified folder. the execution format is mv source destination Example: mv file1 file2 => Change file 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. The basic wildcards are as follows :? Replace a single character * to replace multiple characters [charset] to replace any single character in the charset set. The following is an example: for example, the folder contains these files foo1 ,..., foo9, foo10 ,..., foo278, if you use 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 will be renamed to foo0001 to foo0278. because wildcard * can replace multiple characters, all files starting with foo are renamed, and foo in the file name is replaced with foo0. Let's take a look at the usage of the wildcard [charset], or continue in the folder mentioned above, run 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 sudo rm-fr $ HOME/in versions earlier than ubuntu8.04 /. trash/* ubuntu 8.04 sudo rm-fr $ HOME /. local/share/Trash/files/* The following is the touch command usage-a only changes the access time-c, -- no-create does not create any file-d, -- date = string used <字符串> Indicates the time instead of the current time-f (ignore)-m only changes the modification time-r, -- reference = specifies the file <文件> Instead of the current time, use [[CC] YY] MMDDhhmm [. ss] format time rather than the current time -- time = WORD uses the time specified by WORD: access, atime, use are equal to the effect of-a option, the effect of modify and mtime is equal to-m options -- help displays the help information and leaves -- version displays the version information and leaves. Please note that, the-d and-t options can be in different time/date formats.
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.