\" a. Let’s start with something easy, we will find all files that end with .txt
ID: 3749888 • Letter: #
Question
" a. Let’s start with something easy, we will find all files that end with .txt in your home directory (~). Issue the command find ~ -name “*.txt”. Recall that ~ (tilde) represents your home directory. Use the find command to locate all .txt files in the entire file system (starting at /). 21.) What command did you enter? 22.) You will receive some errors, why? The command find /sys –name core* will locate any files in /sys starting with the characters “core”. Use the command. 23.) How many are found? Now issue a find command to locate any file in /usr/sbin with the word “user” in its title (anywhere in the title). 24.) What command did you use? 25.) How many files did you find? "
Explanation / Answer
I tried these commands in my Centos 7 PC. Results of this questions may vary from one computer to another.
find command to locate all .txt files in the entire file system (starting at /) :
root@centospc# find / -name "*.txt" | wc -c
(I didn't receive any error, there were 21249 files found with the above command)
(I used "wc -c" to count the results found)
-------------------------------------------------------------------------------------------------
Used the command : find /sys –name core*
root@centospc# find /sys -name core* | wc -c
4902
so 4902 files are found using the command : find /sys –name core*
--------------------------------------------------------------------------------------------------------------
Now issue a find command to locate any file in /usr/sbin with the word “user” in its title:
tried 3 ways to find results
root@centospc# find /usr/sbin -name "user*" | wc -c
96 (means 96 files are found with this combination : "user*" )
root@centospc# find /usr/sbin -name "*user*" | wc -c
271 (means 271 files are found with this combination : "*user*" )
root@centospc# find /usr/sbin -name "*user" | wc -c
52 (means 52 files are found with this combination : "*user")
note : I logged in into my Centos 7 PC as root user, results may differ if you are logged in as another user.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.