File Directives

ls view the current file or directory in the directory

 

    - a show hidden files or directories

  -l long format displays detailed information about a file or directory

ls -d / etc to see only the specified directory / etc information is not displayed / etc directory information below

 kb -h to display the file size, the default is byte display file size

 

Create a directory mkdir

  -p recursively create, you can create a directory in the directory is not the

rmdir to delete empty directories

rm -rf [file or directory

  -r delete a directory

  -f Forces deletion

cp copy and paste the file or directory

 cp 1.txt / tmp # 1.txt file copy paste to the / tmp directory

 cp -r / etc / tmp -r used to copy a directory, the directory / etc copied to the in / tmp

 cp -p 1.txt / tmp to retain the original file attributes

 

mv cut, renamed

 1.txt Music Videos / tmp to cut the file 1.txt / tmp catalog

 mv 1.txt 1.log file 1.txt renamed 1.log

 

Create a file touch

  touch 1.log 1.log created by default in the current directory

  touch /emp/1.log create 1.log in the emp table of contents

  touch 1.log 2.log creates two files in the current directory

  touch "1.log 2.log" created a 1.log 2.log file with spaces in the current directory

cat [file name] to view the file contents

  -n Display line numbers

more [filename] page display file contents can not flip up

  Press Eenter line by line translation

  Press the space bar to turn page by page

  Press q to exit

 

less [filename] page display file contents can flip up  

Press Eenter line by line translation

  Press the space bar to turn page by page

  Press q to exit

  up (arrow) turned up

  At the bottom Press / search word can be highlighted search word

 

head [filename] displays the contents of the file header before the default 10-line display

  20 specified number of lines to display before -n20

  

[filename] tail end of the file to display the contents of the default display 10 end of the line

  Specifies the number of lines displayed -n20 tail 20

  tail -f dynamic display file contents (when the file changes you will also dynamic display)

 

ln command links

ln [path] [original file name] link to create a hard link

ln -s [path] [link to the original file name] Create a soft link

Soft connection:

lrwxrwxrwx> original file begins with l, permission is 777, it is a symbolic link, small memory, the arrow pointing to the original file

Hard Links:

Is equal to 1. Copy synchronization update cp -p +

 

2. Do not use for directory

 

 

 

 

 

 

 

 

 

 

  

 

 

 

 

 

 

 

 

 

  

 

 

 

 

  

 

Guess you like

Origin www.cnblogs.com/jingandyuer/p/11391261.html