Common Linux commands-file processing commands

Source: Internet
Author: User
The following 13 commands are the most common file processing commands in Linux.

The following 13 commands are the most common file processing commands in Linux.

1) Linux file processing command: ls
Command name: ls
List
Path:/bin/ls
Execution permission: all users
Function description: displays directory files.
Syntax: ls option [-ald] [file or directory]
-A: displays all files, including hidden files.
-L detailed information (long format) display
-D. View directory properties.

2) Linux file processing command: cd
Command name: cd
Change directory
Path: shell built-in commands
Execution permission: all users
Function description: switch directories.
Syntax: cd [Directory]
Example: $ cd/switch to the root directory
$ Cd .. go back to the upper-level Directory

3) Linux file processing command: pwd
Command name: pwd
Print working directory
Path:/bin/pwd
Execution permission: all users
Function description: displays the current working directory.
Syntax: pwd
Example: $ pwd

4) Linux file processing command: touch
Command name: touch
Path:/bin/touch
Execution permission: all users
Function description: creates an empty file.
Syntax: touch [file name]
Example: $ touch newfile

5) Linux file processing command: mkdir
Command name: mkdir
Make directories
Path:/bin/mkdir
Execution permission: all users
Function description: Creates a directory.
Syntax: mkdir [directory name]
Example: $ mkdir newdir

6) Linux file processing command: cp
Command name: cp
Copy
Path:/bin/cp
Execution permission: all users
Function description: copy a file or directory.
Syntax: cp-R [source file or directory] [New Directory]
-R copy Directory
Example:
$ Cp file1 file2 dir1 copy the file file1 file2 to the directory dir1
$ Cp-R dir1 dir2: Copy all files and subdirectories in the dir1 directory to dir2

7) Linux file processing command: mv
Command name: mv
Move
Path:/bin/mv
Execution permission: all users
Function description: Move file/rename
Syntax: mv [file or directory] [New Directory]
Example:
$ Mv file2 dir2 move File file2 to directory dir2
$ Mv file1 file2 rename file1 in the current directory to file2

8) Linux file processing command: rm
Command name: rm
Remove
Path:/bin/rm
Execution permission: all users
Function description: delete an object.
Syntax: rm-r [file or directory]
-R: Delete a directory.
Example:
$ Rm file1 delete file file1
$ Rm-r dir1 delete the Directory (the directory must be empty) dir1

9) Linux file processing command: cat
Command name: cat
Concatenate and display files
Path:/bin/cat
Execution permission: all users
Function description: displays the file content.
Syntax: cat [file name]
Example: $ cat/etc/services

10) Linux file processing command: more
Command name: more
Path:/bin/more
Execution permission: all users
Function description: displays the file content by page.
Syntax: more [file name]
(Space) or f displays the Next page
(Enter) display the next line
Q or q quit
Example: $ more/etc/services

11) Linux file processing command: head
Command name: head
Path:/bin/head
Execution permission: all users
Function description: view the first few lines of a file.
Syntax: head-num [file name]
-Num: displays the first num row of the file.
Example: $ head-20/etc/services

12) Linux file processing command: tail
Command name: tail
Path:/bin/tail
Execution permission: all users
Function description: displays the last few lines of a file.
Syntax: tail-num [file name]
-Num: displays the last num row of the file.
-F dynamically displays the file content
Example: $ tail-30/etc/services

13) Linux file processing command: ln
Command name: ln
Link
Path:/bin/ln
Execution permission: all users
Function description: generate a link file.
Syntax: ln-s [source file] [target file]
-S: create a soft link
Example:
$ Ln/etc/issue. hard
Create a hard link/issue. hard for the file/etc/issue
$ Ln-s/etc/issue. soft
Create a soft connection to the file/etc/issue. soft

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: info-contact@alibabacloud.com 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.