Click the blue text above to follow us

1. cat displays file content starting from the first line
Syntax: cat [-AbEnTv]
Option -A: Equivalent to the combined option -vET, can list some special characters instead of just blanks; -b: lists line numbers, only for non-blank lines, blank lines do not show line numbers! -E: displays the end-of-line character $; -n: prints line numbers, including blank lines, different from option -b; -T: displays the [tab] key as ^I; -v: lists some invisible special characters
2. ls lists directories
Syntax: ls [-aAdfFhilnrRSt] directory_name
Option -a: lists all files, including hidden files (files starting with .) (commonly used) -d: lists only the directory itself, not the files within it (commonly used) -l: lists long data strings, including file attributes and permissions, etc.; (commonly used)
3. cd changes directories
Syntax: cd [relative_path or absolute_path]
4. mkdir creates a new directory
Syntax: mkdir [-mp] directory_name
Option -m: configure file permissions directly! No need to care about the default permissions (umask)~ -p: helps you recursively create the required directories (including the parent directory)!
5. touch creates a file
Syntax: touch [-acdfimrt] file
Option -a or --atime: only changes the access time. -c or --no-create: does not create any file. -d <timestamp> or --date=<timestamp>: uses the specified timestamp instead of the current time to set the file's time. -f: ignores non-existent files without giving a prompt. -i or --interactive: prompts for confirmation before deleting. -m or --mtime: only changes the modification time. -r <reference_file directory="" or="">: changes the date and time of the specified file or directory to that of the reference file or directory. -t <timestamp>: uses the specified timestamp instead of the current time.</timestamp></reference_file></timestamp></timestamp>
6. rm removes files or directories
Syntax: rm [-fir] file or directory
Option -f: means force, ignores non-existent files without warning; -i: interactive mode, asks the user for confirmation before deletion; -r: recursive deletion! Most commonly used for deleting directories! This is a very dangerous option.
7. cp copies files and directories
Syntax: cp [-adfilprsu] source_file destination_file
Option -a: equivalent to -pdr; for pdr please refer to the following explanation; (commonly used) -d: if the source file is a link file, it copies the link file attribute instead of the file itself; -f: means force, if the target file already exists and cannot be opened, it removes it and tries again; -i: if the target file already exists, it prompts for confirmation before overwriting (commonly used); -l: creates a hard link instead of copying the file itself; -p: copies the file's attributes instead of using the default attributes (commonly used for backups); -r: recursively continues to copy, used for directory copying; (commonly used) -s: copies as a symbolic link, also known as a 'shortcut' file; -u: only upgrades the destination if it is older than the source!
8. mv moves files and directories, or renames them
Syntax: mv [-fiu] source destination
Option -f: means force, if the target file already exists, it will overwrite without asking; -i: if the target file already exists, it will ask whether to overwrite! -u: if the target file already exists and the source is newer, it will upgrade (update).
9. chmod: changes file attributes
Syntax: chmod [-R] xyz file or directory
Option xyz: refers to the previously mentioned numeric permission attributes, which are the sum of rwx attribute values. -R: performs recursive changes, meaning all files in subdirectories will also change.
10. chown: changes file owner, can also change file group
Syntax: chown [options] [user:group] file_path
Option -c: only returns the changed parts; -f: suppresses error messages; -h: only modifies symbolic link files without affecting other related files; -R: recursively processes all files and subdirectories in the specified directory; -v: shows the command execution process.
11. chgrp changes file group
Syntax: chown [-R] owner_name file_name chown [-R] owner_name:group_name file_name
Option -R: recursively changes file group, meaning when changing a file's group in a directory, if the -R option is added, all files in that directory will change their group.
12. more displays one page at a time
Syntax: more filename
Description: During the execution of the more program, you have several keys you can press: Space: scrolls down one page; Enter: scrolls down 'one line'; /string: searches for the keyword 'string' in the displayed content; :f: immediately shows the file name and the currently displayed line number; q: exits more immediately, no longer displaying the file content. b or [ctrl]-b: scrolls back, but this action only works for files, not for pipes.

