Linux File System Operation commands

Source: Internet
Author: User
Tags echo command printable characters uncompress file transfer protocol

Linux File System Operation Command: 1. cat: displays the file content (often used with more), or combines multiple files into one. 2. chgrp: used to change the user group to which a file or directory belongs. The command parameters are separated by spaces to change the file list of the Group. The file name supports wildcards. If the user is not the owner of the file, you cannot change the group to which the file belongs. 3. chmod: used to change the access permissions of files or directories. This command has two usage methods: Graphical Method and numerical setting method. 4. chown: used to set a specified user or group as a specific owner. The user can be set as the user name or user ID, and the group can be the group name or group ID. A specific file is a list of files separated by spaces that can change permissions. The file name supports wildcards. 5. clear: used to clear the terminal screen. 6. cmp: used to compare the sizes of two files. 7. cp: (copy) You can copy files or directories to other directories, just like the copy command in Dos, which has very powerful functions. When using the cp command, you only need to specify the source file name or target directory. 8. cut: used to remove part of the file. 9. diff: used to identify the differences between the two files. 10. du: used to display the remaining disk space. 11. file: used to display the file type. 12. find: used to search for files in the directory and perform the specified operation. 13. head: view only the first few lines of the file without having to browse the entire file. 14. ln: You can create links between files. In fact, you can specify an alias for accessing a file. 15. less: similar to more, you can view the file content on more than one screen. The difference is that less can display the file by pressing the Space key down, and you can also use the direction key to scroll the display file, to end browsing, just press Q after the less prompt. 16. locate: it can be used to find files, and it is faster than the search speed of the find command. 17. ls (list): used to display the list of files and subdirectories in the current directory. 18. mkdir (make directory): Create a subdirectory. 19. more: used to display files with more than one screen. To prevent the file content from instantly disappearing, you can use the more command to pause when the file is fully displayed, press any key to display the content of the next screen. 20. rmkdir (remove directory): Used to delete "null" subdirectories or useless directory files. 21. mv (move): You can move files and directories to other locations or change the names of files and directories. 22. pico: You can specify the text editing method. 23. pwd (print working directory): displays the current directory of the user. 24. rm: Used to delete obsolete or useless files in the system. You can delete the files or directories in the directory. The original files remain unchanged for the linked files. 25. sort: automatically classifies text files. 26. stat: used to display the status of a file or file system. 27. Strings: display the string to be printed in the file. 28. tail: End of the output file. 29. touch: Change the file timestamp. 30. umask: Used to start bash shell. 31. uniq: Remove duplicate text lines from a classified file. 32. vi: Start the vi text editor. 33. wc: displays the number of lines in the text of the combination of bytes and words in the file. 34. whereis: Find the location of files such as the original program, binary program, or user manual in a specific directory. 35. man: If you want to know more about a command, you can use this command. 36. dd: copy an object. 37. df: view the disk space usage of a file system. 38. edquoat: sets disk space limits for users and user groups, that is, quotas in Windows. 39. fdformat: format the floppy disk. 40. fdisk: run the disk partition in Linux. 41. mkfs: Create a Linux File System. 42. mkswap: Create a Linux swap partition. 43. mount: mount a file system. 44. quota: Restrict and display the disk space available to users. 45. swapon, swapoff: Enable or cancel the switch page between the device and the file. 46. quotaon and quotaoff: Enable or cancel the quota limit. 47. umount: Cancel file system equipment. System Management command 1. finger: Query user information and view the default user environment. 2. ftp: the user interface of the standard file transfer protocol, which is the simplest and most effective method for transferring files over the network. 3. host: used for DNS query. 4. hostname: used to display or set the Host Name of the system. 5. ifconfig: used to configure the NIC interface. (You can use the down or up parameters to disable or enable a NIC interface.) 6. mail: send and receive emails. 7. netstat: displays network connection, route table, and network interface information. You can know which network connections are currently running. 8. ping: this command is used to test whether the computer is connected to other computers on the network. 9. rlogin: Remote logon command, which is similar to the telnet command and allows users to start interactive sessions of the remote system. 10. rcp: rcp (remote file copy) command is a remote file copy command used to copy files between computers. There are two formats, one for copying file dynamic files, the other is used to copy files or directories to other file directories. 11. route: this command is used to display or set the IP route table. 12. tcpdump: this command is used to test network traffic. 13. talk: This command can be used for timely conversations with network users, but the system information of both parties must be added to their respective/etc/hosts files for mutual identification. 14. telnet: this command is used to log on to a remote computer over the network, just like operating a local computer. 15. The wall: wall (write all) command can be used to send messages to users logging on to the local machine. When sending a message, you can directly enter the message to be sent or use the file as the message to send. 16. wget: this command is used to download files from the Internet in a Linux environment. It supports http and ftp protocols, the proxy server and the resumable upload function, and recursion of directories on remote hosts, find the desired file and download it to your local disk. The Wget command can be run in the background to intercept and ignore the hantfup signal. Therefore, you can continue running after logging out. 17. &, bg: &, bg commands are executed in the background. Sometimes, the user may need to execute a program for a long time. If the program is executed in the foreground, other operations may not be performed, it is best to put it in the background for execution. 18. fg: The fg command is executed on the foreground. If a program runs in the background, you can use the fg command to move the program from the background to the foreground for execution. 19. jobs: this command is used to display the list of tasks being executed in the background. Bg, fg, and jobs commands all belong to bash commands, 20. kill: this command is used to terminate a program. For example: # [root @ rathat9 root] kill 3793 21. ps: this command is used to display the program status. 22. top: this command is used to display the current CPU process. 23. at batch atp atrm: these commands are used to sort, check, or delete Tasks running in the background. Linux User-related commands: 1. passwd command: Change the user password. Format: passwd [user name] 2. su command: allows a common user to have the permissions of a Super User or other users, and allows the super support to do something as a common user. Format: su [Option] [?] [User Account] Description: If no user account is specified, the default value is Super User root. The meaning of the options in this command is-c: It ends after a command is executed. -: This minus sign is added to make the environment variable the same as the user to convert. -M: keep the environment variable unchanged. Linux system management command: 1. wall command: send information to all users logged in. 2. write command: send information to a user in the system. Format: write user account [terminal name] 3. mesg command: sets whether other users are allowed to send messages to themselves using the write command. If you can enter the command: mesg y if you cannot enter the command: mesg n 4. sync command: it is used to disable Linux. Sync forcibly writes data in the memory back to the hard disk to avoid data loss. 5. shutdown command: You can safely shut down or restart Linux to send a warning message to all login users on the system before the system is shut down. Format: the meaning of the option in the shutdown [Option] [time] [Warning Information] command:-k: it does not actually shut down, but only sends a warning message to all users. -R: restart immediately after shutdown. -H: Do not restart after shutdown. -F: The fsck is skipped when the instance is restarted. -N: fast shutdown without passing through the init program. -C: cancel a running shutdown. 6. free command: view the current system memory usage. It displays the remaining and used physical memory and swap memory in the system, as well as the shared memory and the buffer zone used by the core. Format: Meaning of each option in the free [-B |-k |-m] command:-B: displayed in bytes. -K: displayed in K bytes. -M: displayed in MB. 7. uptime command: shows how long the system has been running. It displays the following information in sequence: current time, how long the system has been running, how many login users are there, and the average load of the system in the past 1 minute, 5 minutes, and 15 minutes. 8. df command: Check disk space usage of the file system. Format: df [Option] Description: The df command displays the I node and disk block usage of all file systems. -A: displays the disk usage of all file systems, including 0 block file systems. -K: displayed in k bytes. -I: displays the I node information, not the disk block. -T: displays the disk space usage of each specified type of file system. -X: List disk space usage of a file system of a specified type. -T: displays the file system type. 9. du command: displays the disk space usage. Count the disk size occupied by directories (or files. Format: du [Option] [Names…] Note: This command step by step enters each sub-directory of the specified directory and displays the directory's usage of File System data blocks (1024 bytes. If no Names is provided, the current directory is counted. Meaning of each option in the command:-s: indicates the total number of data blocks occupied by each Names parameter. -A: recursively display the number of data blocks occupied by each file in the specified directory and its children's directories. If-s is not specified or-a is not specified, the number of disks occupied by each directory and Its subdirectories in Names is displayed. -B: List disk space usage in bytes (the system defaults to k bytes ). -K: List disk space usage in 1024 bytes. -C: Add a total (system default setting ). -L: calculates the size of all files. for hard-linked files, the calculation is performed multiple times. -X: Skipping directories on different file systems is not counted. 10. dd command: copy the specified input file to the specified output file, and convert the format during the copy process. Format: Meaning of each option in the dd [Option] command: if = input file (or device name ). Of = output file (or device name ). Ibs = bytes reads bytes at a time and the number of bytes read into the buffer zone. Skip = blocks skip the ibs * blocks block at the beginning of the read buffer. Obs = bytes: the number of bytes written to the buffer zone and the number of bytes written to the buffer zone at a time. Bs = bytes both set the number of bytes in the read/write buffer (equal to the value of ibs and obs). cbs = byte is converted to bytes at a time. Count = blocks only copies the input block. Conv = ASC Ⅱ converts the EBCDIC code to ASC Ⅱ. Conv = ebcdic converts ASC Ⅱ code to EBCDIC code. Conv = IBM converts ASC Ⅱ code to alternate EBCDIC code. Conv = block converts a variable bit to a fixed character. Conv = ublock converts a fixed bit to a variable bit. Conv = ucase converts lowercase letters to uppercase letters. Conv = lcase converts uppercase letters to lowercase letters. Conv = notrunc: the output file is not truncated. Conv = swab exchange each pair of input bytes. Conv = noerror: Do not stop processing. Conv = sync adjusts the size of each input record to the ibs size (filled with NUL ). 11. fdformat command: low-level formatting floppy disk. Format: format [-n] device Description:-n is not verified after the floppy disk is formatted. 12. echo command: displays a piece of text on the monitor, which generally serves as a prompt. Format: echo [-n] string 13. cal command: displays the calendar of a month of a year. Format: the meaning of each option in the cal [Option] [month [year] command:-j: displays the day of the year for each day of the given month (from January 1, January 1 ). -Y: displays the calendar of the entire year. 14. date command: displays and sets the system date and time. Format: date [Option] display time format (starting with +, followed by the format) date [Option] set the meaning of each option in the time format command: 15. clear command: clear information on the screen. Vi Basic commands: 1. move the cursor: Ctrl + B: roll up a screen Ctrl + f: roll down a screen Ctrl + d: roll down a half screen Ctrl + u: roll up a half screen G: move to the last W of the file: Move to the beginning of the next word B: Jump to the beginning of the first word 2. delete x: delete one character after the current cursor # x: delete # characters after the current cursor. For example, 5x indicates that 5 characters are deleted. Dd: Delete the row where the current cursor is located # dd: Delete the row behind the current cursor. For example, 5dd indicates deleting the five rows counted from the cursor.: L, # d: for example,: 1, 12d indicates deleting text from line 1 to line 12 X: deleting the Left character D of the current cursor to the end of line 3. change cw: change the word at the cursor to c # w at the end of the word. For example, c3w indicates to change three words. cc: Modify Row c: replace row c with end 4. replace r: replace character R at the cursor: replace character until Press ESC 5. copy yw: copy the word at the cursor to the end of the word only buffer zone P: paste the data in the buffer zone yy: copy the row where the cursor is located to the buffer zone # yy: Example: 5yy, copy, delete, and move the following five lines from the cursor to the Linux file in the buffer zone. cp command: this command is used to COPY the given file or directory to another file or directory. It is powerful like the COPY command in MSDOS. Syntax: cp [Option] source file or directory. The target file or directory indicates that this command copies the specified source file to the target file or copies multiple source files to the target directory. The options of this command are as follows:-a: This option is usually used in the copy directory. It retains links, file attributes, and Recursively copies directories. Its role is equal to the combination of dpr options. -D: copy is a reserved link-f: delete an existing target file without prompting. -I: opposite to option f, a prompt is prompted to support validation before overwriting the target file. When the answer is y, the target file will be overwritten, which is an interactive copy. -P: In addition to copying the content of the source file, cp also copies the modification time and the reverse question permission to the new file. -R; if the source file is a directory file, cp will recursively copy all subdirectories and files in the directory. The target file must be a directory name. -L: do not copy the file, but link the file. It should be noted that, in order to prevent the user from using the cp Command inadvertently to destroy another file, such as the target file name specified by the user already exists, use the cp command to copy the file, this file reception will be overwritten by new source files. Therefore, we recommend that you use the I option when copying files using the cp command. 2. mv command: You can use the mv command to rename a file or directory or move the file from one directory to another. The command is like a combination of ren and move under the MS-DOS. Syntax: mv [Option] source file or directory target file or directory. Note: depending on the type of the second parameter in the mv command (whether it is the target file or the target directory), the mv command renames the file or moves it to a new directory. When the second parameter type is file, the mv command renames the file. At this time, only one source file (or the source directory name) can be used ), rename the given source file or directory to the top target file name. When the second parameter is an existing directory name, there may be many parameters in the source file or directory. The mv command moves all the source files specified by the parameter to the target directory. When a file is moved across file systems, the mv copies the file first, and then deletes the original file. The link to the file will also be lost. The meaning of each option in the command is-I: interactive operation. If the mv operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to Answer y or n. This will avoid overwrite the file by mistake. -F: Disable interactive operations. When an mv operation overwrites an existing target file, it does not give any instructions. After this option is specified, the I option will no longer work. If the target file (not a directory) already exists, the content of the file overwrites the new backup file. To prevent the user from using the mv command to destroy another file, use the mv command to move the file, it is best to use the I option. 3. rm command: You can use the rm command to delete unnecessary files. This command is used to delete one or more files or directories in a directory. You can also delete a directory and all its files and subdirectories. For a linked file, the link is closed and the source file remains unchanged. The general format of the Rm command is: Rm [Option] file ...... If the-r option is not used, rm will not delete the directory. The meaning of each option of this command is as follows:-f: ignore non-existing files and never give a prompt. -R: indicates that rm deletes all directories and subdirectories listed in the parameter recursively. -I: Interactive deletion. Be careful when using the rm command. Because once an object is deleted, it cannot be recovered. To prevent this, you can use the I option to confirm the files to be deleted one by one. If you enter y, the file will be deleted. If you enter anything else, the file will not be deleted. Linux Directory Creation and deletion command: 1. mkdir command function: create a directory (similar to the md command under the MS-DOS ). Syntax: mkdir [Option] dir-name Description: This command creates a directory named by dir-name. The user who creates a directory must have write permission in the current directory (the dir-name parent directory), and The dirname cannot be an existing directory or file name in the current directory. The meaning of the options in the command is-m: Set the access permission for the new directory. You can also set it using the chmod command. -P: It can be a path name. If some directories in the path do not exist, after this option is added, the system automatically creates those directories that do not exist, that is, multiple directories can be created at a time. 2. rmdir command: delete an empty directory. Syntax: rmdir [Option] dir-name. /Description: dir-name indicates the directory name. This command deletes one or more sub-directory items from a directory. Note that a directory must be empty before it is deleted. The Rm-r dir command can replace rndir, But it is dangerous. When deleting a directory, you must also have the permission to write to the parent directory. The meaning of the options in the command is:-p recursively Delete the directory dirname. When the sub-directory is deleted and its parent directory is empty, it is also deleted. If the entire path is deleted or some paths are retained for some reason, the system displays the corresponding information on the standard output. 3. cd command function: change the working directory. Syntax: cd [directory] Description: This command changes the current directory to the directory specified by directory. If no directory is specified, return to the user's home directory. To change to a specified directory, you must have the execution and read permissions on the specified directory. This command can use wildcards (such as "*, _" and so on ). 4. the pwd command is in the Linux hierarchy. You can use the mkdir command in any authorized directory to create a new directory, or use the cd command to convert one directory to another. However, there is no prompt to tell the user which directory is currently in. To know the current directory, run the pwd command to display the entire path name. Syntax: pwd Description: This command displays the absolute path of the current working directory. 5. The ls command ls is short for list. Its function is to list the contents of a directory. This is one of the most commonly used commands supported, because users need to view the content of a directory from time to time. This command is similar to the dir command syntax in DOS: ls [Option] [directory or file] for each directory, this command will list all subdirectories and files. For each file, ls will output its file name and other required information. By default, output entries are sorted alphabetically. If the directory name or file name is not provided, the information of the current directory is displayed. -A: displays all subdirectories and files in the specified directory, including hidden files. -A: displays all subdirectories and files in A specified directory, including hidden files. But does not list ". and... ". -B: for non-printable characters in the file name, it is used to disable all devices in linux to display the extension names of files in linux in the form of files without practical significance. Command pwd display Path man + command to list operation instructions ls-l /-help to list the file directory cd/directory for Experiment Installation Steps configure make install? Rm-r dl recursively Delete directory rm-rf delete all directories rm-f add file name delete file rmdir + file address Delete folder all and rm-rf function almost touch Add name create new file cp copy mv move rm Delete vi text editor input a will change from command format to input format head tail view front and back find add location add file name search echo $ PATH query PATH useradd Add add name Add User userdel add name delete user su Add User Name switch user chmod + x/-x Add file name modify File Permission chmod 755 add file name change permission during installation grep add text character add that file search character exist command 1 | command 2 | command 3... MPs queue-ef view process ifconfig linux view ip redirection file sharing between linux and other machines vsftp transfer files between Windows and linux 15- 17putty remote login software sshgzip compression and decompression-d decompression 21 service iptables off firewall close tar-xvf second-layer uncompress. tar uncompress: tar xvf FileName.tar package: tar cvf FileName.tar DirName, not compressed !) ---------------.Gz unzip 1: gunzip FileName.gz unzip 2: gzip-d FileName.gz compression: gzip FileName .tar.gz and. tgz decompress: tar zxvf FileName.tar.gz. /DirName compression: tar zcvf FileName.tar.gz DirName .tar.bz2 unzip: tar xjf FileName.tar.bz2. /DirName compression: tar cjf FileName.tar.bz2 DirName rpm-ivh plus. rpm file installation and installation sudo apt-get install software name

Related Article

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: 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.