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 files 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 specifi c files and directories. Finally, Linux provides tools to help you locate files using various criteria.


Which commands are used to copy, move, and rename files in Linux?

The cp command copies files, as in cp first second to create a copy of first called second . The mv command does double duty as a file-moving and a file-renaming command. It works much like cp , but mv moves or renames the file 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 file-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 file. Symbolic links are special files that point to another file or directory by name. Hard links must reside on a single filesystem, but symbolic links may point across filesystems.

What are the common Linux archiving programs?

The tar and cpio programs are both file-based archiving tools that create archives of files using ordinary file access commands. The dd program is a file-copy program; but when it’s fed a partition device file, 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 filesystems.

How does Linux’s file ownership system work?

Every file has an owner and a group, identified by number. File permissions can be assigned independently to the file’s owner, the file’s group, and all other users.

How does Linux’s file permissions system work?

Linux provides independent read, write, and execute permissions for the file’s owner, the file’s group, and all other users, resulting in nine main permission bits. Special permission bits are also available, enabling you to launch program files with modified account features or alter the rules Linux uses to control who may delete files.

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 file’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 filesystem 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 file that describes the user’s quotas. You can change this description, save the file, 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. Specific directories may hold specific types of information, such as user files in /home and configuration files in /etc . Some of these directories and their sub-directories may be separate partitions, which helps isolate data in the event of filesystem corruption.

What are the major file-location commands in Linux?

The find command locates files by brute force, searching through the directory tree for files that match the criteria you specify. The locate (or slocate ) command searches a database of files in publicly accessible directories. The whereis command searches a handful of important directories, and which searches the path. The type command identifies another command as a built-in shell command, a shell alias, or an external command (including the path to that command).