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

                                           目录

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





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大写;

linux 各命令字 练习的更多相关文章

  1. Linux 驱动开发

    linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...

  2. Linux 视频设备驱动V4L2最常用的控制命令

    http://blog.csdn.net/shaolyh/article/details/6583226 Linux 视频设备驱动V4L2最常用的控制命令使用说明(1.02) 命令 功能 VIDIOC ...

  3. (十)Linux 网络编程之ioctl函数

    1.介绍 Linux网络程序与内核交互的方法是通过ioctl来实现的,ioctl与网络协议栈进行交互,可得到网络接口的信息,网卡设备的映射属性和配置网络接口.并且还能够查看,修改,删除ARP高速缓存的 ...

  4. Intel 80x86 Linux Kernel Interrupt(中断)、Interrupt Priority、Interrupt nesting、Prohibit Things Whthin CPU In The Interrupt Off State

    目录 . 引言 . Linux 中断的概念 . 中断处理流程 . Linux 中断相关的源代码分析 . Linux 硬件中断 . Linux 软中断 . 中断优先级 . CPU在关中断状态下编程要注意 ...

  5. Linux网络编程实例解析

    **************************************************************************************************** ...

  6. ethtool 在 Linux 中的实现框架和应用

    转载:http://www.ibm.com/developerworks/cn/linux/1304_wangjy_ethtools/index.html?ca=dat- 王 俊元, 软件工程师, I ...

  7. linux云计算集群架构学习笔记:rhel7基本命令操作

     1-3-RHEL7基本命令操作 1.1Linux终端介绍 Shell提示符 Bash Shell基本语法. 1.2基本命令的使用:ls.pwd.cd. 1.3查看系统和BIOS硬件时间. 1.4 L ...

  8. linux 常用命令 集锦

    第一章  LINUX简介及安装    1一.LINUX介绍    1二.LINUX安装    2三.LINUX目录    2四.总结来说:    3第二章 常用命令及帐户管理    4一.linux命 ...

  9. Linux之V4L2视频采集编程详解

     V4L2(Video For Linux Two) 是内核提供给应用程序访问音.视频驱动的统一接口. Linux系统中,视频设备被当作一个设备文件来看待,设备文件存放在 /dev目录下,完整路径的设 ...

随机推荐

  1. 设计模式 | 适配器模式(adapter)

    定义: 将一个类的接口转换成客户希望的另外一个接口.Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作.   书中说到Gof的设计模式中,讲了两种类型的适配器模式: 1.类适配 ...

  2. 普通平衡树代码。。。Treap

    应一些人之邀...发一篇代码 #include <iostream> #include <cstdio> #include <cstdlib> #include & ...

  3. CSS发布时间

    * 1996年W3C正式推出了CSS1.* 1998年W3C正式推出了CSS2.* CSS2.1是W3C现在正在推荐使用的.* CSS3现在还处于开发中.

  4. Combox两级联动会经常出现的错误

    例如: 当我们遇到这种情况:(下拉框的隐藏值和显示值皆为实体类进行绑定值时)下拉框的隐藏值并不能成功获取到. 我们就可以使用下面 的方案来解决 ok ,成功获取到隐藏值. 还有一个,附加解决方案:

  5. 跨平台键鼠共享软件synergy使用

    如果共享的机子都是win系统的话,也可以使用 无界鼠标. 这里主要讲跨平台通用的synergy.下载地址:http://synergy-project.org/ 注意1:最好下载同一位数,同一版本的. ...

  6. eclipse整合maven下载jar包速度慢问题解决

    引用:http://blog.csdn.net/u010154380/article/details/70339538 开发过程中在pom.xml中添加pom的时候,默认是需要从中央仓库中下载,但是下 ...

  7. 3--Java NIO基础1

    一.NIO概述 1. BIO带来的挑战 BIO即堵塞式I/O,数据在写入或读取时都有可能堵塞,一旦有堵塞,线程将失去CPU的使用权,性能较差. 2. NIO工作机制 Java NIO由Channel. ...

  8. SQl基本操作——视图

    视图适合频繁查询的表:将一个查询结果作为虚拟表提供给开发人员.安全性高,视图只能查询不能修改,它是一张虚拟表.查询方便,逻辑清晰,但是性能低,一般情况下不如自己写sql语句. --创建视图 creat ...

  9. sql 分析 依赖beanutils

    你还在为sql语句的拼接而烦恼吗? sql语句支持表达式了! package com.newland.bi.webservice.common.manage; import java.util.Arr ...

  10. MyBatis入门2_增删改查+数据库字段和实体字段不一致情况

    本文为博主辛苦总结,希望自己以后返回来看的时候理解更深刻,也希望可以起到帮助初学者的作用. 转载请注明 出自 : luogg的博客园 谢谢配合! 当数据库字段和实体bean中属性不一致时 之前数据库P ...