File and directory management commands

The following commands are essential for the management of files and directories:

bzip2 [options] [pattern]

Create or uncompress an archive with the bzip2 algorithm.

cp file1 file2
cp files directory

Copy file1 to file2, or copy files to directory.

cpio[options] [files]

Create or extract a binary archive, containing either files or a recursive set of files and directories.

dd [options] [files]

Copy and convert files. The dd command can also copy data from raw devices, bypassing the filesystem layer.

file [file]

Determine the type of file by performing a number of tests.

find [directory] [options] [pattern]

Search through directory looking for objects that match pattern.

gunzip [options] [file]

Uncompress an archive created with gzip.

gzip [options] [pattern]

Create a compressed archive containing files and directories that match pattern.

ls [options] [pattern]

List the contents of a directory, or list only files that match [pattern].

mkdir directories

Create one or more directories.

mv source target

Move or rename files and directories.

rm files

Delete one or more files from the filesystem. When used recursively (with the -r option), rm also removes directories.

rmdir directories

Delete directories, which must be empty.

tar [options] [files]

Create or extract a Tape Archive, containing either files or a recursive set of files and directories.

touch files

Change the access and/or modification times of files by default to the present time.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.