802.11ad——您前所未见的最快WiFi解决方案

毫米波段Wi-Fi技术,亦被称为802.11ad,是一种强大的新型无线标准,而相关产品才刚刚投放市场——包括由TP-Link推出的一款路由器与华硕打造的一台笔记本电脑。

802.11ad基于超高频无线电波——具体来讲,目前的802.11n与802.11ac标准采用5 GHz频率,但ad则使用60 GHz。这意味着其既能够处理远高于以往标准的数据量,同时持续时间亦更短——这是由于频率更高的信号会更快消失。 Continue reading

Posted in 综合布线, 计算机网络 | Tagged , | 1 Comment

17 个 tar 命令实用示例(转)

Tar(Tape ARchive,磁带归档的缩写,LCTT 译注:最初设计用于将文件打包到磁带上,现在我们大都使用它来实现备份某个分区或者某些重要的目录)是类 Unix 系统中使用最广泛的命令,用于归档多个文件或目录到单个归档文件中,并且归档文件可以进一步使用 gzip 或者 bzip2 等技术进行压缩。 adidas ultra boost uncaged uomo 换言之,tar 命令也可以用于备份:先是归档多个文件和目录到一个单独的 tar 文件或归档文件,然后在需要之时将 tar 文件中的文件和目录释放出来。 本文将介绍 tar 的 17 个实用示例。 tar 命令语法如下:

  • # tar <选项> <文件>
  • 下面列举 tar 命令中一些常用的选项:

    –delete : 从归档文件 (而非磁带) 中删除 -r, –append : 将文件追加到归档文件中 -t, –list : 列出归档文件中包含的内容 –test-label : 测试归档文件卷标并退出 -u, –update : 将已更新的文件追加到归档文件中 -x, –extract, –get : 释放归档文件中文件及目录 -C, –directory=DIR : 执行归档动作前变更工作目录到 DIR -f, –file=ARCHIVE : 指定 (将要创建或已存在的) 归档文件名 -j, –bip2 : 对归档文件使用 bzip2 压缩 -J, –xz : 对归档文件使用 xz 压缩 -p, –preserve-permissions : 保留原文件的访问权限 -v, –verbose : 显示命令整个执行过程 -z, gzip : 对归档文件使用 gzip 压缩

    注 : 在 tar 命令选项中的连接符 - 是可选的(LCTT 译注:不用 - 也没事。这在 GNU 软件里面很罕见,大概是由于 tar 命令更多受到古老的 UNIX 风格影响)。 示例 1:创建一个 tar 归档文件 现在来创建一个 tar 文件,将 /etc/ 目录和 /root/anaconda-ks.cfg 文件打包进去。

  • [root@linuxtechi ~]# tar -cvf myarchive.tar /etc /root/anaconda-ks.cfg
  • 以上命令会在当前目录创建一个名为 “myarchive” 的 tar 文件,内含 /etc/ 目录和 /root/anaconda-ks.cfg 文件。 其中,-c 选项表示要创建 tar 文件,-v 选项用于输出 tar 的详细过程到屏幕上,-f 选项则是指定归档文件名称。

  • [root@linuxtechi ~]# ls -l myarchive.tar
  • -rw-r--r--. 1 root root 22947840 Sep 7 00:24 myarchive.tar
  • [root@linuxtechi ~]#
  • 示例 2:列出归档文件中的内容 在 tar 命令中使用 –t 选项可以不用释放其中的文件就可以快速列出文件中包含的内容。

  • [root@linuxtechi ~]# tar -tvf myarchive.tar
  • 列出 tar 文件中的指定的文件和目录。下列命令尝试查看 anaconda-ks.cfg 文件是否存在于 tar 文件中。

  • Nike Air Max 2017 Dames
  • [root@linuxtechi ~]# tar -tvf myarchive.tar root/anaconda-ks.cfg
  • -rw------- root/root 953 2016-08-24 01:33 root/anaconda-ks.cfg
  • [root@linuxtechi ~]#
  • 示例 3:追加文件到归档(tar)文件中 -r 选项用于向已有的 tar 文件中追加文件。 new balance baskets cheap bns gold 下面来将 /etc/fstab 添加到 data.tar 中。

  • [root@linuxtechi ~]# tar -rvf data.tar /etc/fstab
  • 注:在压缩过的 tar 文件中无法进行追加文件操作。 Kanken Mini 示例 4:从 tar 文件中释放文件以及目录 -x 选项用于释放出 tar 文件中的文件和目录。下面来释放上边创建的 tar 文件中的内容。

  • [root@linuxtechi ~]# tar -xvf myarchive.tar
  • 这个命令会在当前目录中释放出 myarchive.tar 文件中的内容。 示例 5:释放 tar 文件到指定目录 假如你想要释放 tar 文件中的内容到指定的文件夹或者目录,使用 -C 选项后边加上指定的文件的路径。

  • [root@linuxtechi ~]# tar -xvf myarchive.tar -C /tmp/
  • 示例 6:释放 tar 文件中的指定文件或目录 假设你只要释放 tar 文件中的 anaconda-ks.cfg 到 /tmp 目录。 语法如下:

  • # tar –xvf {tar-file } {file-to-be-extracted } -C {path-where-to-extract}
  • [root@linuxtechi tmp]# tar -xvf /root/myarchive.tar root/anaconda-ks.cfg -C /tmp/
  • root/anaconda-ks.cfg
  • [root@linuxtechi tmp]# ls -l /tmp/root/anaconda-ks.cfg
  • -rw-------. 1 root root 953 Aug 24 01:33 /tmp/root/anaconda-ks.cfg
  • [root@linuxtechi tmp]#
  • 示例 7:创建并压缩归档文件(.tar.gz 或 .tgz) 假设我们需要打包 /etc 和 /opt 文件夹,并用 gzip 工具将其压缩。 New Balance 530 homme New Balance 1400 męskie 可以在 tar 命令中使用 -z 选项来实现。 Nike Air Max 2016 Dames Zwart 这种 tar 文件的扩展名可以是 .tar.gz 或者 .tgz。

  • [root@linuxtechi ~]# tar -zcpvf myarchive.tar.gz /etc/ /opt/
  • [root@linuxtechi ~]# tar -zcpvf myarchive.tgz /etc/ /opt/
  • 示例 8:创建并压缩归档文件(.tar.bz2 或 .tbz2) 假设我们需要打包 /etc 和 /opt 文件夹,并使用 bzip2 压缩。 adidas y3 homme 可以在 tar 命令中使用 -j 选项来实现。 louboutin 这种 tar 文件的扩展名可以是 .tar.bz2 或者 .tbz。 asics gel kinsei 4 donna

  • [root@linuxtechi ~]# tar -jcpvf myarchive.tar.bz2 /etc/ /opt/
  • [root@linuxtechi ~]# tar -jcpvf myarchive.tbz2 /etc/ /opt/
  • 示例 9:排除指定文件或类型后创建 tar 文件 创建 tar 文件时在 tar 命令中使用 –exclude 选项来排除指定文件或者类型。 New Balance 247 mujer 假设在创建压缩的 tar 文件时要排除 .html 文件。

  • [root@linuxtechi ~]# tar -zcpvf myarchive.tgz /etc/ /opt/ --exclude=*.html
  • 示例 10:列出 .tar.gz 或 .tgz 文件中的内容 使用 -t 选项可以查看 .tar.gz 或 .tgz 文件中内容。如下:

  • [root@linuxtechi ~]# tar -tvf myarchive.tgz | more
  • .............................................
  • drwxr-xr-x root/root 0 2016-09-07 08:41 etc/
  • -rw-r--r-- root/root 541 2016-08-24 01:23 etc/fstab
  • -rw------- root/root 0 2016-08-24 01:23 etc/crypttab
  • lrwxrwxrwx root/root 0 2016-08-24 01:23 etc/mtab -> /proc/self/mounts
  • -rw-r--r-- root/root 149 2016-09-07 08:41 etc/resolv.conf
  • drwxr-xr-x root/root 0 2016-09-06 03:55 etc/pki/
  • drwxr-xr-x root/root 0 2016-09-06 03:15 etc/pki/rpm-gpg/
  • -rw-r--r-- root/root 1690 2015-12-09 04:59 etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  • -rw-r--r-- root/root 1004 2015-12-09 04:59 etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
  • -rw-r--r-- root/root 1690 2015-12-09 04:59 etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Testing-7
  • -rw-r--r-- root/root 3140 2015-09-15 06:53 etc/pki/rpm-gpg/RPM-GPG-KEY-foreman
  • ..........................................................
  • 示例 11:列出 .tar.bz2 或 .tbz2 文件中的内容 使用 -t 选项可以查看 .tar.bz2 或 .tbz2 文件中内容。如下:

  • [root@linuxtechi ~]# tar -tvf myarchive.tbz2 | more
  • ........................................................
  • rwxr-xr-x root/root 0 2016-08-24 01:25 etc/pki/java/
  • lrwxrwxrwx root/root 0 2016-08-24 01:25 etc/pki/java/cacerts -> /etc/pki/ca-trust/extracted/java/cacerts
  • drwxr-xr-x root/root 0 2016-09-06 02:54 etc/pki/nssdb/
  • -rw-r--r-- root/root 65536 2010-01-12 15:09 etc/pki/nssdb/cert8.db
  • -rw-r--r-- root/root 9216 2016-09-06 02:54 etc/pki/nssdb/cert9.db
  • -rw-r--r-- root/root 16384 2010-01-12 16:21 etc/pki/nssdb/key3.db
  • -rw-r--r-- root/root 11264 2016-09-06 02:54 etc/pki/nssdb/key4.db
  • -rw-r--r-- root/root 451 2015-10-21 09:42 etc/pki/nssdb/pkcs11.txt
  • -rw-r--r-- root/root 16384 2010-01-12 15:45 etc/pki/nssdb/secmod.db
  • drwxr-xr-x root/root 0 2016-08-24 01:26 etc/pki/CA/
  • drwxr-xr-x root/root 0 2015-06-29 08:48 etc/pki/CA/certs/
  • drwxr-xr-x root/root 0 2015-06-29 08:48 etc/pki/CA/crl/
  • drwxr-xr-x root/root 0 2015-06-29 08:48 etc/pki/CA/newcerts/
  • drwx------ root/root 0 2015-06-29 08:48 etc/pki/CA/private/
  • drwx------ root/root 0 2015-11-20 06:34 etc/pki/rsyslog/
  • drwxr-xr-x root/root 0 2016-09-06 03:44 etc/pki/pulp/
  • ..............................................................
  • 示例 12:解压 .tar.gz 或 .tgz 文件 使用 -x-z 选项来解压 .tar.gz 或 .tgz 文件。如下:

  • [root@linuxtechi ~]# tar -zxpvf myarchive.tgz -C /tmp/
  • 以上命令将 tar 文件解压到 /tmp 目录。 注:现今的 tar 命令会在执行解压动作前自动检查文件的压缩类型,这意味着我们在使用 tar 命令是可以不用指定文件的压缩类型。 Adidas Superstar Femme Fleur 如下:

  • [root@linuxtechi ~]# tar -xpvf myarchive.tgz -C /tmp/
  • 示例 13:解压 .tar.bz2 或 .tbz2 文件 使用 -j-x 选项来解压 .tar.bz2 或 .tbz2 文件。如下:

  • [root@linuxtechi ~]# tar -jxpvf myarchive.tbz2 -C /tmp/
  • [root@linuxtechi ~]# tar xpvf myarchive.tbz2 -C /tmp/
  • 示例 14:使用 tar 命令进行定时备份 总有一些实时场景需要我们对指定的文件和目录进行打包,已达到日常备份的目的。假设需要每天备份整个 /opt 目录,可以创建一个带 tar 命令的 cron 任务来完成。如下:

  • [root@linuxtechi ~]# tar -zcvf optbackup-$(date +%Y-%m-%d).tgz /opt/
  • 为以上命令创建一个 cron 任务即可。 示例 15:使用 -T 及 -X 创建压缩归档文件 想像这样一个场景:把想要归档和压缩的文件及目录记录到到一个文件,然后把这个文件当做 tar 命令的传入参数来完成归档任务;而有时候则是需要排除上面提到的这个文件里面记录的特定路径后进行归档和压缩。 在 tar 命令中使用 -T 选项来指定该输入文件,使用 -X 选项来指定包含要排除的文件列表。 Asics Pas Cher 假设要归档 /etc、/opt、/home 目录,并排除 /etc/sysconfig/kdump 和 /etc/sysconfig/foreman 文件,可以创建 /root/tar-include 和 /root/tar-exclude 然后分别输入以下内容:

  • [root@linuxtechi ~]# cat /root/tar-include
  • /etc
  • /opt
  • /home
  • [root@linuxtechi ~]#
  • [root@linuxtechi ~]# cat /root/tar-exclude
  • /etc/sysconfig/kdump
  • /etc/sysconfig/foreman
  • [root@linuxtechi ~]#
  • 运行以下命令来创建一个压缩归档文件。

  • [root@linuxtechi ~]# tar zcpvf mybackup-$(date +%Y-%m-%d).tgz -T /root/tar-include -X /root/tar-exclude
  • 示例 16:查看 .tar、.tgz 和 .tbz2 文件的大小 使用如下命令来查看 (压缩) tar 文件的体积。

  • [root@linuxtechi ~]# tar -czf - data.tar | wc -c
  • 427
  • [root@linuxtechi ~]# tar -czf - mybackup-2016-09-09.tgz | wc -c
  • 37956009
  • [root@linuxtechi ~]# tar -czf - myarchive.tbz2 | wc -c
  • 30835317
  • [root@linuxtechi ~]#
  • 示例 17:分割体积庞大的 tar 文件为多份小文件 类 Unix 系统中使用 split 命令来将大体积文件分割成小体积文件。 louboutin chaussure 大体积的 tar 当然也可以使用这个命令来进行分割。 假设需要将 “mybackup-2016-09-09.tgz” 分割成每份 6 MB 的小文件。

  • Syntax : split -b <Size-in-MB> <tar-file-name>.<extension> “prefix-name”
  • [root@linuxtechi ~]# split -b 6M mybackup-2016-09-09.tgz mybackup-parts
  • 以上命令会在当前目录分割 mybackup-2016-09-09.tgz 文件成为多个 6 MB 的小文件,文件名为 mybackup-partsaa ~ mybackup-partsag。 New Balance 1400 femme 如果在要在分割文件后以数字而非字母来区分,可以在以上的 split 命令使用 -d 选项。

  • [root@linuxtechi ~]# ls -l mybackup-parts*
  • -rw-r--r--. 1 root root 6291456 Sep 10 03:05 mybackup-partsaa
  • -rw-r--r--. Nike Roshe Run Style Homme
  • Nike Air Max 180
  • 1 root root 6291456 Sep 10 03:05 mybackup-partsab
  • -rw-r--r--. 1 root root 6291456 Sep 10 03:05 mybackup-partsac
  • -rw-r--r--. 1 root root 6291456 Sep 10 03:05 mybackup-partsad
  • -rw-r--r--. nike cortez bambini 1 root root 6291456 Sep 10 03:05 mybackup-partsae
  • -rw-r--r--. 1 root root 6291456 Sep 10 03:05 mybackup-partsaf
  • -rw-r--r--. 1 root root 637219 Sep 10 03:05 mybackup-partsag
  • [root@linuxtechi ~]#
  • 然后通过网络将这些分割文件转移到其他服务器,就可以合并成为一个单独的 tar 文件了,如下:

  • [root@linuxtechi ~]# cat mybackup-partsa* > mybackup-2016-09-09.tgz
  • [root@linuxtechi ~]#
  • 文毕,希望你喜欢 tar 命令的这几个不同的示例。随时评论并分享你的心得。

    Posted in Linux | Tagged , | Leave a comment

    理解 Linux 下 Shell 命令的不同分类及它们的用法(转)

    当你打算真正操纵好你的 Linux 系统,没有什么能比命令行界面更让你做到这一点。 Canada Goose Expedition Parka 为了成为一个 Linux 高手,你必须能够理解 Shell 命令的不同类型[1],并且会在终端下正确的使用它们。 Joc Pederson Jersey 在 Linux 下,命令有几种类型,对于一个 Linux 新手来说,知道不同命令的意思才能够高效和准确的使用它们。因此,在这篇文章里,我们将会遍及各种不同分类的 Linux Shell 命令。 louboutin sneakers 需要注意一件非常重要的事:命令行界面和 Shell 是不同的,命令行界面只是为你提供一个访问 Shell 的方式。 Nike Air Max 90 Femme Noir Et Blanc Nike Air Max 2016 Dames wit Fjallraven Kanken Sverige

  • AIR HUARACHE
  • 而 Shell ,它是可编程的,这使得它可以通过命令与内核进行交流。 Jason Pierre-Paul Los Angeles Lakers 下面列出了 Linux 下命令的不同种类: 1. goedkoop nike air max 2016 程序可执行文件(文件系统 中的命令) 当你执行一条命令的时候,Linux 通过从左到右搜索存储在 $PATH 环境变量中的目录来找到这条命令的可执行文件。 你可以像下面这样查看存储在 $PATH 中的目录:

    • $ echo $PATH
    • /home/aaronkilik/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

    在上面的命令中,目录 /home/aaronkilik/bin 将会被首先搜索,紧跟着是 /usr/local/sbin,然后一直接着下去。 Women Air Jordan 6 在搜索过程中,搜索顺序是至关重要的。 Adidas Superstar Femme Portee A.J. Green Jerseys 比如在 /usr/bin 目录里的文件系统中的命令:

    • $ ll /bin/

    示例输出:

    • total 16284
    • drwxr-xr-x 2 root root 4096 Jul 31 16:30 ./
    • drwxr-xr-x 23 root root 4096 Jul 31 16:29 ../
    • -rwxr-xr-x 1 root root 6456 Apr 14 18:53 archdetect*
    • -rwxr-xr-x 1 root root 1037440 May 17 16:15 bash*
    • -rwxr-xr-x 1 root root 520992 Jan 20 2016 btrfs*
    • -rwxr-xr-x 1 root root 249464 Jan 20 2016 btrfs-calc-size*
    • lrwxrwxrwx 1 root root 5 Jul 31 16:19 btrfsck -> btrfs*
    • -rwxr-xr-x 1 root root 278376 Jan 20 2016 btrfs-convert*
    • -rwxr-xr-x 1 root root 249464 Jan 20 2016 btrfs-debug-tree*
    • -rwxr-xr-x 1 root root 245368 Jan 20 2016 btrfs-find-root*
    • -rwxr-xr-x 1 root root 270136 Jan 20 2016 btrfs-image*
    • -rwxr-xr-x 1 root root 249464 Jan 20 2016 btrfs-map-logical*
    • -rwxr-xr-x 1 root root 245368 Jan 20 2016 btrfs-select-super*
    • -rwxr-xr-x 1 root root 253816 Jan 20 2016 btrfs-show-super*
    • -rwxr-xr-x 1 root root 249464 Jan 20 2016 btrfstune*
    • -rwxr-xr-x 1 root root 245368 Jan 20 2016 btrfs-zero-log*
    • -rwxr-xr-x 1 root root 31288 May 20 2015 bunzip2*
    • -rwxr-xr-x 1 root root 1964536 Aug 19 2015 busybox*
    • -rwxr-xr-x 1 root root 31288 May 20 2015 bzcat*
    • lrwxrwxrwx 1 root root 6 Jul 31 16:19 bzcmp -> bzdiff*
    • -rwxr-xr-x 1 root root 2140 May 20 2015 bzdiff*
    • lrwxrwxrwx 1 root root 6 Jul 31 16:19 bzegrep -> bzgrep*
    • -rwxr-xr-x 1 root root 4877 May 20 2015 bzexe*
    • lrwxrwxrwx 1 root root 6 Jul 31 16:19 bzfgrep -> bzgrep*
    • -rwxr-xr-x 1 root root 3642 May 20 2015 bzgrep*

    2. fjallraven kanken goedkoop Linux 别名 这些是用户定义的命令,它们是通过 shell 内置命令 alias 创建的,其中包含其它一些带有选项和参数的 shell 命令。 Asics Gel Lyte 5 Homme 这个意图主要是使用新颖、简短的名字来替代冗长的命令。 nike air jordan 11 homme asics tiger femme 创建一个别名的语法像下面这样:

    • $ alias newcommand='command -options'

    通过下面的命令,可以列举系统中的所有别名:

    • $ alias -p
    • alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
    • alias egrep='egrep --color=auto'
    • alias fgrep='fgrep --color=auto'
    • alias grep='grep --color=auto'
    • alias l='ls -CF'
    • alias la='ls -A'
    • alias ll='ls -alF'
    • alias ls='ls --color=auto'

    要在 Linux 中创建一个新的别名,仔细阅读下面的例子。 Nike Air Max

    • $ alias update='sudo apt update'
    • $ alias upgrade='sudo apt dist-upgrade'
    • $ alias -p | grep 'up'

    然而,上面这些我们创建的别名只能暂时的工作,当经过下一次系统启动后它们不再工作。 Air Jordan 30 Homme 2015 new balance 530 nike air max 但你可以在 ‘.bashrc’ 文件中设置永久别名。 New Balance 990 homme Maglie Milwaukee Bucks 添加以后,运行下面的命令来激活:

    • $ source ~/.bashrc

    3. nike buty sklep Linux Shell 保留字 在 shell 程序设计中,ifthenfiforwhilecaseesacelseuntil 以及其他更多的字都是 shell 保留字。正如描述所暗示的,它们在 shell 中有特殊的含义。 Asics Gel Lyte Pas Cher 你可以通过使用下面展示的 type 命令来列出所有的 shell 关键字:

    • $ type if then fi for while case esac else until
    • if is a shell keyword
    • then is a shell keyword
    • fi is a shell keyword
    • for is a shell keyword
    • while is a shell keyword
    • case is a shell keyword
    • esac is a shell keyword
    • else is a shell keyword
    • until is a shell keyword

    4. nike air max 2016 grijs Linux shell 函数 一个 shell 函数是一组在当前 shell 内一起执行的命令。 Asics Homme Air Jordan 6 函数有利于在 shell 脚本中实现特殊任务。 New Balance 373 femme Nike Air Max bw Homme nike tn rose femme Bart Starr Packers Jerseys 在 shell 脚本中写 shell 函数的传统形式是下面这样:

    • function_name() {
    • command1
    • command2
    • ......
    • }

    或者像这样:

    • function function_name {
    • command1
    • command2
    • ......
    • }

    让我们看一看如何在一个名为 shell_functions.sh 的脚本中写 shell 函数。 Nike Homme Air Jordan 11 (XI)

    • #!/bin/bash
    • #write a shell function to update and upgrade installed packages
    • upgrade_system(){
    • sudo apt update;
    • sudo apt dist-upgrade;
    • }
    • #execute function
    • upgrade_system

    取代通过命令行执行两条命令:sudo apt updatesudo apt dist-upgrade,我们在脚本内写了一个像执行一条单一命令一样来执行两条命令的 shell 函数 upgrade_system。 nike air max pas cher 保存文件,然后使脚本可执行。 Washington Wizards 最后像下面这样运行 shell 函数:

    • $ chmod +x shell_functions.sh
    • $ ./shell_functions.sh

    5. Nike Blazer High femme ADIDAS ZX 700 Linux Shell 内置命令 这些是在 shell 中内置的 Linux 命令,所以你无法在文件系统中找到它们。 Asics Gel Lyte 3 Femme Bleu ff14 gil for sale 这些命令包括pwdcdbgaliashistorytypesourcereadexit 等。 asics kayano 24 femme 你可以通过下面展示的 type 命令来列出或检查 Linux 内置命令:

    • $ type pwd
    • pwd is a shell builtin
    • $ type cd
    • cd is a shell builtin
    • $ type bg
    • bg is a shell builtin
    • $ type alias
    • alias is a shell builtin
    • $ type history
    • history is a shell builtin

    结论 作为一个 Linux 用户,知道你所运行的命令类型是很重要的。 adidas yeezy boost 350 v2 homme 我相信,通过上面明确、简单并且易于理解的解释,包括一些相关的说明,你可能对 “Linux 命令的不同种类[5]”有了很好的理解。 New Balance 998 femme Air Jordan 4 Cement 你也可以在下面的评论区提任何问题或补充意见,从而和我们取得联系。

    Posted in Linux | Leave a comment