This is the 13th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021.

Common Commands

linux-command

linux-command

agThe command

Ag super fast file search tool, compared with grep, search faster.

https://www.cnblogs.com/michael-xiang/p/10466890.html
Copy the code

c++filtThe command

The c++filt command can be used to resolve decorated symbols, such as variable and function names, in c++ and Java.

https://blog.csdn.net/K346K346/article/details/88225726
Copy the code

treeThe command

The tree command lists the contents of a directory in a tree diagram.

https://wangchujiang.com/linux-command/c/tree.html
Copy the code

cpThe command

Cp is short for copy. The cp command is used to copy files or folders.

https://jianrry.com/archives/100/
Copy the code

Parameters:

-a, --archive = -dr --preserve=all--backup[=CONTROL create a backup for each existing object file --b similar to --backup but does not accept the argument --copy-contents in recursive processing is to copy the special file contents -d = --no-dereference --preserve=links -f, --force If the target file cannot be opened, remove it and try again (do not select this option if -n exists) -i, --interactive ask before overwriting (invalidate the previous -n option) -h follow the command line symbolic link in the source file -l, --link the file without copying -l, --dereference always follow the symbolic link -n, --no-clobber do not overwrite existing files (invalidate the previous -i option) -p, --no-dereference does not follow symbolic links in the source file. -p equals --preserve= mode, ownership, timestamp --preserve[= Attribute list preserves the specified attributes (default: mode, ownership, timestamp), if possible preserves additional attributes: -r, -r, --recursive copy directory and all items in directory -t --target-directory= directory Copy all source files to target directory -t, --no-target-directory The target is a file, not a folderCopy the code

lnThe command

Links, which we can think of as aliases for files, fall into two categories:

  • Hard link means that a file can have multiple names.

    1. Hard links exist as copies of files. But it doesn’t take up real space;
    2. Hard links to directories are not allowed.
    3. Hard links can be created only in the same file system.
  • Soft link (symbolic link), meaning to generate a special file, the content of the file is to point to the location of another file.

    1. Soft links exist in the form of paths. Similar to shortcuts;
    2. Soft links can cross file systems, but hard links cannot.
    3. Soft links can link to a file name that does not exist.
    4. Soft links can link directories.
https://wangchujiang.com/linux-command/c/ln.html
Copy the code

sedThe command

Sed is a very powerful text-processing command tool. With regular expressions, you can search, replace, insert, and delete text. During processing, the current line is stored in a temporary buffer, called the Pattern space, and then the contents of the buffer are processed with the sed command. After processing, the contents of the buffer are sent to the screen. Proceed to the next line and repeat until you reach the end of the file. The contents of the document have not changed.

https://man.linuxde.net/sed
Copy the code

grep

Grep the Global Regular Expression Print command is a powerful text search tool. It can use Regular expressions to search text and Print matching lines. Main parameters:

https://wangchujiang.com/linux-command/c/grep.html
Copy the code

lsThe command

Using the ls command, you can display the target list.

https://wangchujiang.com/linux-command/c/ls.html#! kw=grepCopy the code

drwxr-xr-x   2 root root 48 2020-11-27 13:34 test/
Copy the code

The first column represents the attributes of the file. Software is basically divided into three attributes: readable (R), writable (W), executable (x). Numbers: 1 indicates the executable permission, 2 indicates the write permission, and 4 indicates the read permission. The first letter indicates the file type:

  • -, ordinary files.
  • dDirectory, yesdirtectoryThe abbreviations.
  • lSymbolic links.
  • bBlock device file.
  • c, character device file.

The following 3*3 characters are divided into three groups, each indicating the read, write, and execute permissions of the file. For owner, group, and others.

Because Linux/Unix is a multi-user, multi-task system, a file may be used by many people at the same time, so we must set the permissions of each file. The permissions of each file are in the following order (using -rwxr-xr-x as an example) :

RWX (Owner)r-x(Group)r-x(Other) The second field indicates the number of files. If it's a file, it's one, if it's a directory, it's the number of files in that directory. The third column indicates the owner of the file or directory. If the user is currently in his/her own 'Home', this column will probably be his/her account name. The fourth column indicates the group (' group ') it belongs to. Each user can have more than one group, but most users should belong to only one group, and may only be given another group if [system administrator] wishes to give a user special privileges. The fifth column indicates the file size. The size of a file is expressed in 'bytes', while empty directories are usually expressed in' 1024 bytes'. Of course, you can use other arguments to display different units of file size. For example, 'ls -- k' displays the size of a file in 'KB', but generally we use 'bytes' as the main unit. The sixth column indicates the last modification time. In the format of "month, day, time", such as' Aug 15 5:46 'means' 5:46 in the morning of August 15'. The seventh column represents the file name. We can display hidden file names with 'ls -a'. '-- rwxr-xr-x' converts to the permission number 755. RWX = 4+2+1=7; 2. 'r' = 4+1=5; 3. 'r' = 4+1=5.Copy the code

statThe command

The stat command is used to display detailed information about a file or file system. Display file information in more detail than the ls command.

https://wangchujiang.com/linux-command/c/stat.html
Copy the code

Parameters:

-l, --dereference: parse a file with a symbolic link instead of a symbolic link; -f, --file-system: displays information about the file system instead of the file. -c,--format= format: Output in the specified format instead of the default format. --printf=FORMAT: Output in the specified FORMAT, not the default FORMAT. Similar to --format, but can interpret backslash escape characters such as newline \n; -t, --terse: displays only summary information in concise mode. --help: Displays the help information. --version: displays the version information.Copy the code

Format control characters for displaying file information are as follows:

%a: display the access permissions in octal %a: display the access permissions in readable form %b: display the number of occupied blocks %b: display the number of bytes in each block %C: SELinux Security Context String %d: decimal display the device number of the file %D: Hexadecimal indicates the number of the device where the file resides. %f: indicates the hexadecimal file type. %f: indicates the file type. In Linux, files are classified into common files, directories, character device files, block device files, symbolic link files, and sockets %g: ID of the file owner group %g: name of the file owner group %h: number of hard links % I: inode number %m: mount point of the disk partition where the file resides, for example, /data %n: % O: Optimal I/O Transfer size hint %s: indicates the actual file size, in bytes %t: indicates the file name enclosed in single quotation marks. Major device type in hex for character/block Device special files %T: Minor device type in hex, for character/ Block Device Special Files %u: owner user ID %u: owner user name %w: time when the file was created. - Indicates that the file cannot be known. %w: Atime %x: indicates the last access time of the Unix timestamp. Atime %y: indicates the last modification time of the readable format. Mtime %y: indicates the modification time of the Unix timestamp. Ctime %Z: The Unix timestamp outputs the last state change ctimeCopy the code

Format controls for displaying file system information are:

%a: number of free blocks available to non-super users % B: total number of blocks in the file system % C: total number of file nodes in the file system % D: number of available file nodes %f: number of available file blocks % I: hexadecimal file system ID % L: maximum file name length %n: File name %s: %S: basic size of a block, in bytes (used to count the number of blocks) %t: hexadecimal output file system type %t: readable output file system typeCopy the code