Files and Filesystem

No matter which operating system you’re using, it’s hard to do anything without being able to find your way through and work with the filesystem. The following utilities help you find your way:

File organization

Boxing, packing, sorting, shipping — I’m always shuffling files around on my system. File organization commands provide tools for moving files and filesystem units around, as shown in Table A-4.

Table A-4. File Organization Tools
CommandPurpose
cdChanges directories.
cpCopies a file.
dfShows partitions and how much space they have.
duShows how much disk is being used in the current directory and below.
lnCreates a shortcut.
lsLists the contents of a directory or information about a file.
mkdirCreates a directory.
mvMoves or renames a file.
pwdShows the path for the directory you’re currently in.
rmDeletes a file.
rmdirDeletes an empty directory.

File attributes

Files are much like candy bars. The wrappers provide information about the ingredients, size, and package date — all descriptive of the tasty nugget inside. (Perhaps the wrapper is even childproof.) Files keep all this wrapper information in an inode. Along with the capability to change file inode information, these commands can return data about the content of the file, as shown in Table A-5.

Table A-5. File Attributes Commands
CommandPurpose
chgrpChanges the group associated with a file
chmodChanges a file’s permissions
chownChanges who owns a file
fileShows what type of file you’re dealing with
statShows ...

Get Linux® For Dummies®, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.