2014年3月19日星期三

Linux Commands for Beginners lesson3 -- introduce mv,cp,cat commands

1.command:cat
  DESCRIPTION
       concatenate files and print on the standard output
  SYNOPSIS
       cat [OPTION]... [FILE]...
  Option:
   -n, --number: number all output lines
             
Example:
piniheaven@fish:~/Documents/test$ ls
essay
piniheaven@fish:~/Documents/test$ cat essay  #print essay 's content on the standard output
Hello.
Fine,thanks!
piniheaven@fish:~/Documents/test$ 
cat -n essay #print essay's content on the standard output and number all output lines
     1Hello.
     2Fine,thanks!




2.command:mv
  mv - move (rename) files


  SYNOPSIS:
     mv [OPTION]... SOURCE... DIRECTORY
  DESCRIPTION:
       Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.


Example:
piniheaven@fish:~/Documents/test$ ls
essay
piniheaven@fish:~/Documents/test$ mvessay essay.txt      #rename essay as essay.txt
piniheaven@fish:~/Documents/test$ ls
essay.txt
piniheaven@fish:~/Documents/test$ mv essay.txt ../    #move essay.txt to previous directory
piniheaven@fish:~/Documents/test$ ls
piniheaven@fish:~/Documents/test$ cd ..
piniheaven@fish:~/Documents$ ls
assemble  C++primer_ex  C++primer_note  Ebook  essay.txt  linux  QT_ex  QT_note  test




3.command:cp
     cp - copy files and directories


  SYNOPSIS:
     cp [OPTION]... SOURCE... DIRECTORY
     
  DESCRIPTION:
       Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.


Example:
piniheaven@fish:~/Documents$ ls test/
piniheaven@fish:~/Documents$ cp essay.txt test/  #copy essay.txt to test directory
piniheaven@fish:~/Documents$ ls test/
essay.txt

没有评论:

发表评论