Linux基础命令 2017-07-12日课

bc, lscpu, free, dd, rpm, lsblk, ldd, file, hexdump, uname, sha1sum, sha256sum, md5sum
  1. bc
    an arbitrary precision language

    • scale=NUM ; precision
    • quit
  2. lscpu
    display information about the CPU

    [root@localhost ~]# lscpu
    Architecture:          x86_64
    CPU op-mode(s): 32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 Vendor ID:             GenuineIntel
    CPU family: 6 Model: 58 Model name:            Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Stepping: 9 CPU MHz: 2493.655 BogoMIPS: 4988.79 Hypervisor vendor:     VMware
    Virtualization type:   full
    L1d cache: 32K
    L1i cache: 32K
    L2 cache: 256K
    L3 cache: 3072K
    NUMA node0 CPU(s): 0
  3. free
    Display the amount of the memory

    [root@localhost ~]# free total        used free shared  buff/cache   available
    Mem: 999936 567492 108228 5096 324216 217416 Swap: 2097148 19584 2077564
  4. dd
    convert and copy file
    Syntax: dd if=SourceDir of=DestinationDir [Operands]

    • Operands

      • bs=BYTERS Read and Write bytes at a time
      • ibs=BYTERS Read bytes at a time
      • obs=BYTERS Write bytes at a time
      • count=NUM

        [root@localhost ~]# dd if=/dev/zero of=1.txt obs=512 count=1000 1000+0 records in 1000+0 records out 512000 bytes (512 kB) copied, 0.00366222 s, 140 MB/s
  5. RAM/ROM
    RAM : Random Access Memory
    ROM: Read Only Memory
  6. rpm
    rpm {-q|–query} {select-options}

    • select-options

      • -i/–info Display package information

        [root@localhost ~]# rpm -qi kernel Name        : kernel
        Version     : 3.10.0 Release     : 514.el7
        Architecture: x86_64
        Install Date: Tue 11 Jul 2017 01:36:08 AM PDT
        Group       : System Environment/Kernel
        Size        : 154799976 License     : GPLv2
        Signature   : RSA/SHA256, Tue 22 Nov 2016 06:19:35 PM PST, Key ID 24c6a8a7f4a80eb5
        Source RPM  : kernel-3.10.0-514.el7.src.rpm
        Build Date  : Tue 22 Nov 2016 09:33:33 AM PST
        Build Host  : kbuilder.dev.centos.org
        Relocations : (not relocatable)
        Packager    : CentOS BuildSystem <http://bugs.centos.org> Vendor      : CentOS
        URL         : http://www.kernel.org/ Summary     : The Linux kernel
        Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
        Linux operating system.  The kernel handles the basic functions
        of the operating system: memory allocation, process allocation, device
        input and output, etc.
  7. lsblk

    [root@localhost ~]# lsblk NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 20G 0 disk 
    ├─sda1 8:1 0 300M 0 part /boot
    ├─sda2 8:2 0 2G 0 part [SWAP]
    └─sda3 8:3 0 17.7G 0 part /
    sr0 11:0 1 1024M 0 rom
  8. ldd
    print shared library dependences

    [root@localhost ~]# clear [root@localhost ~]# ldd /bin/cat linux-vdso.so.1 =>  (0x00007ffd09bbe000)
     libc.so.6 => /lib64/libc.so.6 (0x00007f4d2ecb2000)
     /lib64/ld-linux-x86-64.so.2 (0x00007f4d2f087000)
    [root@localhost ~]# ldd /bin/ls linux-vdso.so.1 =>  (0x00007fff6e73d000)
     libselinux.so.1 => /lib64/libselinux.so.1 (0x00007ffac5601000)
     libcap.so.2 => /lib64/libcap.so.2 (0x00007ffac53fc000)
     libacl.so.1 => /lib64/libacl.so.1 (0x00007ffac51f2000)
     libc.so.6 => /lib64/libc.so.6 (0x00007ffac4e31000)
     libpcre.so.1 => /lib64/libpcre.so.1 (0x00007ffac4bd0000)
     libdl.so.2 => /lib64/libdl.so.2 (0x00007ffac49cb000)
     /lib64/ld-linux-x86-64.so.2 (0x00007ffac583c000)
     libattr.so.1 => /lib64/libattr.so.1 (0x00007ffac47c6000)
     libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffac45aa000)
  9. file
    determine the file type

    [root@localhost ~]# file /etc/passwd
    /etc/passwd: ASCII text [root@localhost ~]# file /bin/cat
    /bin/cat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=fac04659ab9a437b5384c09f4731023373821a39, stripped [root@localhost ~]# file notepad.exe 
    notepad.exe: MS-DOS executable
  10. hexdump 读取16进制文件

    [root@localhost ~]# hexdump -C notepad.exe | head -n 10 00000000 4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00 |MZ..............| 00000010 b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 |........@.......| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 e8 00 00 00 |................| 00000040 0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68 |........!..L.!Th| 00000050 69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f |is program canno| 00000060 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20 |t be run in DOS | 00000070 6d 6f 64 65 2e 0d 0a 24 00 00 00 00 00 00 00 83 |mode...$........| 00000080 c2 32 29 c7 a3 5c 7a c7  a3 5c 7a c7 a3 5c 7a ce  |.2)..\z..\z..\z.| 00000090 db d8 7a c6 a3 5c 7a ce  db c9 7a c5 a3 5c 7a ce  |..z..\z...z..\z.|
  11. uname [options]

    • -a all
    • -r release
    • -k kernel name

      [root@zb01 ~]# uname -s Linux
      [root@zb01 ~]# uname -r 2.6.32-696.el6.x86_64
      [root@zb01 ~]# uname -a Linux zb01 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21 19:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  12. 使用sha1sum, sha256sum 或 md5sum校验CentOS-6.9-x86_64-bin-DVD1.iso光盘是否完整,若校验码与以下相同则说明光盘完整。
    以下为从http://mirrors.163.com/centos/6.9/isos/x86_64t读取的校验码

    • sha1
      09c68654986feee54dcc6cad72771b7fe4be9703 CentOS-6.9-x86_64-bin-DVD1.iso
    • sha256
      d27cf37a40509c17ad70f37bc743f038c1feba00476fe6b69682aa424c399ea6 CentOS-6.9-x86_64-bin-DVD1.iso
    • md5sum
      2e227fa14c8a9791293b6525289c7dad CentOS-6.9-x86_64-bin-DVD1.iso

      [root@zb01 ~]# sha1sum /dev/sr0 09c68654986feee54dcc6cad72771b7fe4be9703  /dev/sr0 [root@zb01 ~]# md5sum /dev/sr0 2e227fa14c8a9791293b6525289c7dad  /dev/sr0 [root@zb01 ~]# sha256sum /dev/sr0 d27cf37a40509c17ad70f37bc743f038c1feba00476fe6b69682aa424c399ea6  /dev/sr0

原创文章,作者:zhuenbiao,如若转载,请注明出处:http://www.178linux.com/80171

(0)
zhuenbiaozhuenbiao
上一篇 2017-07-12
下一篇 2017-07-13

相关推荐

  • mysql配置详解-备份-主从-MHA

    目录: 1.备份和恢复 2.主从复制 3.主主复制 4.半同步复制 5.proxysql_读写分离 6.MHA 1.备份和恢复 ·mysqldump 备份: mysqldump -E -R –triggers –master-data=2 –flush-logs –single-transaction –dat…

    Linux干货 2017-08-08
  • TCP和ARP

    TCP是一个工作在传输层,面向连接的协议,一台计算机与另一台计算机通信就需要TCP协议,当然还有一个和它并列的一个协议可以使用,只是TCP更加稳定且常用. 上图为一台计算机与另一台计算机建立通讯的过程,它实际通信中传递的不止斜线上的信息.上面的SYN是同步号, ACK为确认号.seq为序列号,ack为辅助的确认号 上面为建立通信时发送的TCP信息详细结构,i…

    Linux干货 2017-11-29
  • 运维成长记

     在学校里学到的是知识,而企业更看重的是技能和能力。我们需要把知识先转化为技能,然后实践中通过总结提升,转变为自己的能力。这个过程或许会很漫长,但是时间会证明一切。成长的过程注定是痛苦的,欲戴王冠,必承其重!我们有理由相信:运气也是实力的一部分! 第一次接触linux还是在大学的课堂上,看着老师在物理机上用VM虚拟出一台Ubuntu的时候,真实感觉…

    Linux干货 2017-07-11
  • 【Linux基础】文件管理类命令

    总结下linux系统文件管理类的命令 mkdir -> make dirtctories 创建目录 语法:mkdir [OPTION]… DIRECTORY… 常用选项-p: 自动按需创建父目录;-v: verbose,显示详细过程;-m MODE:直接给定权限;注意:路径基名方为命令的作用对象;基名之前的路径必须得存在;示例:~]# mkdir -p…

    Linux干货 2018-03-11
  • linux网络管理

    什么是计算机网络     计算机网络是指将不同地理位置上,具有独立功能的计算机和网络设备通过通信链路连接起来,通过操作系统,网络管理软件,和网络通信协议的共同组合下的计算机系统团体,实现资源共享,信息传递的网络。计算机网络的组成部分有各种微小大型计算机,网桥,交换机,路由器,传输介质等网络设备,相应的软件系统,相应的通…

    Linux干货 2016-09-05
  • N22-第四周作业

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。      2、编辑/etc/group文件,添加组hadoop。 3、手动编辑/etc/passwd文件新增一行,添加用户hadoop,其基本组ID为hadoop组的id号;其家目录为…

    Linux干货 2016-09-05

评论列表(1条)

  • eedsxb
    eedsxb 2017-07-13 17:51

    辛苦了、、。