Chinaunix首页 | 论坛 | 博客
  • 博客访问: 264486
  • 博文数量: 52
  • 博客积分: 406
  • 博客等级: 一等列兵
  • 技术积分: 549
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-21 12:34
个人简介

......

文章分类

全部博文(52)

文章存档

2014年(1)

2013年(32)

2012年(19)

我的朋友

分类: LINUX

2012-07-15 10:49:41

We must be familiar with of the following of linux command as a linuxer :

1. wc xx.xx, for example:

wc map_cp.c

1739 4119 49392 map_cp.c

notes: 1739(number of line) 4119(number of words)  49392(number of bytes)

2. readelf  Displays information about ELF files

3. cut  remove sections from each line of files ,for example(option -d -f):

   [liubb@Hudson-1 helloworld]$ readelf -a helloworld | grep "Entry"
                                Entry point address: 0x80482b0

   [liubb@Hudson-1 helloworld]$ readelf -a helloworld | grep "Entry" | cut -d ":" -f 2
                                 0x80482b0  

   notes: -d == --delimiter(分隔符)  -f == --fields

4.mkdir & touch 

  mkdir : create a directory you want in current directory if it is not exist, and report an            error(-p option : do nothing) if it is in here.

  touch : create a file you want in current directory if it is not exist.

5. stat  : display file or file system status

   [liubb@Hudson-1 ~]$ stat path.sh
     File: `path.sh'
     Size: 55 Blocks: 8 IO Block: 4096 regular file
     Device: fd00h/64768d Inode: 52103151 Links: 1
     Access: (0777/-rwxrwxrwx) Uid: ( 525/ liubb) Gid: ( 526/ liubb)
     Access: 2012-07-24 10:18:37.000000000 +0800
     Modify: 2012-04-06 09:22:49.000000000 +0800
     Change: 2012-04-06 09:22:49.000000000 +0800

6. ldd : print shared library dependencies

   [liubb@Hudson-1 bin]$ ldd ld
                         linux-gate.so.1 => (0x00da6000)
                         libbfd-2.17.50.0.6-2.el5.so => /usr/lib/libbfd-2.17.50.0.6-2.el5.so                                        (0x4d590000)
                         libc.so.6 => /lib/libc.so.6 (0x4d451000)
                         /lib/ld-linux.so.2 (0x4d434000)

7. nm : list symbols from object files

      00000000005008f8 A __bss_start
      000000000040043c t call_gmon_start  
      ......  
      00000000004004f0 T main  
      0000000000500658 d p.0  
      00000000004004e0 T print_hello  
      U puts@@GLIBC_2.2.5  
      0000000000400410 T _start   

8. strip : Discard symbols from object files

9. ln : Hard link, symbolic link  By default ln is Hard link

   [oracle@Linux]$ touch f1  
   [oracle@Linux]$ ln f1 f2  #hard link 
   [oracle@Linux]$ ln -s f1 f3  # symbolic link
   [oracle@Linux]$ ls -li       # -i show the info of inode
   total 0
   9797648 -rw-r--r-- 2 oracle oinstall 0 Apr 21 08:11 f1
   9797648 -rw-r--r-- 2 oracle oinstall 0 Apr 21 08:11 f2
   9797649 lrwxrwxrwx 1 oracle oinstall 2 Apr 21 08:11 f3 -> f1 

10. yum 

    yum list xxx*  : list various info about available packages 

    yum install xxx : install package you want 

11. svnadmain & svnserve(build svn server on linux platform) 

    mkdir /home/svn    :  create path

    svnadmain create /home/svn/repos    : create repository 

    svn import -m "new import" /home/liubbc/project(content)  file:///home/svn/repos(file rep

                oitory)     : import content ot svn file repository 

    svnserve -d -r /home/svn      : start svn repository 

    svn co svn://127.0.0.1/repos   : svn client accessing the svn repository 

12. switch user
     user to root
     su or su -          // ignore root character.   command of su  switch user to root  only , but shell environment is not changed .  Command of su -   changes both
                           // for example :   
                           // [liubbc@localhost ~]$ su
                                Password:
                               [root@localhost liubbc]# pwd
                                 /home/liubbc    


                           // [liubbc@localhost ~]$ su -
                                 Password:
                               [root@localhost ~]# pwd
                                 /root
                               [root@localhost ~]#

     root to user
     exit

13. df -h & du -h
      df -h      //show the usage room of all disk
      [liubbc@localhost ~]$ df -h
      Filesystem            Size  Used Avail Use% Mounted on
      /dev/mapper/VolGroup-lv_root
                       36G   11G   24G  31% /
      tmpfs                1007M  204K 1007M   1% /dev/shm
      /dev/sda1             194M   41M  143M  23% /boot

      du -h       //show room of all file in current path

      [liubbc@localhost test]$ ls
      fork_test  fork_test.c
      [liubbc@localhost test]$ du -ah
      12K    ./.fork_test.c.swp
      4.0K    ./fork_test.c
      8.0K    ./fork_test
      28K    .

14. od     dump files in octal and other formats

     exemple:
     
     [liubbc@localhost src]$ cat liubbc01
                                       123456
     [liubbc@localhost src]$ od -c liubbc01
           0000000   1   2   3   4   5   6  \n
           0000007

15. get environment variable
      export




 

    

    
 

   



阅读(2569) | 评论(0) | 转发(0) |
0

上一篇:linux hidden file

下一篇:const & pointer

给主人留下些什么吧!~~