Linux

Splitting a path in Linux

LinuxFiles & Directoriesbasenameintermediate

What this snippet does

basename strips the directory and dirname strips the filename.

Expected output

access.log
/var/log/nginx

Why practise typing this

Typing files & directories code builds muscle memory for the symbols and indentation Linux uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More Linux practice

Browse all Linux snippets →