File- and Directory-Manipulation Commands


Command

Action

cd dirname

Used to change to the directory dirname. If the path is not specified, dirname is assumed to be relative to the current path. (See Chapter 8, "Working with the Shell.")

ls

Lists the contents of the current directory. Popular options include -l to list the attributes of each entry, -a to list hidden files (which begin with dots), and -F to help differentiate between certain types of files. (See Chapter 8.)

cp oldfile newfile

Copies oldfile to newfile. If no directory path is specified for either file, they are both assumed to be in the current directory. Common options include -R to recursively copy a directory, -p to preserve permissions and ownership information, and -i, to perform an interactive copy that prevents the clobbering of existing files. (See Chapter 8.)

mv oldfile newfile

Moves oldfile to newfile. If no directory is specified for either file, they are both assumed to be in the current directory. Common options include -i, which performs an interactive copy that prevents the clobbering of existing files. This command is also used to rename files and directories. (See Chapter 8.)

rm filename

Deletes (removes) filename. This is a non-reversible process. The -i option prompts you to confirm the process, and -f forces the deletion and suppresses the system's warnings. The -r option allows you to remove the contents of directories recursively. (See Chapter 8.)

rmdir dirname

Removes the directory dirname, assuming that it is empty. (See Chapter 8.)

touch filename

Updates the access time on filename. If the file does not already exist, it is created. (See Chapter 8.)

mkdir dirname

Creates the directory dirname. The -p option creates all directories along the specified path if they don't already exist. (See Chapter 8.)

ln file1 file2

Creates a link named file2 that serves as an alternative name for file1. The -s option creates a symbolic link, similar to a shortcut in Windows, rather than a hard link. (See Chapter 8.)

mount filesystem mountpoint

Mounts the filesystem represented by filesystem on the directory represented by mountpoint to make it available for use. (See Chapter 12, "The FreeBSD Filesystem.")

umount mountpoint

Unmounts the filesystem mounted on the directory mountpoint, making it unavailable for use. (See Chapter 9, "Customizing the Shell.")





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net