File management is basic to being able to administer or use a Linux system. Various commands are useful to both users and administrators for copying, moving, renaming, and otherwise manipulating ﬁles and directories. You may also want to set up access controls, both to limit the amount of disk space users may consume and to limit who may access speciﬁ c ﬁles and directories. Finally, Linux provides tools to help you locate ﬁles using various criteria.
Which commands are used to copy, move, and rename files in Linux?
The cp command copies ﬁles, as in cp first second to create a copy of first called second . The mv command does double duty as a ﬁle-moving and a ﬁle-renaming command. It works much like cp , but mv moves or renames the ﬁle rather than copying it.
What are Linux’s directory-manipulation commands?
The mkdir command creates a new directory, and rmdir deletes a directory. You can also use many ﬁle-manipulation commands, such as mv and rm (with its -r option), on directories.
What is the difference between hard and symbolic links?
Hard links are duplicate directory entries that both point to the same inode and hence to the same ﬁle. Symbolic links are special ﬁles that point to another ﬁle or directory by name. Hard links must reside on a single ﬁlesystem, but symbolic links may point across ﬁlesystems.
What are the common Linux archiving programs?
The tar and cpio programs are both ﬁle-based archiving tools that create archives of ﬁles using ordinary ﬁle access commands. The dd program is a ﬁle-copy program; but when it’s fed a partition device ﬁle, it copies the entire partition on a very low-level basis, which is useful for creating low-level image backups of Linux or non-Linux ﬁlesystems.
How does Linux’s file ownership system work?
Every ﬁle has an owner and a group, identiﬁed by number. File permissions can be assigned independently to the ﬁle’s owner, the ﬁle’s group, and all other users.
How does Linux’s file permissions system work?
Linux provides independent read, write, and execute permissions for the ﬁle’s owner, the ﬁle’s group, and all other users, resulting in nine main permission bits. Special permission bits are also available, enabling you to launch program ﬁles with modiﬁed account features or alter the rules Linux uses to control who may delete ﬁles.
Which commands are used to modify permissions in Linux?
The chmod command is Linux’s main tool for setting permissions. You can specify permissions using either an octal (base 8) mode or a symbolic notation. The chown and chgrp commands enable you to change the ﬁle’s owner and group, respectively. (The chown command can do both but can be run only by root .)
What are the prerequisites of using Linux’s disk quota system?
Linux’s disk quota system requires support in the Linux kernel for the ﬁlesystem on which quotas are to be used. You must also run the quotaon command, typically from a SysV startup script, to enable this feature.
How quotas are set?
You can edit quotas for an individual user via the edquota command, as in edquota larry to edit larry ’s quotas. This command opens an editor on a text ﬁle that describes the user’s quotas. You can change this description, save the ﬁle, and exit from the editor to change the user’s quotas.
How Linux’s standard directories are structured?
Linux’s directory tree begins with the root ( / ) directory, which holds mostly other directories. Speciﬁc directories may hold speciﬁc types of information, such as user ﬁles in /home and conﬁguration ﬁles in /etc . Some of these directories and their sub-directories may be separate partitions, which helps isolate data in the event of ﬁlesystem corruption.
What are the major file-location commands in Linux?
The find command locates ﬁles by brute force, searching through the directory tree for ﬁles that match the criteria you specify. The locate (or slocate ) command searches a database of ﬁles in publicly accessible directories. The whereis command searches a handful of important directories, and which searches the path. The type command identiﬁes another command as a built-in shell command, a shell alias, or an external command (including the path to that command).