Finding Flashcards
What is the command to get detailed statistics on a file/directory?
stat
What is the command to search the current directory for a file/directory?
find >/path< -name >’name’<
i. e find -name ‘file1’
i. e find ./ -name ‘file2’
What denotes the pseudo file system when doing a block listing?
devtmpfs and tmpfs mount points
*file system only exists in RAM when operating
How do you search for a file/directory ignoring case sensitivity?
find {/path} -iname {name}
How do you search for everything excluding a specified file/directory?
find -not -name {name}
How do you locate all character devices on the system?
find / -type c
How do you locate all link files on the system?
find / -type l
How do you locate all block devices on the system?
find / type b
How do you locate files larger than a designated size?
find >/path< -size n
i. e find -size +1G *greater than gigabytes
i. e find -size 1470c *equal to bytes
i. e find -size -14k *less than kilobytes
How do you find files denoted by timestamp modification date?
find {/path} -mtime {n}
i. e find -mtime -3 *modified less than 3 days
i. e find -mtime 1+ *modified over a day ago
i. e find -mtime 2 *modified 2 days ago
How do you find files owned by a specific user?
find -user {user}
i.e find / -user user1
How do you find files denoted by permission?
find -perm >octal notation<
i.e find -perm 755
How do you find a file and perform and subsequent action?
find path -name name -exec command {} \;
i. e find -name file1 -exec chmod 755 {} \;
i. e find -name file1 -exec cp {} /home/user \;
* {} is a placeholder, gets replaced by internal file handles, \; ends the command