

We can also find all empty directories in the system and in which ever folder you want. We can also find all empty files in the system and in which ever folder you want. We can find the files that have read-only options in current directories, as shown below. We can find the files that have not permissions as 777 and print them as well. We can find the files that have permissions as 777 and print them as well. We can find the directories using the option ‘name’ in the / directory. We can search for the files in the system by ignoring the case by using -iname.Įxample #4 – Finding directories using the name option.

We can search for files in the home directory using the option ‘name’ as shown below.Įxample #3 – Finding files ignoring case. We can search for files in the current directory using option ‘name’ as shown below.Įxample #2 – Finding files using the name option in the home directory. Let us consider there are few files under the test directory.īelow is the file name list that is listed under the current directory.Įxample #1 – Finding files using the name option in the current directory. It returns true if ‘expr’value is true.įind Command Syntax in Unix Shell Scripting is given below:įind Examples of Find Command in Unix This option is used for grouping criteria along with OR or AND. It is used to search the files that are owned by the ID of a user. Used to print the filenames that are given in the input criteria. Used to search the files with an inode number.Ĭhecks for the files based on creation or modification date.Ĭhecks the permission of file if it is octal or not. The tabular structure shows the option and its function: -inum N What can we do from Find Command?īelow are the options that are used in Unix with Find Command: It is also used in many conditions, which can help in finding files by their user names, permissions, groups, date, file type, and many available possibilities. True if file exists and has been modified since it was last read.The Find Command is the most frequent and useful command used for searching and locating the file list and directories based on the requirement specified for a file matching the argument passed as the input. True if file exists and is owned by the effective group id. True if file exists and is owned by the effective user id. True if file exists and its set-user-id bit is set. True if file descriptor fd is open and refers to a terminal.

True if file exists and has a size greater than zero. True if file exists and is a named pipe (FIFO). True if file exists and its “sticky” bit is set. True if file exists and is a symbolic link. True if file exists and is a regular file. True if file exists and is a character special file. True if file exists and is a block special file.

These are used by the [[ compound command and the test and [ builtin commands to test file attributes and perform string and arithmetic comparisons. You can use conditional expressions to find out file permissions. When set for a directory, this permission grants the ability to traverse its tree in order to access files or subdirectories, but not see files inside the directory (unless read is set). This permission must be set for executable binaries in order to allow the operating system to run them. => The execute permission (x), which grants the ability to execute a file. This includes creating files, deleting files, and renaming files. When set for a directory, this permission grants the ability to modify entries in the directory. => The write permission (w), which grants the ability to modify a file. When set for a directory, this permission grants the ability to read the names of files in the directory => The read permission (r), which grants the ability to read a file.
#FIND ANY FILE UNIX MAC OS#
There are three specific permissions on Unix-like (including Linux / Mac OS x) systems that apply to each user or class:
