linux _ file and directory permissions

1. Contents Related

The representative of the second layer directory

.. on behalf of parent directory

- on behalf of a former working directory

~ Where the identity of the current user's home directory

~ Account on behalf of the user account's home directory

Change directory cd (change directory)

pwd Displays the current working directory (print work directory)

Create a new directory mkdir (make directory) mkdir -p test1 / test2 / test3 / test4 (-p create recursive) mkdir -m 711 test1 (-m set permissions)

rmdir deletes an empty directory

2. Understand PATH, begin to understand all the contents of the file exists in the form of linux

  echo $ PATH PATH environment variable print output

  mv / bin / ls / root, removed from the bin directory as root move files ls

  ls can not see the ls command no such file or directory

  / Root / ls ./ls ​​can use these commands to perform the ls command after you move (the former is an absolute path, the latter is when your pwd is the relative path of / root)

  PATH = "$ {PATH}: / root" can also add the / root directory to your PATH environment variable, so that you can continue with the ls command

  echo $ PATH PATH environment variable print output at this time again, you can see will be more of a / root

  mv / root / ls / bin recovery operation is completed remember your ls file to the bin directory then if the error also can log off and log on again, this time because of the cached point parameters.

3. File Operations

cp -p also copy the file attributes (for backup) -r recursive copy

    Precautions: source file information source file is a symbolic link file is a directory for a particular file (FIFO)

rm -r recursive delete (WARNNING !!!) -i cross-examination to avoid deleting the wrong

Rename mv mv test test1 a movable rename

4. File Viewer

cat (concatenate series) (start from the first line of file contents) -n print line number less complex and more used (space page)

tac (display file contents by the last line is the cat against the written)

nl display contents, while the output line number

head and tail niche strategy

od read binary files (usually executable file)

It will give od zzh is shuiB output ASCⅡ code, echo the value of screen output to help deal with

touch create an empty file

5. File Permissions

The default file permissions umask subtracted directory 666 777

chattr -a configuration file hidden attribute of the file can only increase data -i the files can not be deleted is set to be renamed or new data is written to the link (helpful for the security of the system)

  touch attrtest chattr + i attrtest rm attrtest prompt can not remove chattr -i attrtest (ROOT operation) (i and adding attributes can not delete the root file)

  lsattr can view hidden attributes for log log can be set so that it can only increase -a old data can not be modified and deleted

Some special privileges: SUID SGID SBIT binary systems and process management related

file type observation file

6. Find

Find -a executable file which lists all the commands found in the PATH command instead of the first one found

  which ls  >>>/bin/ls    

  which which  >>>/usr/bin/which    

  which -a which  >>>/usr/bin/which /n /bin/which

whereis find files by the specific directory

locate records based on database, enter keywords to find the user's file name

find too hard to find too many parameters need to learn

7. small example

Guess you like

Origin www.cnblogs.com/zzhhzf/p/12049706.html