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.
Command | Purpose |
---|---|
cd | Changes directories. |
cp | Copies a file. |
df | Shows partitions and how much space they have. |
du | Shows how much disk is being used in the current directory and below. |
ln | Creates a shortcut. |
ls | Lists the contents of a directory or information about a file. |
mkdir | Creates a directory. |
mv | Moves or renames a file. |
pwd | Shows the path for the directory you’re currently in. |
rm | Deletes a file. |
rmdir | Deletes 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.
Command | Purpose |
---|---|
chgrp | Changes the group associated with a file |
chmod | Changes a file’s permissions |
chown | Changes who owns a file |
file | Shows what type of file you’re dealing with |
stat | Shows ... |
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.