This article will share some common Linux command detailed usage, hope can give everybody some help
Change the directory's instruction CD
- CD Path : Enter the specified directory
- CD or CD ~: Enter your home directory
- CD- : Go to the last working directory, execute continuously, and switch back and forth between the current and previous directory
- cd-p : If the current directory is a soft connection, go to the source directory
displaying files and directories ls
- ls file name: Lists the file name, if you do not specify a file name or directory name, lists the current directory, expands the directory, and lists the file name of the primary subdirectory
- ls-a: Show all files, including hidden files,
- ls-a : Displays all files, including hidden files, but not included. And
- ls-l :--long format, which lists the file type, permissions, number of links, owner, group, size, time, name. Root user has default alias ll
- ls-r : Recursive, recursive display directory
- ls-d directory : Do not expand the directory, only display the directory itself, generally with-l use to display their own property information
- ls-1 : one column shows
- ls-s : Sorted by file size, by default from large to small, "ls-r" will be arranged in reverse order, that is, from small to large.
Show file Status stat
- stat file name : Displays all information about the file, including file size, time, IO block, number of links, uid, GID, and three timestamps.
Create a file Touch
- Touch filename : Creates an empty file if the file does not exist, and updates the timestamp if the file exists
- touch-a filename : Update only Atime, CTime.
The Red pen marked the atime,ctime time has changed
- touch-m filename : Update only Mtime, CTime.
The mtime,ctime time at the mark is updated.
- touch-c filename : If the file exists, the three timestamp is updated, and if the file does not exist, it will not be updated.
The three timestamps at the mark are updated.
- touch-t time filename : Update timestamp to specified time
Copy a document or directory CP
- CP Replication Source Replication destination : Copy a file to a destination
- cp-i : Prompt the user before overwriting, if do not add-I, then direct overwrite (premise does not use alias)
- Cp-r or R : recursive, such as source contains directory, must be recursive to copy
- cp-d : When the source of the copy is a soft connection, the copied file is also a soft connection, if not added, the full source file is copied.
- --preserv= : Mode reserved, wner[ship] reserved and owner,group, Time[stamp] retention timestamp is not changed, all above is included.
- cp-p : equivalent to--preserv=mode,owner,time
- cp-v : Displays the details of the replication.
Move File MV
- mv File address : Moves the file to the specified location.
Modify File Rename
Delete file or directory RM
- RM File/directory : Delete the specified file or directory
- rm-i : Prompt user before deletion, if not add-I, then delete directly (under normal circumstances, the RM has been set to ' Rm-i ' in Alias, so there is an alias, not added will also prompt. )
- rm-f : Force deletion of the specified file or directory
- rm-r/-r : cascading delete, deleting directories and their subdirectories
Create directory MkDir
- mkdir filename : Creating a Document
- mkdir-p a/b/c/ : Continuous creation of multi-level documents
- mkdir-v : Display process at creation time
- mkdir-m 777 : Specify permissions at creation time
A light green flag indicates that the permission is specified.
About Time stamps
- atime : Access time
- mtime : Data modification Time
- ctime : Metadata modification time
Sharing their learning with you is a very happy thing!
The person would not be lose oneself so long as not lose the direction
Linux Common Command Summary