Common commands for Linux files and directories

Source: Internet
Author: User
Tags clear screen file permissions

First,Directory structure in Linux

/bin : System command Directory

/dev: System equipment Directory

/home: User's /home/lau

/lib : System library file . So Dynamic library . A Static library

/media : System Multimedia Directory (floppy drive, optical drive)

/MNT : System mount directory (external U- disk) /mnt/usb

/proc : System memory Directory

/sbin : Super admin Root command directory

/tmp: System cache Directory

/var: System temp directory (frequently changing) database file, Web page file, log file

/Boot: System startup directory

/etc: System configuration file directory

/lost+found : Lost and claimed office

/OPT : Third party program directory (QQ,wps)

/root : The home of the Super admin

/usr : System program directory (Apache,php,MySQL)

Second,Common commands

Ifconfig View IP Status

Ping command to test whether the network is unblocked

LS or ll : View current path file letter information

-A: View all information about a file (including hidden files)

Q exit (quit)

PWD : Viewing the current workspace

CD : Switch Directories

CD Space /home/zhangsan

CD Space : skip to top level directory

CD space ~ back to Super admin home

Clear Clear Screen operation

Login : Login

Logout : Logout (Logout)

Shutdown : Shut down the machine

-H: The number of minutes after the shutdown shutdown–h min (if 0 is immediately shutdown)

–r : The number of minutes after the restart Shutdown–r minute (if 0 is immediately restarted)

–k : Warning number of minutes after shutdown shutdown–k min (do not execute shutdown instruction, just a warning message)

-C: Abort shutdown instruction (usually with Ctrl + C abort shutdown command)

Halt : Shut Down (Linux only , but not power off)

Reboot : restart

SU: switching users

II. Document Management

1. file Permissions in Linux system

R (Read) 4 readable

W (write) 2 writable

X () 1 executable

2.creation and deletion of files

1)vi filename : Create file,

2)touch file name: Create file But do not open

3)rm file Name: Delete file or folder

-R : recursive delete

-F : Delete Confirmation

3. Directory Management

1)mkdir directory Name: Create file directory

-P : recursive creation

-M: Specify file permissions when creating a directory

2)rmdir directory Name: Delete file directory

-P : Recursive delete

4. Copying and moving

1) Copy cp [ parameters ] < source file path > < destination file path >

-R : Recursive replication

-P: Preserve the original properties of the file while copying

-V : Show replication Progress

To copy a folder:

To copy a file:

2) Move mv [ parameters ] [ source file or directory ] < destination file or directory >

-V : Show Progress

In addition to moving a file, the MV can also be implemented to rename the file

5. Document Statistics

WC [ parameters ] < file list > : File size statistics

-C : Statistics file byte Count

-L: Total row count of the statistics file

-W: number of words in the statistics file

6. grep Search ( pipeline command )

grep [ parameters ] <' strings '> < source files >

-N: Matching line number

-C: Number of matching rows

-I (ignore): Ignore case

7. display file Contents

1)cat : Display file contents (positive order Display)

2)TAC : Display file contents (reverse order Display)

8. Change file Permissions

chmod : Change file Permissions

-R : Recursive modification

9. Find file Lookup

Find [ directory list ] [ match Parameters ] [ match criteria ] Locate file

-name : Search by file name

gzip compression tool

syntax: gzip [-d#] filename where # is The number of 1-9

"-D": use when extracting

"-#": compression level,1 compression is the worst,9 compression is best,6 is the default

one,bzip2 compression Tools

syntax: bzip2 [-dz] filename

BZIP2 has only two options for you to master.

"-D": unzip

"-Z": compression

when compressing, you can add "-Z" can also not add, can be compressed files,"-D" is the decompression option:

Desktop CD /dev/cdrom directory Mount

Point the CDROM connection to a directory

Common commands for Linux files and directories

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.