The linux command line--part one(一) Learing Shell

Part One Learing Shell

   1.what is shell?

     GNU/Linux are different things. Linux is the kernel.

     [username@machinename directory] $ (a dollar sign)   # means superuser privileges

     command history ↑ remember the last 1000 by default

     the shell is all about keyboard.

     some command: df, cal, free,date.

   2.Navigation

     pwd - Print name of current working directory

     cd   -  Change directory  . the working directory by default   .. the working directory's parent directory

             some shoutcuts : cd

                                         cd -    changes the working directory to the precious working directory

                                         cd ~username                                          

     ls    -  List directory contents

          ls -a list all the files including hidden files.

          files name are case sensitive

          linux has no concept of "file extension", but many application programs do.

          do not use embedded spaces ,you can use dash underscore instead.

    3.Exploring the system

         ls 

             ls ~/source

             ls -l

             ls -lt   t order by files' modification time

             ls -lt   --reverse

            

         file - Determine file  type

              file filename  ---print a brief description of the file's content

              everything is a file

         less - View file contents

               text

               some of the programs that the system uses(called scripts)

               less filename  ---view the file

         

             less is more.

         In linux,there is no secrets.

     Symbolic Links

       lrwxrwxrwx 1 root root 11 2007-08-11 07:34 libc.so.6 -> libc-2.6.so

       l 

      hard links

4.Manipulating Files And Directories

  cp - Copy files and directories

      cp item1 item2          copy the single file or directory item1 to file or directory item2

      cp item... directory    copy multiple items(either files or directories) into a directory

     



  mv - Move/rename files and directories(剪切)

      mv item1 item2        to move or rename file or directory "item1" to "item2"

      mv item... directory    to move one or more items from one directory to another

  mkdir - create directories

     mk directoryname

     mk dir1 dir2 dir3      create three directories name dir1,dir2,dir3

  rm - remove directories 

     be careful with rm

  ln - create hard and symbolic links

     ln file link   to create a hand link

     ln -s item link   to create a symbolic link where "item" is either a file or a directory

    hard link and symbolic link

Wildcard  is powerful!


5.Working With Commands

   type - Indicate how a command name is interpreted

      type type

      type ls

      type cp

   which - Display which executable program will be executed

      which ls

      which cd

   help - Get help for shell builtins

     help cd

     mkdir --help

   man - Display a command's manual page

     man ls

     man 5 passwd

   apropos - Display a list of appropriate commands

     apropos l

   info - Display a command's info entry

   whatis - Display a very brief description of a command

     whatis ls

   alias - Create an alias for a command

       line trick         command1; command2;command3

       alias foo='cd /usr; ls; cd - '         

       type foo

       unalias foo

       type foo

       alias ls

       alias           --list all the alias


  

   


             


       

     

  


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值