===============================================================
                                           目录
===============================================================


1.  # ldd cfconv                               /////////查看程序使用的动态库
2.  # top                                      /////////相当于 windows下的任务管理器
3.  # objdump   cfconv                         /////////可以用来反汇编
4.  # uname -a                                 /////////查看系统信息
5.  # vmstat                                   /////////查看系统虚拟机各资源信息
6.  # file cfconv                              /////////查看文件格式
7.  # cat /etc/shells 
8.  Vim+xxd = 强大的十六进制编辑器--转,集
9.  cp命令
10. tar常见文件解压法
11. #du -sh dir                                 /////////查看文件夹文件总大小
12. #df -h                                      /////////查看磁盘使用情况
13. #od -c file                                 /////////以逐个字符输出文件内容







--------------------------------正文-----------------------------------------

[root@localhost helloqt]# ldd cfconv                                     ///////// 查看程序使用的动态库
        linux-gate.so.1 =>  (0x00826000)
        libqt-mt.so.3 => /usr/local/qt/lib/libqt-mt.so.3 (0x008c0000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00110000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00120000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00222000)
        libm.so.6 => /lib/libm.so.6 (0x0030d000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00336000)
        libc.so.6 => /lib/libc.so.6 (0x00342000)
        libGL.so.1 => /usr/lib/libGL.so.1 (0x03200000)
        libXmu.so.6 => /usr/lib/libXmu.so.6 (0x03c59000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00496000)
        libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x0049f000)
        libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x004a6000)
        libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x004b0000)
        libXft.so.2 => /usr/lib/libXft.so.2 (0x00835000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x004b3000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x0053d000)
        libSM.so.6 => /usr/lib/libSM.so.6 (0x0056c000)
        libICE.so.6 => /usr/lib/libICE.so.6 (0x00575000)
        libdl.so.2 => /lib/libdl.so.2 (0x0058f000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00594000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x005ac000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x005af000)
        /lib/ld-linux.so.2 (0x008a3000)
        libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x031f9000)
        libdrm.so.2 => /usr/lib/libdrm.so.2 (0x007df000)
        libXt.so.6 => /usr/lib/libXt.so.6 (0x0319f000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x005b5000)
        libexpat.so.0 => /lib/libexpat.so.0 (0x005ba000)




[root@localhost helloqt]# top                                     /////////相当于 windows下的任务管理器
top - 10:42:13 up  1:42,  1 user,  load average: 0.44, 0.36, 0.27
Tasks: 120 total,   2 running, 117 sleeping,   0 stopped,   1 zombie
Cpu(s):  1.3%us,  1.3%sy,  0.0%ni, 97.0%id,  0.0%wa,  0.3%hi,  0.0%si,  0.0%st
Mem:    515288k total,   502464k used,    12824k free,   106068k buffers
Swap:  2031608k total,        0k used,  2031608k free,   219604k cached


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                         
 3496 root      15   0  149m  12m 5648 S  1.7  2.5   0:30.77 Xorg                                                                                            
  244 root      15   0     0    0    0 S  0.3  0.0   0:00.55 pdflush                                                                                         
 2210 root      15   0 39784 4144 3336 S  0.3  0.8   0:07.97 vmtoolsd                                                                                        
 3340 root      18   0  3136  868  752 S  0.3  0.2   0:01.21 hald-addon-stor                                                                                 
 3874 root      15   0  119m  22m  12m R  0.3  4.4   0:03.77 gnome-terminal                                                                                  
    1 root      15   0  2140  632  544 S  0.0  0.1   0:01.77 init                                                                                            
    2 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0                                                                                     
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0                                                                                     
    4 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0                                                                                      
    5 root      10  -5     0    0    0 S  0.0  0.0   0:00.07 events/0                                                                                        
    6 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper        




[root@localhost helloqt]# objdump   cfconv                                    /////////可以用来反汇编
Usage: objdump <option(s)> <file(s)>
 Display information from object <file(s)>.
 At least one of the following switches must be given:
  -a, --archive-headers    Display archive header information
  -f, --file-headers       Display the contents of the overall file header
  -p, --private-headers    Display object format specific file header contents
  -h, --[section-]headers  Display the contents of the section headers
  -x, --all-headers        Display the contents of all headers
  -d, --disassemble        Display assembler contents of executable sections
  -D, --disassemble-all    Display assembler contents of all sections
  -S, --source             Intermix source code with disassembly
  -s, --full-contents      Display the full contents of all sections requested
  -g, --debugging          Display debug information in object file
  -e, --debugging-tags     Display debug information using ctags style
  -G, --stabs              Display (in raw form) any STABS info in the file
  -W, --dwarf              Display DWARF info in the file
  -t, --syms               Display the contents of the symbol table(s)
  -T, --dynamic-syms       Display the contents of the dynamic symbol table
  -r, --reloc              Display the relocation entries in the file
  -R, --dynamic-reloc      Display the dynamic relocation entries in the file
  @<file>                  Read options from <file>
  -v, --version            Display this program's version number
  -i, --info               List object formats and architectures supported
  -H, --help               Display this information




[root@localhost helloqt]# uname -a                                /////////查看系统信息
Linux localhost.localdomain 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:35:01 EDT 2007 i686 athlon i386 GNU/Linux
[root@localhost helloqt]# 
[root@localhost helloqt]# vmstat                                /////////查看系统虚拟机各资源信息
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0  10048 106412 208040    0    0    50    14   13  178  1  2 92  5  0




[root@localhost helloqt]# file cfconv                                /////////查看文件格式
cfconv: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped




[root@localhost helloqt]# cat /etc/shells 
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
[root@localhost helloqt]# 
[root@localhost helloqt]# /bin/sh
sh-3.2# 
sh-3.2# /bin/csh 
[root@localhost helloqt]# 
[root@localhost helloqt]# /bin/tcsh 
[root@localhost helloqt]# 
[root@localhost helloqt]# /bin/bash
[root@localhost helloqt]# 
[root@localhost helloqt]# echo $SHELL
/bin/bash






Vim+xxd=强大的十六进制编辑器--转,集


博客分类: Vim
 
 
|vim是黑客文化中强大的编辑器。利用它调用外部十六进制文件显示命令xxd就可以顺利的编辑二进制文件了。
其中,%在vimComandLine时代表当前文件的路径,xxd是以十六进制显示一个文件,xxd -r>是将十六进制还原为二进制。
下面举一个例子,备份我们的MBR。
sudo dd if=/dev/sda of=~/mbr.backup bs=512 count=1
题外话:其中含有分区表,这时我们可以利用这个命令恢复我们的MBr:
sudo dd if=~/mbr.backup of=/dev/sda bs=512 count=1
sudo dd if=~/mbr.backup of=/dev/sda bs=1 count=66 seek=446(恢复分区表)
好了,这个就是我们的MBR文件,是二进制的。


首先以二进制的方式打开它:
vim mbr.backup -b
再在vim 命令模式下输入:
:%!xxd #参数%指当前所编辑的文件 
此时MBR文件会以十六进制显示,现在就可以编辑它了。。
========================================================
 
 
0000090: be88 7de8 1c01 be05 7cf6 c280 7448 b441 ..}.....|...tH.A
00000a0: bbaa 55cd 135a 5272 3d81 fb55 aa75 3783 ..U..ZRr=..U.u7.
00000b0: e101 7432 31c0 8944 0440 8844 ff89 4402 ..t21..D.@.D..D.
00000c0: c704 1000 668b 1e5c 7c66 895c 0866 8b1e ....f..\|f.\.f..
00000d0: 607c 6689 5c0c c744 0600 70b4 42cd 1372 `|f.\..D..p.B..r
00000e0: 05bb 0070 eb76 b408 cd13 730d f6c2 800f ...p.v....s.....
00000f0: 84d0 00be 937d e982 0066 0fb6 c688 64ff .....}...f....d.
0000100: 4066 8944 040f b6d1 c1e2 0288 e888 f440 @f.D...........@
0000110: 8944 080f b6c2 c0e8 0266 8904 66a1 607c .D.......f..f.`|
0000120: 6609 c075 4e66 a15c 7c66 31d2 66f7 3488 f..uNf.\|f1.f.4.
0000130: d131 d266 f774 043b 4408 7d37 fec1 88c5 .1.f.t.;D.}7....
0000140: 30c0 c1e8 0208 c188 d05a 88c6 bb00 708e 0........Z....p.
0000150: c331 dbb8 0102 cd13 721e 8cc3 601e b900 .1......r...`...
0000160: 018e db31 f6bf 0080 8ec6 fcf3 a51f 61ff ...1..........a.
0000170: 265a 7cbe 8e7d eb03 be9d 7de8 3400 bea2 &Z|..}....}.4...
0000180: 7de8 2e00 cd18 ebfe 4752 5542 2000 4765 }.......GRUB .Ge
0000190: 6f6d 0048 6172 6420 4469 736b 0052 6561 om.Hard Disk.Rea
00001a0: 6400 2045 7272 6f72 0d0a 00bb 0100 b40e d. Error........
00001b0: cd10 ac3c 0075 f4c3 e3b9 76fb 0000 8001 ...<.u....v.....
00001c0: 0100 07fe ffff 3f00 0000 499d d801 00fe ......?...I.....
00001d0: ffff 0ffe ffff c59d d801 eb4c 6a23 0000 ...........Lj#..
00001e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa ..............U.


 
================================================================
编辑完了以后,我们需要还原为二进制文件:
:%!xxd -r #参数-r是指将当前的十六进制转换为二进制


好了,保存退出:
:wq

==========================================




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

                        2015年3月2日星期一      11:06:33

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

cp命令用来复制文件或者目录,是Linux系统中最常用的命令之一。一般情况下,shell会设置一个别名,在命令行下复制文件时,如果目标文件已经存在,就会询问是否覆盖,不管你是否使用-i参数。但是如果是在shell脚本中执行cp时,没有-i参数时不会询问是否覆盖。这说明命令行和shell脚本的执行方式有些不同。 
1.命令格式:
用法:
  cp [选项]... [-T] 源 目的
   或:cp [选项]... 源... 目录
   或:cp [选项]... -t 目录 源...


2.命令功能:
将源文件复制至目标文件,或将多个源文件复制至目标目录。
3.命令参数:

-a, --archive    等于-dR --preserve=all

    --backup[=CONTROL    为每个已存在的目标文件创建备份

-b                类似--backup 但不接受参数

   --copy-contents        在递归处理是复制特殊文件内容

-d                等于--no-dereference --preserve=links

-f, --force        如果目标文件无法打开则将其移除并重试(当 -n 选项

                    存在时则不需再选此项)

-i, --interactive        覆盖前询问(使前面的 -n 选项失效)

-H                跟随源文件中的命令行符号链接

-l, --link            链接文件而不复制

-L, --dereference   总是跟随符号链接

-n, --no-clobber   不要覆盖已存在的文件(使前面的 -i 选项失效)

-P, --no-dereference   不跟随源文件中的符号链接

-p                等于--preserve=模式,所有权,时间戳

    --preserve[=属性列表   保持指定的属性(默认:模式,所有权,时间戳),如果

               可能保持附加属性:环境、链接、xattr 等

-R, -r, --recursive  复制目录及目录内的所有项目



==========================================================================

tar常见文件解压法:
    .gz - z 小写;
    .bz2 - j 小写;
    .xz - J 大写; /// tar xvJf  ***.tar.xz
    .Z - Z大写;



posted on 2015-02-06 16:45  醉依危栏听松涛  阅读(387)  评论(0编辑  收藏  举报