What are the dos commands used in linux?

百草
Release: 2023-06-12 11:00:47
Original
1470 people have browsed it

The dos commands used in Linux are: 1. DIR, command to view directory contents; 2. linux, specify the search directory for executable files; 3. MD, command to create a directory; 4. CD, command to open the specified directory; 5. , RD, delete the currently specified subdirectory command; 6. C:, change the current drive letter command; 7. COPY, file copy command; 8. TYPE, display the text file content command; 9. REN, change the file name command; 10 , DEL, delete file command; 11. CLS, clear screen command.

What are the dos commands used in linux?

The operating system of this tutorial: linux5.18.14 system, DELL G3 computer.

dos common commands

(1) View directory content command DIR

(2) Specify executable file search directory PATH

(3) Create directory command MD

(4) Open the specified directory command CD

(5) Delete the currently specified subdirectory command RD

(6) Change the current Drive letter command C:

(7) File copy command COPY

(8) Display text file content command TYPE

(9) Change file name command REN

(10) Delete file command DEL

(11) Clear screen command CLS

PS Current page CTRL F Search keywords jump directly

DOS Command special command

Repeat the last entered command. You can use the F3 key to complete. At the same time, there is a doskey command recorder under DOS. After executing doskey on the command line, the following functions can be achieved:

1. Up arrow "↑" and down arrow "↓"-----Look back at the last executed command

2. "Ctrl C" key combination or "Break" Key-----Interrupt operation

3. Mouse operation "mark"-----------------Used to select text

4. Mouse operation "Paste" -----------------Used to paste the clipboard contents to the prompt

5, "F7" key----- ---------------------View and execute used commands

6, "/?" ---------- ------------------Specify command help

7, ">" and ">>" ---------- ------------File redirection

Parameters: Command>Write path\file name

Instance:

echo Baidu welcomes you >d:\1.txt ;Write text to the specified file (replace if the file exists)

netstat -an >>d:\1.txt ;Write text following the end

DOS command to enter directly

Edit

Directly enter a certain drive letter, drive letter:

If you directly enter the D drive, D:

DOS command directory command

(1) md——Create subdirectory

1. Function: Create a new subdirectory

2. Type: Internal command

3. Format: md [drive letter:] [path name]

4. Instructions for use:

(1) "Drive letter": Specify the subdirectory to be created The disk drive letter of the directory, if omitted, it is the current drive;

(2) "Pathname": The name of the superior directory of the subdirectory to be created. If it is defaulted, it will be built in the current directory.

Example: (1) Create a subdirectory named fox in the root directory of drive c; (2) Create a user subdirectory under the fox subdirectory.

md c:\ fox (Create the subdirectory fox under the current drive c drive)

md c:\ fox\user (Create the user subdirectory under the fox subdirectory)

(2) cd - change the current directory

1. Function: change the current directory

3. Format: CD [/D] [drive:][path]

(1) If the path and subdirectory name are omitted, the current directory will be displayed;

(2) If the "cd\" format is used, it will return to the root directory;

(3) If the "cd.." format is used, it will return to the upper directory.

(4) Using the /D command line switch, in addition to changing the current directory of the drive, you can also change the current drive.

Example: (1) Enter the user subdirectory; (2) Return from the user subdirectory to the subdirectory; (3) Return to the root directory.

c:\>cd fox\user (enter the user subdirectory under the fox subdirectory)

c:\fox\user>cd.. (return to the previous root directory, Note that cd is followed by two dots "..").

c:\fox>cd\ (return to the root directory)

c:\

(3) rd——Delete subdirectory command

1. Function: Delete subdirectories from the specified disk.

3. Format: rd[drive letter:][path name][subdirectory name]

(1) The subdirectory must be empty before deletion, which means it needs to be entered first For this subdirectory, use del (command to delete files) to delete the files in the subdirectory, then return to the upper directory, and use the rd command to delete the subdirectory itself;

(2) cannot Delete the root directory and current directory.

Example: It is required to delete the user subdirectory under the fox subdirectory of the c drive. The operation is as follows:

Step 1: Delete the files in the user subdirectory first;

c\>del c:\fox\user\*.* or del c:\fox\user or del c:\fox\user\*

(Note: This can only delete files, Still cannot delete the folders under the user directory)

The second step is to delete the user subdirectory.

c\>rd c:\fox\user

(Note: If there are still folders under the fox\user folder, this step will not work. How to solve it? Actually No need to go through two steps, just c\>rd c:\fox\user /s

and add a parameter /s. If you don’t want the system to ask whether to delete, you can add a parameter /q) .

rd (RMDIR): used to delete a directory in DOS operating system

RMDIR [/S] [/Q] [drive:]path

RD [/S] [ /Q] [drive:]path

Note: The following two parameters can only be used on WINXP (in fact, the following two parameters can also be used under the Vista system!)

/S In addition to the directory itself, all subdirectories and files under the specified directory will be deleted. Used to delete directory trees.

/Q Quiet mode, with /S does not ask for confirmation when deleting the directory tree.

For example: to delete the folder named myfile (this folder is empty) on the D drive, you can enter rd d:\myfile.

If myfile is not empty, you can enter rd d:\myfile /S d:\myfile to delete the myfile folder and all its subfolders and files.

(4) dir——Display disk directory command

1. Function: Display the contents of the disk directory.

3. Format: dir [drive letter][path][file name][/p][/w][/A[[:]attribute]][/O[:]sort order]] [/S]

4. Instructions for use: Use of /p; when there are too many directories to be viewed and cannot be displayed on one screen, the screen will keep scrolling up, making it difficult to see clearly, add /p After the parameters are passed, the screen will display 23 lines of file information at a time, then pause, and prompt; press any key to continue (press any key to continue)

Use of /w: Add /w to only display The file name, file size and creation date and time are omitted. After adding parameters, each line can display five file names.

/A Displays files with specified attributes.

Attribute D Directory R Read-only file H Hidden file A File to be archived

S ​​System file I Index file without content L Parse point - prefix indicating "no"

/O List files in sorted order.

Sort orderN By name (alphabetical order) S By size (smallest to largest) E By extension (alphabetical order)

D By date/time (first to last) G Group Directory first - Reverse the order of the prefix

/S to display files in the specified directory and all subdirectories.

(5) path - path setting command

1. Function: The search path for device executable files is only valid for files.

3. Format: path [drive letter 1] directory [path name 1] {[; drive letter 2:], ...}

(1) When running When an executable file is created, DOS will first search for the file in the current directory, and if it is found, run it; if the file cannot be found, it will search for the file in the directory one by one according to the path set by the path command;

(2) If there are more than two paths in the path command, each path should be separated by a semicolon ";";

(3) There are three ways to use the path command:

path[Drive letter 1:][Path 1][Drive letter 2:][Path 2]... (Set the search path for executable files) path: (Cancel all paths)

path: (Display the currently set path)

(6) tree - Display disk directory structure command

1. Function: Display all directory paths on the specified drive and the directories under these directories All file names.

2. Type: External command

3. Format: tree [Drive letter:][/f][>prn]

(1) Use the /f parameter When it is displayed, all directories and all files under the directory are displayed. When omitted, only the directory is displayed and the files under the directory are not displayed;

(2) When the >prn parameter is selected, the listed directories and files in the directory are displayed. File name printout.

(7) deltree - Delete the entire directory command

1. Function: Delete the entire directory and its subordinate subdirectories and files.

3. Format: deltree [drive letter:]

4. Instructions for use: This command can delete the directory and all files, subdirectories, and lower layers in one step. The subdirectories of the file will be deleted together, and regardless of whether the file's attribute is hidden, system, or read-only, as long as the file is located in the deleted directory, deltree will treat it equally and delete it without error. Be careful when using it!

(8) tasklist - display process

1. Function: Display the processes of the entire computer, the same as the task manager.

3. Format: tasklist

4. Instructions: Run cmd tasklist

DOS command disk command

(1) format——disk format command

1. Function: Format the disk, divide the tracks and sectors; check whether there are defective tracks on the entire disk, mark the bad sectors; establish The directory area and file allocation table prepare the disk to receive DOS.

3. Format: format〈Drive letter:〉[/s][/4][/q]

(1) The drive letter after the command cannot be defaulted. If the hard disk is Formatting, the following prompt will appear: warning: all data on non

——removable disk

drive c: will be lost!

proceed with format (y/n)?

(Warning: All data on the c drive will be lost. Are you sure you want to continue formatting? {y (OK)/n( Negative)})

(2) If the floppy disk is formatted, the following prompt will be displayed: insert new diskette for drive a;

and press enter when ready…

(Insert the new disk in drive A and press Enter when ready).

(3) Select the [/s] parameter to copy the DOS system files io.sys, msdos.sys and command to the disk so that the disk can be used as a DOS boot disk. If the /s parameter is not selected, the formatted disk can only read and write information and cannot be used as a boot disk;

(4) Select the [/4] parameter in a 1.2mb high-density floppy drive Format a 360kb low-density disk;

(5) Select the [/q] parameter for quick formatting. This parameter will not re-divide the disk's tracks and sectors. It can only clear the disk root directory, file allocation table and boot sector to blank, so , the formatting speed is faster.

(6) Select the [/u] parameter to indicate unconditional formatting, which means destroying all data on the original disk. Without /u, it is a safe format. At this time, create an image file to save the original fat table and root directory. If necessary, use unformat to restore the original data.

(2) unformat recovery formatting command

1. Function: Recover a disk that has been formatted and lost data due to misuse.

3. Format: unformat〈drive letter〉[/l][/u][/p][/test]

4. Instructions for use: used to be "non-destructive" "Formatted Disk Recovery. When the deleted files or subdirectories in the root directory and the system sectors of the disk (including fat, root directory, boot sector and hard disk partition table) are damaged, you can also use unformat to rescue them.

(1) Use the /l parameter to list the found subdirectory names, file names, approximate dates and other information, but it will not actually do unformat work.

(2) Select the /p parameter to display the report on the screen (including the information generated by the /l parameter) and also send it to the printer. When running, the screen will display: "print out will

be sent to lpt1"

(3) Select the /test parameter to only perform simulation tests (test) without performing real writing actions. When using this parameter, the screen will display: "simulation only"

(4) Select the /u parameter to not use the data of the mirror image file and unformat directly according to the current status of the disk.

(5) Select /psrtn; to repair the hard disk partition table.

If you add one of /p, /l, or /test after the drive letter, it is equivalent to using the /u parameter. Unformat will "assume" that there is no mirror image file on the disk at this time.

Note: unformat can completely restore the newly formatted disk, but if other data is written after formatting, unformat cannot completely rescue the data. Unformat is not a panacea. Since using unformat will rebuild the fat and root directories, it is also highly dangerous. Improper operation may increase losses. If you only delete a few files or subdirectories by mistake, you only need to use undelete. enough.

(3) chkdsk - Check the current status of the disk command

1. Function: Display the disk status, memory status and the discontinuous number of specified files under the specified path.

3. Format: chkdsk [drive letter:][path][file name][/f][/v]

(1) If the [file name] parameter is selected, the The file occupies the disk;

(2) Select the [/f] parameter to correct the logical errors found on the specified disk;

(3) Select the [/v] parameter to display the disk All files and paths on .

(4) diskcopy——Full disk copy command

1. Function: Copy the floppy disk with exactly the same format and content.

3. Format: diskcopy[Drive letter 1:][Drive letter 2:]

(1) If the target floppy disk is not formatted, the system will automatically select formatting when copying.

(2) If there are original files on the target floppy disk, they will all be lost after copying.

(3) If it is a single drive copy, the system will prompt you to replace the source disk and target disk in due course. Please pay attention to distinguish the source disk and target disk when operating.

(5) label——Create disk volume label command

1. Function: Create, change, and delete disk volume label.

3. Format: label[drive letter:][volume label name]

(1) The volume label name is the name of the volume label to be created. If this parameter is omitted by default, the system prompts Type the volume name or ask whether to delete the original volume name;

(2) The volume name consists of 1 to 11 characters.

(6) vol——Display disk volume label command

1. Function: View the disk volume label.

3. Format: vol[Drive letter:]

4. Instructions: Omit the drive letter and display the current drive volume label.

(7) scandisk - Detect and repair disk command

1. Function: Check whether there are problems with the fat table, directory structure, file system, etc. of the disk, and can detect the problems be repaired.

3. Format: scandisk[Drive letter 1:]{[Drive letter 2:]…}[/all]

(1) scandisk is suitable for hard disks and floppy disks, and you can specify multiple files at one time disks or use the [/all] parameter to specify all disks;

(2) can automatically detect logical errors such as cross-connections, missing clusters, and directory structures that occur in the disks, and repair them.

(8) defrag——Rearrange disk command

1. Function: Defragment the disk and eliminate disk fragments.

3. Format: defrag[drive letter:][/f]

4. Instructions for use: Use the /f parameter to eliminate the fragments in the file on the disk and adjust the disk file Arrange it so that there are no gaps between files. This speeds up disk reading and saves disk space.

(9) sys - system copy command

1. Function: Transfer the dos system files io.sys, msdos.sys and command on the current drive to the specified drive.

3. Format: sys[Drive letter:]

*Instructions for use: If the remaining space on the disk is not enough to store system files, the prompt is: no room for on destination disk.

DOS command file command

(1) copy file copy command

1. Function: Copy one or more files to the specified disk.

3. Format: copy [source disk][path](source file name) [target disk][path](destination file name)

(1) Copy is a file-to-file method of copying data. The target disk must have been formatted before copying;

(2) During the copy process, old files with the same file name on the target disk will be copied by the source disk. File replacement;

(3) When copying files, you must first ensure that the target disk has enough space, otherwise an "insufficient" error message will appear, prompting that the disk space is insufficient;

(4) File Wildcard characters "*" and "?" are allowed in the name, and multiple files can be copied at the same time;

(5) The source file name in the copy command must be specified and cannot be omitted.

(6) When copying, the target file name can be the same as the source file name, which is called "copy with the same name." In this case, the target file name can be omitted;

(7) When copying, the target file name The name can also be different from the source file name, which is called "different-name copy". In this case, the target file name cannot be omitted;

(8) When copying, several files can also be merged into one file. It is called "merge copy" and the format is as follows: copy;[source disk][path]〈source file name 1〉〈source file name 2〉…[target disk][path]〈target file name〉;

(9) Using the copy command, you can also enter data from the keyboard to create a file. The format is as follows: copy con [drive letter:][path];

After editing, Ctrl Z saves the edit .

(10) Note: When using the copy command, there must be a space between the source file name and the target file name!

(2) xcopy——Directory copy command

1. Function: Copy the specified directory and all files under the directory together with the directory structure.

3. Format: xcopy [source disk:][target drive letter:][destination path name][/s][/v][/e]

(1) xcopy is an extension of copy. It can copy the specified directory together with the files and directory structure, but it cannot copy hidden files and system files;

(2) When using, the source drive letter and source destination path Specify at least one name and source file name;

(3) When /s is selected, copy all files in the source directory and its subdirectories. Unless the /e parameter is specified, /s will not copy an empty directory. If the /s parameter is not specified, xcopy will only copy the files in the source directory itself, without involving the subdirectories below it;

(4) When the /v parameter is selected, all copied sectors will be verified, but the speed will be reduced.

(3) type——Display file content command

1. Function: Display the content of the ascii code file.

2. Type: Internal command.

3. Format: type [drive letter:] [path]

(1) Display a text file composed of ascii code, with extension for .exe or .com, etc. The displayed content is unreadable and has no practical meaning;

(2) This command can only display the contents of one file at a time, and wildcards cannot be used;

(3) If the file has an extension, the extension must be written;

(4) When the file is too long to be displayed on one screen, it can be displayed in the following format; type [drive letter:] [path] |more, more is a split-screen display command. After using these parameters, it will pause when the screen is full. Press any key to continue the display.

(5) If you need to print out the file content, you can use the following format:

type[drive letter:][path]〈file name〉,>prn

At this point, the printer should be online.

(4) ren——File rename command

1. Function: Change file name

3. Format: ren[Drive letter:][Path]

(1) The drive letter and path cannot be added before the new file name, because this command can only change the file name of the file on the same disk;

( 2) Allows using wildcards to change a set of filenames or extensions.

(5) fc——File comparison command

1. Function: Compare the similarities and differences of files and list the differences.

3. Format: fc[drive letter:][path name][drive letter:][path name][file name][/a][/c][/n]

(1) Select the /a parameter, which is the ascii code comparison mode;

(2) Select the /b parameter, which is the binary comparison mode;

(3) Select /c Parameter, uppercase and lowercase characters are treated as the same characters.

(4) Select the /n parameter to display the line numbers of differences in the ascii code comparison mode.

(6) attrib——Modify file attributes command

1. Function: Modify the attributes of the specified file. (For file attributes, please refer to the section 2.5.4 (2) File Attributes)

2. Type: External command.

3. Format: attrib[file name][r][—r][a][—a][h][—h][—s]

(1) Select r parameter, set the specified file to read-only attribute, so that the file can only be read, data cannot be written or deleted; use the -r parameter to remove the read-only attribute;

(2) Use the a parameter, Set the file as file attribute; select the -a parameter to remove the file attribute; (3) Select the h parameter to adjust the file to the implicit attribute; select the -h parameter to remove the implicit attribute;

(4) ) Select the s parameter to set the file as a system attribute; select the -s parameter to remove the system attribute; (5) Select the /s parameter to set all subdirectories in the current directory.

(7) del——Delete file command

1. Function: Delete the specified file.

3. Format: del[drive letter:][path][/p]

(1) Select the /p parameter, and the system will ask whether you really want to delete it before deleting it. This file will be automatically deleted if this parameter is not used;

(2) This command cannot delete files with implicit or read-only attributes;

(3) Wildcards can be used in file names;

(4) If you want to delete all files on the disk (del*·* or del·), you will be prompted: (arey ou sure? ) (Are you sure?) If the answer is y, the deletion will be carried out. If the answer is n, the deletion operation will be cancelled.

(8) undelete——Undelete command

1. Function: Recover accidentally deleted command

3.Format: undelete[drive letter:][path name] 〈File name〉[/dos][/list][/all]

4. Instructions for use: Use undelete to use the "*" and "?" wildcard characters.

(1) Use the /dos parameter to restore files based on the remaining records in the directory. When a file is deleted, the first character of the file name recorded in the directory will be changed to e5. DOS uses the e5 at the beginning of the file and its subsequent characters to find the file to be restored. Therefore, undelete will ask the user to enter a character. to complete the file name. But this character does not have to be the same as the original, it only needs to comply with the file name rules of DOS.

(2) Select /list to only "list" files that meet the specified conditions without restoring them, so there will be no impact on the disk content at all.

(3) Select /all to automatically fully restore fully recoverable files without asking the user one by one. When using this parameter, if undelete uses the remaining records in the directory to restore the files, it will Automatically select a character to complete the file name and make it different from the existing file name. The preferred order of characters is: #%——0000123456789a~z.

undelete also has the function of establishing protective measures for files, which is beyond the scope of this course. Readers are advised to consult the relevant DOS manuals when using these functions.

DOS commands other commands

(1) cls——Clear screen command

1 Function: Clear the screen All are displayed with the cursor in the upper left corner of the screen.

2 Type: Internal command

3 Format: cls

(2) ver View system version number command

1 Function: Display the current system version number

3 Format: ver

(3) date date setting command

1 Function: Set or display the system date.

3 Format: date[mm——dd——yy]

4 Instructions for use:

(1) Omit [mm——dd——yy] to display the system date and prompts you to enter a new date. If you do not modify it, you can press the Enter key directly. [mm——dd——yy] is the format of "month month - day day - year year";

(2 ) When the machine starts to start and the automatic processing file (autoexec.bat) is executed, the system will not prompt for the system date. Otherwise, prompt for a new date and time.

(4) time system clock setting command

1 Function: Set or display the system time.

3 Format: time[hh: mm: ss: xx]

(5) mem command to view the current memory status

1 Function: Display the current memory usage

2 Type: External command

3 Format: mem[/c][/f][/m][/p]

(1) Select the /c parameter column Displays the length of each file loaded into conventional memory and cmb, and also displays the usage of memory space and the maximum available space;

(2) Select the /f parameter to list the remaining bytes of the current conventional memory. Size and umb available area and size;

(3) Use the /m parameter to display the address, size and module properties of the memory used by the module;

(4) Use the /p parameter to specify the current When the output exceeds one screen, it is paused for users to view.

(6) msg ​​display system information command:

1 Function: Display the status of the system hardware and operating system.

3 Format: msg[/s]

(1) When the /i parameter is selected, the hardware is not detected;

(2) When the /b parameter is selected, black and white Start in msg;

(3) When the /s parameter is selected, a concise system report is displayed.

The above is the detailed content of What are the dos commands used in linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!