cat – concatenate file(s) or standard input to standard output.
Usage:
cat [option] [file]
Options:
-A, --show-all
equivalent to -vET-b, --number-nonblank
number nonempty output lines, overrides -n
-e
equivalent to -vE
-E, --show-ends
display $ at end of each line
-n, --number
number all output lines
-s, --squeeze-blank
suppress repeated empty output lines
-T, --show-tabs
display TAB characters as ^I
-u
(ignored)
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
Example: Combine 2 files
$ cat file1 file2 > newfile
Example: Append a file to another file
$ cat file1 >> file2
cp – copy / duplicate files and/or directories
Usage:
cp [option] [source] [destination]
Options:
-a, --archive
same as -dR --preserve=all--attributes-only
don't copy the file data, just the attributes
--backup[=CONTROL]
make a backup of each existing destination file
-b like --backup but does not accept an argument
--copy-contents
copy contents of special files when recursive
-d same as --no-dereference --preserve=links
-f, --force
if an existing destination file cannot be opened, remove it and try again (redundant if the -n option is used)
-i, --interactive
prompt before overwrite (overrides a previous -n option)
-H follow command-line symbolic links in SOURCE
-l, --link
hard link files instead of copying
-L, --dereference
always follow symbolic links in SOURCE
-n, --no-clobber
do not overwrite an existing file (overrides a previous -i option)
-P, --no-dereference
never follow symbolic links in SOURCE
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all
-c same as --preserve=context
--no-preserve=ATTR_LIST
don't preserve the specified attributes
--parents
use full source file name under DIRECTORY
-R, -r, --recursive
copy directories recursively
--reflink[=WHEN]
control clone/CoW copies. See below
--remove-destination
remove each existing destination file before attempting to open it (contrast with --force)
--sparse=WHEN
control creation of sparse files. See below
--strip-trailing-slashes
remove any trailing slashes from each SOURCE argument
-s, --symbolic-link
make symbolic links instead of copying
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
copy all SOURCE arguments into DIRECTORY
-T, --no-target-directory
treat DEST as a normal file
-u, --update
copy only when the SOURCE file is newer than the destination file or when the destination file is missing
-v, --verbose
explain what is being done
-x, --one-file-system
stay on this file system
-Z, --context=CONTEXT
set security context of copy to CONTEXT
Example: Copy file1 to file2
$ cp file1 file2
Example: Create a new symbolic link of file1 as file2
$ cp -s file1 file2
mv – move / rename files and/or directories
Usage:
mv [option] [source] [destination]
Options:
--backup[=CONTROL]
make a backup of each existing destination file-b
like --backup but does not accept an argument
-f, --force
do not prompt before overwriting
-i, --interactive
prompt before overwrite
-n, --no-clobber
do not overwrite an existing file
--strip-trailing-slashes
remove any trailing slashes from each SOURCE argument
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
move all SOURCE arguments into DIRECTORY
-T, --no-target-directory
treat DEST as a normal file
-u, --update
move only when the SOURCE file is newer than the destination file or when the destination file is missing
-v, --verbose
explain what is being done
Example: Rename file1 to file2
$ mv file1 file2
Example: Move folder to a new destination
$ mv /path/to/source /path/to/destination
mkdir – make a new directory
Usage:
mkdir [option] [dir]
Options:
-m, --mode=MODE
set file mode (as in chmod), not a=rwx - umask-p, --parents
no error if existing, make parent directories as needed
-v, --verbose
print a message for each created directory
-Z, --context=CTX
set the SELinux security context of each created directory to CTX
Example: Making a new directory and print a message explaining what is being done
$ mkdir -v NewFolder
mkdir: created directory `NewFolder'
rm – remove / delete a file
Usage:
rm [option] [file]
Options:
-f, --force
ignore nonexistent files, never prompt-i
prompt before every removal
-I
prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving protection against most mistakes
--interactive[=WHEN]
prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompt always
--one-file-system
when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument
--no-preserve-root
do not treat `/' specially
--preserve-root
do not remove `/' (default)
-r, -R, --recursive
remove directories and their contents recursively
-v, --verbose
explain what is being done
Example: Remove a directory and print a message explaining what is being done
user@ubuntu:~$ rm -rv test2
removed directory: `test2'
ln – create symbolic link
Usage:
ln [source] [destination](create a link to TARGET with the name LINK_NAME)
ln [OPTION] [-T] TARGET LINK_NAME
(create a link to TARGET in the current directory)
ln [OPTION] TARGET
(create links to each TARGET in DIRECTORY)
ln [OPTION] TARGET DIRECTORY
ln [OPTION] -t DIRECTORY TARGET
Create hard links by default, symbolic links with --symbolic. When creating hard links, each TARGET must exist. Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory.
Options:
--backup[=CONTROL]
make a backup of each existing destination file-b
like --backup but does not accept an argument
-d, -F, --directory
allow the superuser to attempt to hard link directories (note: will probably fail due to system restrictions, even for the superuser)
-f, --force
remove existing destination files
-i, --interactive
prompt whether to remove destinations
-L, --logical
make hard links to symbolic link references
-n, --no-dereference
treat destination that is a symlink to a directory as if it were a normal file
-P, --physical
make hard links directly to symbolic links
-s, --symbolic
make symbolic links instead of hard links
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
specify the DIRECTORY in which to create the links
-T, --no-target-directory
treat LINK_NAME as a normal file
-v, --verbose
print name of each linked file
--help
display this help and exit
--version
output version information and exit
touch – update the access time and last modified date for a file to the current time and date
Usage:
touch [option] [file]
Options:
-a
change only the access time-c, --no-create
do not create any files
-d, --date=STRING
parse STRING and use it instead of current time
-f
(ignored)
-h, --no-dereference
affect each symbolic link instead of any referenced file (useful only on systems that can change the timestamps of a symlink)
-m
change only the modification time
-r, --reference=FILE
use this file's times instead of current time
-t STAMP
use [[CC]YY]MMDDhhmm[.ss] instead of current time
--time=WORD
change the specified time: WORD is access, atime, or use: equivalent to -a WORD is modify or mtime: equivalent to -m
Example: Change the access time of a file to specified date
$ touch -t 199912131415 filename