Linuxの基本的なコマンドコメント(2)

Linuxの基本的なコマンドコメント(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

猫およびtac

  • 猫の標準出力(画面)にファイルと出力の内容をステッチ
[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
    .....

  • 標準出力にリンクファイルと印刷コンテンツを逆TAC
[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

  • WCテキスト統計; -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

DFレポートファイルシステムのディスク領域の使用量

  • DFレポートファイルシステムのディスク領域の使用量
[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 ~]# 

  • あなたのttyターミナルをチェック
[root@hostnamectl ~]# tty
/dev/pts/0

そのビューは、絶対パスを命令します

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

クリアな画面クリア

  • 明確なまたはCtrl + Lを
[root@hostnamectl ~]# clear
[root@hostnamectl ~]# 

calのカレンダーを印刷

[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暦年N1の出力
[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.

  • 外部コマンド--help CMMAND
[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:コマンド名と機能の簡単な説明

書式:使用可能なオプションを含む使用上の注意、

説明:コマンドの機能の説明を詳細に説明し、各オプションの意味を含むことができ

OPTIONS:各オプションの重要性を説明

FILES:このコマンドは、関連の設定ファイル

BUGS:バグを報告

例:例コマンド

参照:追加参照

スクロール:スペース(バック一つの画面になって)、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