GNU find Symlink Flashcards
Read-only symlink drills for GNU find on Linux. Choose -P, -H or -L, predict printed paths, and check links with -type, -xtype and -lname.
ಈ ಡೆಕ್ ಬಗ್ಗೆ
A symlink can lead GNU find into another directory. What path will it print? These 32 flashcards give Linux learners practice choosing how a search follows links and predicting what it finds. Every example uses read-only commands tested on GNU find.
Start by predicting what short commands print and choosing -P, -H or -L for a search. Then work out which entries pass -type, -xtype or -lname. Later cards combine those choices with dangling links, targets outside the starting directory and small command fixes. Each flag comes with a search goal or a concrete example so you practise deciding when to use it. Hard-link tests and link removal are outside the scope of these exercises.
The examples are based on the GNU Findutils manual. The cover is AI-generated. The original questions, answers, arrangement, description and illustration are available under CC0 1.0 to the extent rights apply.
ಈ ಡೆಕ್ನ ಕಾರ್ಡ್ಗಳು
ಕಾರ್ಡ್ 1
ಪ್ರಶ್ನೆ
In GNU
find,archiveis a symlink to the readable directoryrecords. What doesfind archive -printprint ifrecordscontainsindex.txt?ಉತ್ತರ
Only
archive. The default mode treats the starting point as a link entry, so the search ends there.ಕಾರ್ಡ್ 2
ಪ್ರಶ್ನೆ
readoutis a symlink to the regular filesamples.txt. What does GNUfind -L readout -printprint?ಉತ್ತರ
Only
readout. A regular-file target has no children to search.ಕಾರ್ಡ್ 3
ಪ್ರಶ್ನೆ
You want GNU
findto follow readable symlinks passed as starting points and treat symlinks found during the walk as link entries. Which mode fits?ಉತ್ತರ
-H. Its traversal follows links explicitly supplied as starting points.ಕಾರ್ಡ್ 4
ಪ್ರಶ್ನೆ
How do you fix GNU
find inbox -L -printso it uses-L?ಉತ್ತರ
find -L inbox -print. Put-Lbefore the first starting point.ಕಾರ್ಡ್ 5
ಪ್ರಶ್ನೆ
gatewayis a symlink to the readable directorywarehouse, which contains only the regular filemanifest.txt. Which path doesfind -H gateway -type f -printprint?ಉತ್ತರ
gateway/manifest.txt. The printed path keeps the spelling of the starting point.ಕಾರ್ಡ್ 6
ಪ್ರಶ್ನೆ
Which GNU
findoption explicitly keeps both starting-point and encountered symlinks as link entries during traversal?ಉತ್ತರ
-P. It selects the default traversal mode.ಕಾರ್ಡ್ 7
ಪ್ರಶ್ನೆ
current.datis a symlink to the regular filerun.dat. What doesfind -P current.dat -type f -printprint?ಉತ್ತರ
Nothing. With
-P,-type fchecks the entry itself, which is a symlink.ಕಾರ್ಡ್ 8
ಪ್ರಶ್ನೆ
GNU
findstarts in a real directory and needs to search inside the readable directory symlinks it meets along the way. Which mode opens those paths?ಉತ್ತರ
-L. It follows resolvable symbolic links encountered during the search.ಕಾರ್ಡ್ 9
ಪ್ರಶ್ನೆ
portis a symlink to a readable directory. Whenfind -L port -maxdepth 0 -type d -printtests the starting point, what does it print?ಉತ್ತರ
port. With-L,-type dsees the resolved directory type.ಕಾರ್ಡ್ 10
ಪ್ರಶ್ನೆ
desk/mixstores the symlink text../library/./mix.txt, which resolves to the regular filelibrary/mix.txt. Doesfind -P desk -lname '../library/mix.txt' -printprintdesk/mix?ಉತ್ತರ
No.
-lnamematches the stored text. The extra./is part of that text.ಕಾರ್ಡ್ 11
ಪ್ರಶ್ನೆ
quick.iniis a symlink to the regular filedefaults.ini. What doesfind -H quick.ini -type f -printprint?ಉತ್ತರ
quick.ini. Under-H, a resolvable symlink supplied as a starting point is tested using its target type.ಕಾರ್ಡ್ 12
ಪ್ರಶ್ನೆ
trailis a symlink to the readable directoryrecords, whose only entry is the regular fileday.txt. Which paths doesfind -L trail records -name day.txt -printprint?ಉತ್ತರ
trail/day.txtandrecords/day.txt. GNUfindsearches from each starting point and prints the path used to reach a match.ಕಾರ್ಡ್ 13
ಪ್ರಶ್ನೆ
The only entries in
shelfare the regular fileitem.txt, a symlinkkeptto it, and a symlinklostto missingold.txt. What doesfind shelf -type l -printlist?ಉತ್ತರ
shelf/keptandshelf/lost. Both entries are symlinks. The default mode tests each link entry itself.ಕಾರ್ಡ್ 14
ಪ್ರಶ್ನೆ
The only entries in
surveyare the regular filemap.datand a symlinkmap-copyto it. Which paths doesfind -P survey -xtype f -printprint?ಉತ್ತರ
survey/map.datandsurvey/map-copy. With-P,-xtype fchecks a live symlink's target type and a regular file's own type.ಕಾರ್ಡ್ 15
ಪ್ರಶ್ನೆ
dropis a real directory. Its symlinkroutepoints to readable../intake, which containslabel.txt. How should you change the starting point infind -H drop -name label.txt -printto reachdrop/route/label.txt?ಉತ್ತರ
Use
drop/routeas the starting point.find -H drop/route -name label.txt -printಕಾರ್ಡ್ 16
ಪ್ರಶ್ನೆ
handbookis a symlink to the regular filemanual.txt. Which exact basename should replacePATTERNinfind -L handbook -name PATTERN -print?ಉತ್ತರ
handbook. The basename that-nametests comes from the path GNUfindis visiting.ಕಾರ್ಡ್ 17
ಪ್ರಶ್ನೆ
Which link-following mode takes effect in GNU
find -L -P -H stage -print?ಉತ್ತರ
-H. The last of-P,-Hand-Lsets the link-following mode.ಕಾರ್ಡ್ 18
ಪ್ರಶ್ನೆ
scanhas symlinkokto existing regular filenew.datand symlinkstaleto missingold.dat. Which link path doesfind -L scan -type l -printprint?ಉತ್ತರ
scan/stale. The missing target leaves GNUfindwith the link's own type for-type l.ಕಾರ್ಡ್ 19
ಪ್ರಶ್ನೆ
GNU
findcan read and search both directories. The only entry inincomingisoffsite, a symlink to the readable sibling directory../shared. The only entry insharedis the regular filememo.txt. Which path doesfind -L incoming -name memo.txt -printprint?ಉತ್ತರ
incoming/offsite/memo.txt. Following the directory link lets the search reach intoshared.ಕಾರ್ಡ್ 20
ಪ್ರಶ್ನೆ
How do you use GNU
findto list only symlinks to existing directories underyardwhile keeping the walk out of symlinked directories?ಉತ್ತರ
find -P yard -type l -xtype d -print-type lselects the link entry and-xtype dchecks its target type.ಕಾರ್ಡ್ 21
ಪ್ರಶ್ನೆ
The symlink
tilestoresstone.txt, the name of a readable regular file. Doesfind -L tile -lname stone.txt -printprint anything?ಉತ್ತರ
No. With
-L,-lnameis false for a link whose target GNUfindcan resolve.ಕಾರ್ಡ್ 22
ಪ್ರಶ್ನೆ
You need
find -L routes -type l -printto print resolvable symlinks as well as symlinks to missing targets. Which test should replace-type l?ಉತ್ತರ
-xtype l. With-L, it matches both resolvable symlinks and symlinks with missing targets.ಕಾರ್ಡ್ 23
ಪ್ರಶ್ನೆ
portalis a symlink to the readable directorypaper, which containsnotes.txt. Infind -L portal -path PATTERN -print, what literal path should replacePATTERNto print only that file through the symlink?ಉತ್ತರ
portal/notes.txt. The path GNUfindtests starts with the supplied starting point.ಕಾರ್ಡ್ 24
ಪ್ರಶ್ನೆ
The symlink
shortcutpoints to another symlink,relay, which points to readable directoryworkspace. Doesfind -P shortcut -xtype d -printprint anything?ಉತ್ತರ
Yes,
shortcut. With-P,-xtype dchecks the final target, which is a directory.ಕಾರ್ಡ್ 25
ಪ್ರಶ್ನೆ
The symlink
bookmarkstoresmissing.txt, a path that does not exist. What doesfind -L bookmark -lname missing.txt -printprint?ಉತ್ತರ
bookmark. When the target is missing,-lnamecan match the stored text of the link itself.ಕಾರ್ಡ್ 26
ಪ್ರಶ್ನೆ
The only entries in
dockare the regular filereport.txtand a symlinkaliasto it. What doesfind -L dock -xtype f -printlist?ಉತ್ತರ
Only
dock/report.txt. For the live link,-xtypeunder-Lchecks the link type. For the regular file it checks the file type.ಕಾರ್ಡ್ 27
ಪ್ರಶ್ನೆ
entranceis a symlink to a readable directory containingbadge.txt. What canfind -H entrance -maxdepth 0 -printprint?ಉತ್ತರ
Only
entrance. Depth zero is the starting point, even when GNUfindfollows that link.ಕಾರ್ಡ್ 28
ಪ್ರಶ್ನೆ
signpostis a symlink to missingstop.txt. What changes infind -H signpost -printifsignpostitself is also missing?ಉತ್ತರ
The search reports a missing starting path and prints no match. While the dangling symlink exists, the command prints
signpost.ಕಾರ್ಡ್ 29
ಪ್ರಶ್ನೆ
Which GNU
findtype test lists symlinks with missing targets undercachewhen you keep-P? Assume every link either resolves or points to a missing path.ಉತ್ತರ
-xtype l.find -P cache -xtype l -printಕಾರ್ಡ್ 30
ಪ್ರಶ್ನೆ
The symlink
tray/pinpoints to readable regular file../draft.txt. Infind -H START -xtype f -print, how does the match fortray/pinchange if you move the start fromtraytotray/pin?ಉತ್ತರ
It matches from
trayand stops matching when it is the start. Under-H,-xtypechecks an encountered live link's target type and a live starting link's own type.ಕಾರ್ಡ್ 31
ಪ್ರಶ್ನೆ
sorthas symlinkaisleto readable directory../store. Instore,goneis a symlink to missingunit.txt. Doesfind -L sort -type l -printreach and printsort/aisle/gone?ಉತ್ತರ
Yes.
-Lfollowssort/aisleinto the directory, and-type lselects the dangling link inside.ಕಾರ್ಡ್ 32
ಪ್ರಶ್ನೆ
deliveriesis a symlink to a readable directory. What GNUfindcommand opens that starting point and prints the symlink entries it finds, keeping later links as entries?ಉತ್ತರ
find -H deliveries -type l -print-Hfollows the starting link. Inside,-type lselects the symlink entries.
32 ಕಾರ್ಡ್ಗಳು
GNU find Symlink Flashcards
ಅಧ್ಯಯನ ಆರಂಭಿಸಲು Nibomo ತೆರೆಯುತ್ತದೆ.