Mathematical method of thinking-the basic technology of Distributed Computing-linux/unix (3)

Source: Internet
Author: User

Clip:

~ Represents the current user's home folder

. It represents the current folder

.. It represents the parent folder

Link file

Using a different file name refers to the same data or program. Hard Links

In the same physical file system, create a hard link

-bash-4.2$ Find ~-name "*.py" >mypylist


Ls-la indicates that all files under the current folder, including hidden files, are viewed in a long format, with the following meanings for each field:

Each of the 7 segments is:
  1. File properties: Drwxr-xr-x
  2. Number of file hard links or folder folders: 3 (the field for an empty folder is 2.) Indicates that there are two subfolders under the folder. Because each folder has a subfolder that points to itself "." and a subfolder that points to its parent folder "..." )
  3. All Users: User
  4. Owning user group: group
  5. File size: 102 byte
  6. Modification Time: Mar11 22:56
  7. File name: filename

-bash-4.2$ Ls-la
Total dosage 151228
DRWX------. 6 MYHASPL myhaspl 4096 September 18 08:55.
Drwxr-xr-x. 3 root root 20 September 10 08:23..
-RW-------. 1 myhaspl myhaspl 1915 September 18:05 bash_history
Drwxr-xr-x. 9 MYHASPL myhaspl 4096 June 14:38 hadoop-2.4.1
-rw-r--r--. 1 myhaspl myhaspl 15417097 June 14:42 hadoop-2.4.1-src.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 138656756 June 14:42 hadoop-2.4.1.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 1454 September 10:53 mydoclist
-rw-rw-r--. 1 MYHASPL MYHASPL 88 September 17:25 MyList
-rw-rw-r--. 1 myhaspl myhaspl 357304 September 08:55 mypylist
-rw-rw-r--. 1 myhaspl myhaspl 31954 September 18:02 Myse
Drwxr-xr-x. 8 MYHASPL myhaspl 4096 September 10:39 numpy
DRWXR-----. 3 MYHASPL myhaspl 18 September 16:21. PKI
Drwxrwxr-x. Root root 4096 September 16:25 pypy-2.3.1-src
-rw-rw-r--. 1 myhaspl myhaspl 357304 September 17:57 SE
-bash-4.2$ LN mypylist mypylist1
-bash-4.2$ Ls-la
Total dosage 151580
DRWX------. 6 MYHASPL myhaspl 4096 September 18 08:56.
Drwxr-xr-x. 3 root root 20 September 10 08:23..
-RW-------. 1 myhaspl myhaspl 1915 September 18:05 bash_history
Drwxr-xr-x. 9 MYHASPL myhaspl 4096 June 14:38 hadoop-2.4.1
-rw-r--r--. 1 myhaspl myhaspl 15417097 June 14:42 hadoop-2.4.1-src.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 138656756 June 14:42 hadoop-2.4.1.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 1454 September 10:53 mydoclist
-rw-rw-r--. 1 MYHASPL MYHASPL 88 September 17:25 MyList
-rw-rw-r--. 2 myhaspl myhaspl 357304 September 08:55 mypylist
-rw-rw-r--. 2 myhaspl myhaspl 357304 September 08:55 mypylist1
-rw-rw-r--. 1 myhaspl myhaspl 31954 September 18:02 Myse
Drwxr-xr-x. 8 MYHASPL myhaspl 4096 September 10:39 numpy
DRWXR-----. 3 MYHASPL myhaspl 18 September 16:21. PKI
Drwxrwxr-x. Root root 4096 September 16:25 pypy-2.3.1-src
-rw-rw-r--. 1 myhaspl myhaspl 357304 September 17:57 SE
-bash-4.2$ LN mypylist mypylist2
-bash-4.2$ Ls-la
Total dosage 151932
DRWX------. 6 MYHASPL myhaspl 4096 September 18 09:27.
Drwxr-xr-x. 3 root root 20 September 10 08:23..
-RW-------. 1 myhaspl myhaspl 1915 September 18:05 bash_history
Drwxr-xr-x. 9 MYHASPL myhaspl 4096 June 14:38 hadoop-2.4.1
-rw-r--r--. 1 myhaspl myhaspl 15417097 June 14:42 hadoop-2.4.1-src.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 138656756 June 14:42 hadoop-2.4.1.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 1454 September 10:53 mydoclist
-rw-rw-r--. 1 MYHASPL MYHASPL 88 September 17:25 MyList
-rw-rw-r--. 3 MYHASPL myhaspl 357304 September 08:55 mypylist
-rw-rw-r--. 3 MYHASPL myhaspl 357304 September 08:55 mypylist1
-rw-rw-r--. 3 MYHASPL myhaspl 357304 September 08:55 mypylist2
-rw-rw-r--. 1 myhaspl myhaspl 31954 September 18:02 Myse
Drwxr-xr-x. 8 MYHASPL myhaspl 4096 September 10:39 numpy
DRWXR-----. 3 MYHASPL myhaspl 18 September 16:21. PKI
Drwxrwxr-x. Root root 4096 September 16:25 pypy-2.3.1-src
-rw-rw-r--. 1 myhaspl myhaspl 357304 September 17:57 SE

You can see the number of hard links in Mypylist added

the whole content of this blog is original. If reproduced please indicate the sourcehttp://blog.csdn.net/myhaspl/

Create soft links that can span different physical file systems, also known as Symbolic link files. Unlike hard links, it is a separate file. The path name that holds the destination file.

-bash-4.2$ ln-s mypylist mypylists
-bash-4.2$ Ls-la
Total dosage 151932
DRWX------. 6 MYHASPL myhaspl 4096 September 18 09:35.
Drwxr-xr-x. 3 root root 20 September 10 08:23..
-RW-------. 1 myhaspl myhaspl 1915 September 18:05 bash_history
Drwxr-xr-x. 9 MYHASPL myhaspl 4096 June 14:38 hadoop-2.4.1
-rw-r--r--. 1 myhaspl myhaspl 15417097 June 14:42 hadoop-2.4.1-src.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 138656756 June 14:42 hadoop-2.4.1.tar.gz
-rw-r--r--. 1 myhaspl myhaspl 1454 September 10:53 mydoclist
-rw-rw-r--. 1 MYHASPL MYHASPL 88 September 17:25 MyList
-rw-rw-r--. 3 MYHASPL myhaspl 357304 September 08:55 mypylist
-rw-rw-r--. 3 MYHASPL myhaspl 357304 September 08:55 mypylist1
-rw-rw-r--. 3 MYHASPL myhaspl 357304 September 08:55 mypylist2
lrwxrwxrwx. 1 MYHASPL myhaspl 8 September 09:35 mypylists-mypylist



I/O redirection, the file Description descriptor for standard input (stdin) is 0. Standard output (STDOUT) has a file descriptive descriptor of 1, and a standard error output (stderr) with a file descriptor of 2

Standard output redirection: 1>filename or 1>>filename

-bash-4.2$ echo "AAA" 1> ABC
-bash-4.2$ Cat ABC
Aaa

-bash-4.2$ echo "AAA" 1>> ABC
-bash-4.2$ Cat ABC
Aaa
Aaa
-bash-4.2$

Standard error Output redirect: 2>filename or 2>>filename

-bash-4.2$ rm/root/* 2>error.log

-bash-4.2$ Cat Error.log
RM: Unable to delete "/root/*": Insufficient permissions
-bash-4.2$

The i>&j indicates that the output file represented by the file description descriptor I is redirected to the file described by the file descriptor J.


For general files:

r = Agree to read the contents of the file

w = Agree to change the contents of the file

x = consent to run the file

For folders:

r = agree to list files and subfolders under this folder

w = consent to generate and delete files under this folder

x = consent to access the folder

U on behalf of all (user) G on behalf of all the groups (group) O on behalf of others. But not u and G (other) a represent the whole person. which includes U,g and O.

chmod ability to change permissions

chmod [User Type] (+/-) access to the format file or folder name

Example:

chmod a+w MyText

Set the mytext to all people writable.


-bash-4.2$ echo "Ls;echo \" Ok\ "" >myrun
-bash-4.2$ Cat Myrun
Ls;echo "OK"
-bash-4.2$ chmod +x./myrun
-bash-4.2$./myrun
ABC hadoop-2.4.1 mydoclist mypylist1 myrun pypy-2.3.1-src
Abd hadoop-2.4.1-src.tar.gz mylist mypylist2 myse SE
Error.log hadoop-2.4.1.tar.gz mypylist mypylists numpy

Ok

Pagination Display file

-bash-4.2$ more Mypylist
/home/myhaspl/pypy-2.3.1-src/pytest.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/graphparse.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/__init__.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/graphclient.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/msgstruct.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/graphpage.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/graphserver.py
/home/myhaspl/pypy-2.3.1-src/dotviewer/dotviewer.py

.............

............

Copy files

-bash-4.2$ CP mypylist MYL1

Move files (You can also change the file name)

-bash-4.2$ MV Myl1 MYL2

Renamed

-bash-4.2$ ls
ABC hadoop-2.4.1 mydoclist mypylist mypylists numpy
Abd hadoop-2.4.1-src.tar.gz myl2 Mypylist1 myrun pypy-2.3.1-src
Error.log hadoop-2.4.1.tar.gz mylist mypylist2 myse SE
-bash-4.2$ Rename list lst *pylist*
-bash-4.2$ ls
ABC hadoop-2.4.1 mydoclist mypylst mypylsts numpy
Abd hadoop-2.4.1-src.tar.gz myl2 Mypylst1 myrun pypy-2.3.1-src
Error.log hadoop-2.4.1.tar.gz mylist mypylst2 myse SE
-bash-4.2$

Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.

Mathematical method of thinking-the basic technology of Distributed Computing-linux/unix (3)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.