Linux file Management class commands and command aliases

Source: Internet
Author: User

File View Class command:
Cat
TAC: Starting at the end of the file

Split screen display:
More [option] File name: View to end of file exits
Space for page flipping
Less [option] File name: View to end of file does not exit
Ctrl+d: Turn half screen down
Ctrl+u: Half screen upward
K: Go up one line
Enter: Turn down one line
1 J: First line
: Last line
/keyword: Finds the specified character, starting with the file header
Keyword: finds the specified character, starting at the end of the file
N: Look down
N: Go up.
#G: Locating a row
Q:
End-to-end view: Head, tail
Head [options] File name
-N: Specifies how many rows to view, default is the first 10 rows, n is optional

HEAD-5 messages: Displays the first five elements of a messages file
Head-n 5 messages: Show file before five elements
Head message: The first 10 lines of the file are displayed by default

tail [options] File name
-N: Specifies how many rows to view, default is the following 10 rows, n is not optional
-F: Follow file additions to view log files

TAIL-5 messages: Displays the five elements of the messages file
Tail-n 5 messages: Five elements after displaying files
Tail Message: 10 lines after the file is displayed by default
Tail-f Log.txt Real-time monitoring file, if there is new content, will be displayed

Time Stamp management tool for files
File
Metadata: File attribute information, such as owner, genus Group, size, type, timestamp, etc.
Data: File contents

Time stamp:
Last access Time (read): Access times, atime
Last Modify (Write): Modify time, Mtime
Time of last change (metadata, write): Change times, CTime

Touch [option] File name
-A: Modify Atime only
-M: Modify Mtime only
-T STAMP: [[CC]YY]MMDDHHMM[.SS]
-C: Do not create empty files

File meta Data View: Stat

Touch-a-t 201510101425.30 AA: Custom modification time
Touch-c file1: If File1 does not exist, it will not be created

File management tools: CP, MV, RM

File copy: Source file, Target location
CP [OPTION] ... [-T] SOURCE DEST
CP [OPTION] ... SOURCE ... DIRECTORY
CP [OPTION] ...-t DIRECTORY SOURCE ...

CP SRC DEST:
If Dest does not exist, the copy src is desk, which is equivalent to copying and renaming
If dest exists:
If Dest is a file, overwrite
If Dest is a directory, copy the file into the Dest directory and keep the file

CP SRC ... Directory: If multiple source files are specified at the same time, the destination must be a directory

Note: If the source file is a symbolic link file, copy the contents of the source file that the link points to

Common options for CP:
-R: Recursive replication when replicating directories
-D: Do not follow the source file that the symbolic link file points to, that is, copy the linked file itself instead of the file it points to
-A: equivalent to-DR
-i:interactive, when the target file exists, reminds the user whether to perform the overwrite (y/n)
-f:force, forced coverage

Cp-r/etc/tmp/: Copy the ETC directory to TMP
Cp-r/etc/*/tmp/: Copy all files and directories under the ETC directory to TMP
Which CP: View the CP command itself and its path

File movement: MV
MV [OPTION] SRC DEST
MV [OPTION] SRC ... DEST
-i:interactive
-f:force

File deletion: RM
RM [OPTION] FILE ...
-R: Recursively deletes the directory and all its internal files
-F: Force delete

Note: It is recommended to move to a dedicated directory for a period of time before cleaning up

Command aliases for Bash features:
Alias displays all command aliases

Define aliases: alias command aliases = ' real commands '
Alias Name= ' VALUE '
Note: Aliases defined on the command line are valid only for the current shell process, and need to be defined in the configuration file if they are to be permanently valid;
Valid only for the current user: ~/.bash
Valid for all users:/etc/bash

Note: Edit the configuration file directly

Revoke aliases: Unalias command aliases
Unalias NAME


Linux file Management class commands and command aliases

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.