Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The CentOS command introduces synthesis

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Note: when the web page is displayed, you can use Ctrl+F to retrieve the commands you want to see.

1, showing the shell currently in use

[root@localhost ~] # echo $SHELL

2, showing all shell currently used by the system

[root@localhost ~] # cat / etc/shells

3, display the hash cache

Hash: show cache-r: clear cache

4, multiple commands can be used; symbols are separated

5,history

-c: clear command history

-d: delete the command specified in the history

#: show the most recent # history

-a: append the newly executed command history of this session to the list to the history file

-n: read the unread lines in the history file to the history list

-r: read the history file and attach it to the history list

-w: save the history list to the specified history file

-p: expand the history parameter into multiple lines, but it does not exist in the history list

-s: expand the history parameter into a line and append it to the history list

6,Ctrl

+ l: clear the screen, which is equivalent to clear command

+ c: cancel the execution of the command

-a: move the cursor to the front of the command line

-e: move the cursor to the end of the command line

-u: delete the current position of the cursor to the beginning of the line

-k: delete the current position of the cursor to the end of the line

7,Esc

-b: move one word to the left

-f: move one word to the right

8, local help file location / usr/share/doc/

If there is no man help, you can use the following command to create the database after the installation of 9CentOS system is completed.

CentOS6 uses: makewhatis

CentOS7 uses: mandb

The operation method of 10 ~ (th) man command

Space, ^ v, ^ f, ^ F: flip the screen to the end of the file

B, ^ b: flip the screen to the head of the file

D, ^ d: turn half the screen to the end of the file

U, ^ u: turn half the screen to the head of the file

^ n or ^ e or ^ j: turn a line to the end of the file

^ y or ^ p or ^ k: turn one line to the beginning of the file

Q: exit

#: jump to line

1g: go back to the header of the file

G: turn to the end of the file

/ keywork: searches from the current position to the tail with the string as the keyword, and is not case-sensitive

N: next N: previous one

Keywork: searches from the current position to the header with a string as the keyword, and is not case-sensitive

N: next N: previous one

11, structure of the file system

/ boot: boot files are stored in the directory, and kernel files (vmlinuz) and boot loader (bootloader,grub) are all stored in this directory.

/ bin: a basic command for all users; a program that cannot be associated to a separate partition and will be used when OS starts.

/ sbin: the basic command of the management class; a program that cannot be associated to a stand-alone partition and is started by OS.

/ lib: basic shared library files and kernel module files that the program depends on at startup (/ lib/modules)

/ lib64: dedicated to the location of auxiliary shared library files on x86y64 systems

/ etc: configuration file directory

/ home/USERNAME: home directory for ordinary users

/ root: administrator's home directory

/ media: portable mobile device mount point

/ mnt: temporary file system mount point

/ dev: storage location of device files and special files

B:block device, random access

C:character device, linear access

/ opt: location where third-party applications are installed

/ srv: data used by services running on the system

/ tmp: temporary file storage location

/ usr:universal shared,read-only data

Bin: an application that ensures the full functionality of the system

Lib:32 bit usage

Lib64: only 64-bit systems exist

Header file (header files) of the include:C program

Share: structured independent data, such as doc,man, etc.

Local: where third-party applications are installed

/ var:variable data files

Cache: application cache data directory

Lib: application state information data

Local: dedicated to storing variable data for applications under / usr/local

Lock: locking files

Log: log directories and files

Opt: dedicated to storing variable data for applications under / opt

Run: running process-related data; usually used to store process pid files

Spool: application data pool

Tmp: save the temporary data generated between system restarts

/ proc: used to output the virtual file system related to the kernel process information

/ sys: used to output information about hardware devices on the current system, virtual file system

/ selinux:security enhanced linux,selinux-related security policies and other information storage location

12, file type

-: ordinary files

D: catalog file

B: block equipment

C: character device

L: symbolic link file

P: pipe file pipe

S: socket file socket

13th usage of ls

-a: contains hidden files

-l: display additional information

-R: directory recursion through

-ld: directory and symbolic link information

-1: file branch display

-S: sort from largest to smallest

-u: with the-t option, display and sort by atime from new to old

-U: unsorted display in directory storage order

14 ~ (st) stat displays three timestamps of the file

Access time: access time, atime, read file contents

Modify time: modification time, mtime, change file content (data)

Change time: change time, ctime, metadata change

15m touch command

Touch [OPTION]... FILE...

-a: change only atime

-m: change mtime only

-t:STAMP:

[[cc] yy] mmddhhmm [.ss]

-c: if the file does not exist, it will not be created

16pr cp command

-I: interactive

-rforce R: recursively copy the directory and all its internal contents

-a: archiving, equivalent to-dR-- preserv=all

-d:--no-dereference-- preserv=links does not copy the original file, only the link name

-p: equivalent-- preserv=mode,ownership,timestamp

-v:--verbose

-f:--force

17Based alias definition alias

Displays all available command aliases for the current shell process

[root@localhost ~] # alias

Define an alias NAME, which is equivalent to executing the command VALUE

[root@localhost ~] # alias NAME='VALUE'

Aliases defined on the command line are valid only for the current shell process.

If you want to be permanent, define it in the configuration file

For the current user only: ~ / .bashrc

Valid for all users: / etc/bashrc

Undo alias use: unalias

The 18pcmv command uses

Common options:

-I: interactive

-f: mandatory

19. The RM command uses the

Common options:

-I: interactive

-f: force deletion

-r: recursive

20day tree display directory tree

-d: show only directories

-L level: specifies the number of levels to display

-P pattern: displays only the paths matched by the specified pattern

21 minute mkdir create a directory

-p: does not report errors, and can automatically create the required directories

-v: display details

-m MODE: specify permissions directly when creating a directory

22pr rmdir delete empty directory

-p: recursively delete the parent empty directory

-v: display details

23dir rm delete data

-r: recursively delete the directory tree

-f: forced deletion is not prompted

24j STDOUT and STDERR redirect to a file

Format: command operation symbol file name

>: redirect STDOUT to a file

2 >: redirect STDERR to a file

& >: redirect all output to a file

>: the file content is overwritten

Set-C: it is forbidden to overwrite existing files, but you can add mandatory overrides: > |

Set + C: allow override

> >: add content on the basis of the original content

2 >: overwrite redirect error output data stream

2 > >: overweight directional error output data stream

Standard output and error output are directed to different locations: the format is as follows

COMMAND > / path/to/file.out 2 > / path/to/error.out

Merge standard output and error output to the same data stream for redirection: the format is as follows

& >: override redirection

& > >: pursue the orientation of weight

COMMAND > / path/to/file.out 2 > & 1 (order is important)

COMMAND > > / path/to/file.out 2 > > & 1

(): merge the STDOUT of multiple programs

(cal 2007; cal 2008) > all.txt

25pr-convert and delete characters

Tr [OPTION]... SET1 [SET2]

Options:

-c or-- complerment: take the complement of the character set

-d or-- delete: delete all characters belonging to the first character set

-s or-- squeeze-repeats: represents consecutive repeated characters as a single character

-t or-- truncate-set1: converts the character corresponding to the first character set to the character corresponding to the second character set

Use filea < fileb

26 less: view the input page by page

Ls-l / etc | less

Mail: send input via email:

Echo "testemail" | mail-s "test" user@example.com

Lpr: send input to the printer

Echo "testprint" | lpr-Pprinter_name

27recovertee: display the redirected content on the screen in the following format

Command 1 | tee file name | Command 2

2828 Useradd [options] LOGIN user creation

-u UID: [UID _ MIN,UID_MAX] is defined in / etc/login.defs

-o with-u option, do not check the uniqueness of UID

-g GID: indicates the basic group to which the user belongs, which can be the group name or GID

-c "COMMENT": user's comment information

-d HOME_DIR: the home directory that specifies the path (does not exist)

-s SHELL: specifies the default login shell for the user

-G GROUP1 [GROUP2,...]: indicates an additional group for the user, which must exist in advance.

-N: do not create a private group as the primary group, use the users group as the primary group

-r: create the system user CentOS 6:ID

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report