리눅스 기본 명령어 코멘트 (2)

리눅스 기본 명령어 코멘트 (2)

LN 링크 파일

  • LN -s [출처] [링크 이름 소프트 연결
[root@localhost ~]# ln -s anaconda-ks.cfg acd
[root@localhost ~]# ls -l
总用量 20
drwxr-xr-x. 3 root root   37 9月   8 11:02 a
-rw-r--r--. 1 root root   21 9月   8 09:31 abc
lrwxrwxrwx. 1 root root   15 9月  10 09:46 acd -> anaconda-ks.cfg
-rw-------. 1 root root 1451 9月   6 22:57 anaconda-ks.cfg

  • LN [출처] [연결 이름] 하드 링크
[root@localhost ~]# ln anaconda-ks.cfg vbn
[root@localhost ~]# ll
总用量 24
drwxr-xr-x. 3 root root   37 9月   8 11:02 a
-rw-r--r--. 1 root root   21 9月   8 09:31 abc
lrwxrwxrwx. 1 root root   15 9月  10 09:46 acd -> anaconda-ks.cfg
-rw-------. 2 root root 1451 9月   6 22:57 anaconda-ks.cfg
-rw-r--r--. 1 root root    0 9月   7 15:56 bbb
drwxr-xr-x. 3 root root   15 9月   7 16:33 c
-rw-r--r--. 1 root root  327 9月   7 16:42 cc
-rw-r--r--. 1 root root  126 9月   7 15:53 qwq
-rw-------. 2 root root 1451 9月   6 22:57 vbn

디렉토리에 파일, 파일에 대한 파일, 여러 파일을 복사 복사

  • CP
[root@localhost ~]# ls
a  abc  acd  anaconda-ks.cfg  bbb  c  cc  qwq  vbn  wqw
[root@localhost ~]# cp abc cc
cp:是否覆盖"cc"? y

  • 일반적으로 백업에 사용되는 -a 아카이브 사본,
[root@localhost ~]# ls
a  abc   acd  anaconda-ks.cfg  bbb  c  cc  qwq  vbn  wqw
[root@localhost ~]# cp -a abc acb
[root@localhost ~]# ls
a  abc  acb  acd  anaconda-ks.cfg  bbb  c  cc  qwq  vbn  wqw

  • 디렉토리를 복사 할 때 -r 재귀 복사,이 옵션을 사용해야합니다
[root@localhost ~]# ls 
a  abc  acb  acd  anaconda-ks.cfg  bbb  c  cc  qwq  vbn  wqw
[root@localhost ~]# ls c
[root@localhost ~]# 
[root@localhost ~]# cp -r a c

고양이와 전술

  • 고양이 표준 출력에 파일 출력의 내용을 바느질 (화면)
[root@localhost ~]# cat qwq
rootpw --iscrypted $6$15KaJSMJ1CnXnZP6$i.4EoTpZwTUTcZhK0oYRIjgyP9UTYbXsq//IV4xIiaB.2RfwtJP7SzhiAN4KcrAZP1ABjRIPx9pdl7vXdHoJk.

[root@localhost ~]# cat qwq wqw
rootpw --iscrypted $6$15KaJSMJ1CnXnZP6$i.4EoTpZwTUTcZhK0oYRIjgyP9UTYbXsq//IV4xIiaB.2RfwtJP7SzhiAN4KcrAZP1ABjRIPx9pdl7vXdHoJk.
rootpw --iscrypted $6$15KaJSMJ1CnXnZP6$i.4EoTpZwTUTcZhK0oYRIjgyP9UTYbXsq//IV4xIiaB.2RfwtJP7SzhiAN4KcrAZP1ABjRIPx9pdl7vXdHoJk.
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty

  • 표시 라인 -n 번호
[root@localhost ~]# cat -n anaconda-ks.cfg 
     1  #version=DEVEL
     2  # System authorization information
     3  auth --enableshadow --passalgo=sha512
     4  repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvailability
     5  repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientStorage
     6  # Use CDROM installation media
     7  cdrom
     8  # Use graphical install
     9  graphical
    10  # Run the Setup Agent on first boot
    11  firstboot --enable
    12  ignoredisk --only-use=sda
    13  # Keyboard layouts
    14  keyboard --vckeymap=cn --xlayouts='cn'
    15  # System language
    16  lang zh_CN.UTF-8
    .....

  • 표준 출력으로 전술 역방향 링크 파일 및 인쇄 내용
[root@localhost ~]# cat /etc/issue
\S
Kernel \r on an \m

[root@localhost ~]# tac /etc/issue

Kernel \r on an \m
\S

더 전체 화면보기 텍스트가 자동으로 읽은 후 다시 (공간 회전 후) 앞을 종료

[root@localhost ~]# more anaconda-ks.cfg 
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvaila
bility
repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientS
torage
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language
lang zh_CN.UTF-8
...

적은 : 페이지 텍스트 상자 후 전체 화면보기, B 첫 페이지 읽기가 자동으로 종료되지 않습니다, q는 종료

[root@localhost ~]# less anaconda-ks.cfg 

머리 与 꼬리

  • 파일 내용의 파일 헤더에서 프린트 헤드, 기본 10 선
[root@localhost ~]# head anaconda-ks.cfg 
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvailability
repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientStorage
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot

- [N] n 개의 표시 라인

[root@localhost ~]# head -15 anaconda-ks.cfg 
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvailability
repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientStorage
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language

[root@localhost ~]# cat anaconda-ks.cfg |head -15
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvailability
repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientStorage
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language

  • 파일의 꼬리 끝에서, 기본 10 라인을 파일의 내용을 인쇄하려면
[root@localhost ~]# tail anaconda-ks.cfg 

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

- [N] n 개의 표시 라인

[root@localhost ~]# tail -15 anaconda-ks.cfg 
@core
chrony
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

[root@localhost ~]# cat anaconda-ks.cfg |tail -15
@core
chrony
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

  • 표시 [N] 라인
[root@localhost ~]# cat anaconda-ks.cfg |head -11 | tail -1
firstboot --enable

[root@localhost ~]# head -11 anaconda-ks.cfg | tail -1
firstboot --enable

뒤보기 파일이나 디렉토리는 디스크 공간을 차지

  • 뒤보기 파일이나 디렉토리는 디스크 공간을 차지
[root@localhost ~]# du a
0   a/c
4   a

  • -s 만 카탈로그를 볼 수
[root@localhost ~]# du -s a
4   a

  • -h 디렉토리의 파일 크기를 표시
[root@localhost ~]# du -sh a
4.0K    a

  • 화장실 텍스트 통계, -c : 텍스트 바이트 수를 계산; w : 텍스트의 단어의 수를 계산, -l : 텍스트 리터 통계의 라인 수를
[root@localhost ~]# wc abc
 3  3 21 abc
[root@localhost ~]# wc -c abc
21 abc
[root@localhost ~]# wc -w abc
3 abc
[root@localhost ~]# wc -l abc
3 abc

안양 보고서 파일 시스템의 디스크 공간 사용

  • 안양 보고서 파일 시스템의 디스크 공간 사용
[root@localhost ~]# df
文件系统                 1K-块   已用     可用 已用% 挂载点
/dev/mapper/rhel-root 40137576 971488 39166088    3% /
devtmpfs                922456      0   922456    0% /dev
tmpfs                   933524      0   933524    0% /dev/shm
tmpfs                   933524   8844   924680    1% /run
tmpfs                   933524      0   933524    0% /sys/fs/cgroup
/dev/sda1              1038336 145824   892512   15% /boot
/dev/mapper/rhel-home 19593216  32956 19560260    1% /home
tmpfs                   186708      0   186708    0% /run/user/0

  • -h : 단위 변환, 더 쉬운 방법으로 디스플레이 크기
[root@localhost ~]# df -h
文件系统               容量  已用  可用 已用% 挂载点
/dev/mapper/rhel-root   39G  949M   38G    3% /
devtmpfs               901M     0  901M    0% /dev
tmpfs                  912M     0  912M    0% /dev/shm
tmpfs                  912M  8.7M  904M    1% /run
tmpfs                  912M     0  912M    0% /sys/fs/cgroup
/dev/sda1             1014M  143M  872M   15% /boot
/dev/mapper/rhel-home   19G   33M   19G    1% /home
tmpfs                  183M     0  183M    0% /run/user/0

호스트 이름은 호스트 이름을 수정

  • 호스트 이름보기 또는 터미널이 다시 시작 유효한, 실패 다시 임시 호스트 이름을 수정
[root@hostnamectl ~]# hostname
hostnamectl
[root@hostnamectl ~]# hostname M
[root@hostnamectl ~]# hostname
M

  • 터미널 효과적인 다시 시작의 재개는 여전히 유효합니다 (구성 파일을 수정합니다) 호스트 이름을 수정 hostnmectl
[root@M ~]# hostnamectl set-hostname hostnamectl
[root@M ~]# hostname
hostnamectl
[root@M ~]# shutdown -r now
Last login: Tue Sep 10 13:00:46 2019 from 192.168.213.1
[root@hostnamectl ~]# 

누구

[root@hostnamectl ~]# who       //显示当前登录用户
root     pts/0        2019-09-10 13:02 (192.168.213.1)
[root@hostnamectl ~]# w     //显示当前在线用户并显示其正在运行的命令
 13:06:14 up 3 min,  1 user,  load average: 0.01, 0.01, 0.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    192.168.213.1    13:02    6.00s  0.07s  0.06s w
[root@hostnamectl ~]# whoami            //显示当前登录用户
root
[root@hostnamectl ~]# who am i          //显示当前登录用户
root     pts/0        2019-09-10 13:02 (192.168.213.1)
[root@hostnamectl ~]# 

  • 당신의 청각 장애 터미널을 확인
[root@hostnamectl ~]# tty
/dev/pts/0

이는 뷰 절대 경로 명령

[root@hostnamectl ~]# which ls
alias ls='ls --color=auto'
    /usr/bin/ls

분명 명확한 화면

  • 투명 또는 Ctrl + 1
[root@hostnamectl ~]# clear
[root@hostnamectl ~]# 

칼 달력 인쇄

[root@hostnamectl ~]# cal
      九月 2019     
日 一 二 三 四 五 六
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

  • [N] 9999 연도 않음 1 출력
[root@hostnamectl ~]# cal 2012
                               2012                               

        一月                   二月                   三月        
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
 1  2  3  4  5  6  7             1  2  3  4                1  2  3
 8  9 10 11 12 13 14    5  6  7  8  9 10 11    4  5  6  7  8  9 10
15 16 17 18 19 20 21   12 13 14 15 16 17 18   11 12 13 14 15 16 17
22 23 24 25 26 27 28   19 20 21 22 23 24 25   18 19 20 21 22 23 24
29 30 31               26 27 28 29            25 26 27 28 29 30 31

        四月                   五月                   六月        
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
 1  2  3  4  5  6  7          1  2  3  4  5                   1  2
 8  9 10 11 12 13 14    6  7  8  9 10 11 12    3  4  5  6  7  8  9
15 16 17 18 19 20 21   13 14 15 16 17 18 19   10 11 12 13 14 15 16
22 23 24 25 26 27 28   20 21 22 23 24 25 26   17 18 19 20 21 22 23
29 30                  27 28 29 30 31         24 25 26 27 28 29 30

        七月                   八月                   九月        
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
 1  2  3  4  5  6  7             1  2  3  4                      1
 8  9 10 11 12 13 14    5  6  7  8  9 10 11    2  3  4  5  6  7  8
15 16 17 18 19 20 21   12 13 14 15 16 17 18    9 10 11 12 13 14 15
22 23 24 25 26 27 28   19 20 21 22 23 24 25   16 17 18 19 20 21 22
29 30 31               26 27 28 29 30 31      23 24 25 26 27 28 29
                                              30
        十月                  十一月                 十二月       
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
    1  2  3  4  5  6                1  2  3                      1
 7  8  9 10 11 12 13    4  5  6  7  8  9 10    2  3  4  5  6  7  8
14 15 16 17 18 19 20   11 12 13 14 15 16 17    9 10 11 12 13 14 15
21 22 23 24 25 26 27   18 19 20 21 22 23 24   16 17 18 19 20 21 22
28 29 30 31            25 26 27 28 29 30      23 24 25 26 27 28 29
                                              30 31

ldd 명령은 그 종속 라이브러리를 볼 수 있습니다

[root@hostnamectl ~]# ldd /usr/bin/ls
    linux-vdso.so.1 =>  (0x00007ffe917ec000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f3a56334000)
    libcap.so.2 => /lib64/libcap.so.2 (0x00007f3a5612f000)
    libacl.so.1 => /lib64/libacl.so.1 (0x00007f3a55f25000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f3a55b62000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f3a55900000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f3a556fb000)
    /lib64/ld-linux-x86-64.so.2 (0x00005561b7879000)
    libattr.so.1 => /lib64/libattr.so.1 (0x00007f3a554f6000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3a552da000)

날짜 시간

[root@hostnamectl ~]# date
2019年 09月 10日 星期二 13:21:59 CST

[root@hostnamectl ~]# date -s '2019-09-10 13:21:30'
2019年 09月 10日 星期二 13:21:30 CST

  • 출력 시간 포맷 :
    + %는 Y는 년도 :
    + %를 m : 월
    + %를 D : 일
    + % H를 :하면
    %의 M +가 : 분획
    + %를 S : 초
[root@hostnamectl ~]# date +%y
19
[root@hostnamectl ~]# date +%m
09
[root@hostnamectl ~]# date +%d
10
[root@hostnamectl ~]# date +%H
13
[root@hostnamectl ~]# date +%M
56
[root@hostnamectl ~]# date +%MS
  • 현재 파일 생성 시간
[root@hostnamectl ~]# touch $(date '+%Y%m%d')
[root@hostnamectl ~]# ls
20190910  a  abc  acb  acd  anaconda-ks.cfg  bbb 

도와주세요

  • help 명령은 내장 된 명령
[root@hostnamectl ~]# help cd
cd: cd [-L|[-P [-e]]] [dir]
    Change the shell working directory.
    
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.
    
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.

  • CMMAND --help 외부 명령
[root@hostnamectl ~]# ls --help
用法:ls [选项]... [文件]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all         不隐藏任何以. 开始的项目
  -A, --almost-all      列出除. 及.. 以外的任何项目
      --author          与-l 同时使用时列出每个文件的作者
  -b, --escape          以八进制溢出序列表示不可打印的字符
      --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,
                               '--block-size=M' prints sizes in units of
                               1,048,576 bytes; see SIZE format below
  -B, --ignore-backups       do not list implied entries ending with ~
  -c                         with -lt: sort by, and show, ctime (time of last
                               modification of fil
  • 남자 사용 설명서
    [] : 선택

<> : 필수

... : 여러 번있을 수 있습니다

| : 객관식

{} : 패킷

NAME : 명령 이름과 기능에 대한 간략한 설명

시놉시스 : 사용할 수있는 옵션을 포함 사용법주의 사항,

DESCRIPTION : 명령 기능의 상세한 설명과 각 옵션의 의미를 포함 할 수있다

옵션 : 각 옵션의 의미를 설명

FILES :이 명령은 관련 구성 파일

버그 : 버그를보고

예 : 예 명령

또한 다음과 같은 추가 참조

스크롤 : 공간 (한 화면 뒤로 설정), B 키를 (앞서 화면 플립)

: 찾기
전면 KEYWORD 찾기 위해 백업 : / 키워드를
앞으로 보이는 KEYWORD에서 :? KEYWORD를
N : 다음 일치하는 행의
행을 일치하기 전에 : N의
Q를 : 종료

남자

자본 N에서 찾기

N 다음 찾기를 소문자

   Mandatory arguments to long options are mandatory for short options  too.

       -a, --all
              do not ignore entries starting with .

       -A, --almost-all
              do not list implied . and ..

       --author
              with -l, print the author of each file

       -b, --escape
              print C-style escapes for nongraphic characters

       --block-size=SIZE
              scale sizes by SIZE before printing them; e.g.,  '--block-size=M'  prints
              sizes in units of 1,048,576 bytes; see SIZE format below

       -B, --ignore-backups
              do not list implied entries ending with ~

       -c     with  -lt:  sort  by,  and show, ctime (time of last modification of file
              status information); with -l: show ctime and  sort  by  name;  otherwise:
              sort by ctime, newest first

       -C     list entries by columns
 Manual page ls(1) line 15 (press h for help or q to quit)

추천

출처www.cnblogs.com/guilai/p/11527475.html