Linux Shell Learning notes--file test characters

Source: Internet
Author: User
Tags bit set

1. File Test Actions----------------returns True if ...-e file exists-a file has the effect of this option with-e is the same. But it has been deprecated and does not encourage the use of-Ffileis a regular file (not a directory or device file)-s file length is not 0-d file is a directory-B file is a block device (floppy, CDROM, etc.)-c file is a character device (keyboard, modem, sound card, etc.)-p file is a pipe-h file is a symbolic link-L file is a symbolic link-S file is a socket-T file descriptor associated to an end device This option is typically used to detect whether a stdin[in a given script-T0] or [-T1] is a terminal-r file has Read permission (run this test for the user)-WThe file has Write permissions (run this test for the user)-x Files have Execute permissions (run this test for the user)-G set-group-ID(SGID) flag to a file or directory if a directory has a Sgid flag, then a file created in this directory belongs to the user group that created the directory, and not necessarily the same group as the user who created the file. For workgroup directory sharing, This is very useful. See<<unix Environment Advanced Programming Chinese version >>The 58th page.-U set-user-ID(SUID) flag to a file if you run a file that has root permissions, the running process will take root, even if you are a regular user. [1This is useful for performing operations that require access to system hardware, such as PPPD and Cdrecord. If there is no suid flag, then ordinary users (without root privileges) will not be able to run the program. See<<unix Environment Advanced Programming Chinese version >>The 58th page.-rwsr-xr-t1Root178236Oct2  -/usr/sbin/pppd for files that have the suid set, in its permission flags"s".-K set paste bit, see <<unix Environment Advanced Programming Chinese version >>The 65th page. For"Sticky bit", save-text-The mode flag is a special type of file permission. If this flag is set, then the file will be saved in the swap area for fast access. If set in a directory, it restricts write permissions. For files or directories that have the sticky bit set, the permission flags have "T". DRWXRWXRWT7Root1024x768May +  +: -tmp/If a user does not have the owner of a directory with the stick bit, but has write permissions, then the user can only delete files owned by that directory. This will prevent users from inadvertently overwriting or deleting files in a public directory, such as/tmp (of course, root or the owner of the directory can easily delete or rename the file).-O You are the owner of the file.-G file group-IDthe same as yours.-N is changed from the last time the file is read to the present. F1-NT F2 file F1 than F2 new F1-ot f2f1 than F2 old F1-EF F2F1 and F2 are hard-wired to the same file

Linux Shell Learning notes--file test characters

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.