Factor (Unix)

Last updated
factor
Original author(s) Robert Morris,
Ken Thompson
(AT&T Bell Laboratories)
Developer(s) Various open-source and commercial developers
Initial release1974;48 years ago (1974)
Operating system Unix, Unix-like, Plan 9
Platform Cross-platform
Type Command

On Unix, Plan 9, and Unix-like computer systems, factor is a utility for factoring an integer into its prime factors. [1]

Contents

History

factor first appeared on 5th edition Research Unix in 1974, as a "user maintained" utility (section 6 of the manual). [2] In the 7th edition in 1979, it was moved into the main "commands" section of the manual (section 1). From there, the factor utility was copied to all other variants of Unix, including commercial Unixes and BSD. In some variants of Unix, it is classified as a "game" more than a serious utility, and therefore documented in section 6. [3]

A free software version of the factor utility was written for the GNU project by Paul Rubin, in 1986. It is now available on all Linux distributions as part of the GNU Core Utilities. In 2008, GNU factor started to use the GNU MP library for arbitrary-precision arithmetic, allowing it to factor integers of any size, not limited by the machine's native datatypes.

The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities. [4]

Syntax

factor [number]

The command can be used by supplying an integer value. Various projects, including simple ones such as printing prime numbers, are facilitated by using this command.

Related Research Articles

man page Unix software documentation

A man page is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs, formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.

ls

In computing, ls is a command to list computer files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory. The command is also available in the EFI shell. In other environments, such as DOS, OS/2, and Microsoft Windows, similar functionality is provided by the dir command. The numerical computing environments MATLAB and GNU Octave include an ls function with similar functionality.

basename is a standard computer program on Unix and Unix-like operating systems. When basename is given a pathname, it will delete any prefix up to the last slash ('/') character and return the result. basename is described in the Single UNIX Specification and is primarily used in shell scripts.

uname Standard UNIX utility that prints name and other details about the machine

uname is a computer program in Unix and Unix-like computer operating systems that prints the name, version and other details about the current machine and the operating system running on it.

chown Command used on Unix-like systems to change the owner of a file

The command chown, an abbreviation of change owner, is used on Unix and Unix-like operating systems to change the owner of file system files, directories. Unprivileged (regular) users who wish to change the group membership of a file that they own may use chgrp.

The Unix command su, which stands for 'substitute user', is used by a computer user to execute commands with the privileges of another user account. When executed it invokes a shell without changing the current working directory or the user environment.

The archiver, also known simply as ar, is a Unix utility that maintains groups of files as a single archive file. Today, ar is generally used only to create and update static library files that the link editor or linker uses and for generating .deb packages for the Debian family; it can be used to create archives for any purpose, but has been largely replaced by tar for purposes other than static libraries. An implementation of ar is included as one of the GNU Binutils.

join is a command in Unix and Unix-like operating systems that merges the lines of two sorted text files based on the presence of a common field. It is similar to the join operator used in relational databases but operating on text files.

tr (Unix) Command in Unix-like operating systems

tr is a command in Unix, Plan 9, Inferno, and Unix-like operating systems. It is an abbreviation of translate or transliterate, indicating its operation of replacing or removing specific characters in its input data set.

wc (Unix)

wc is a command in Unix, Plan 9, Inferno, and Unix-like operating systems. The program reads either standard input or a list of computer files and generates one or more of the following statistics: newline count, word count, and byte count. If a list of files is provided, both individual file and total statistics follow.

df (Unix) Standard Unix command

df is a standard Unix command used to display the amount of available disk space for file systems on which the invoking user has appropriate read access. df is typically implemented using the statfs or statvfs system calls.

cmp (Unix)

In computing, cmp is a command-line utility on Unix and Unix-like operating systems that compares two files of any type and writes the results to the standard output. By default, cmp is silent if the files are the same; if they differ, the byte and line number at which the first difference occurred is reported. The command is also available in the OS-9 shell.

rm (Unix)

rm is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.

diff3 is a Unix utility to compare three files and show any differences among them. diff3 can also merge files, implementing a three-way merge.

tail is a program available on Unix, Unix-like systems, FreeDOS and MSX-DOS used to display the tail end of a text file or piped data.

yes (Unix) Unix command

yes is a command on Unix and Unix-like operating systems, which outputs an affirmative response, or a user-defined string of text, continuously until killed.

In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.

whoami

In computing, whoami is a command found on most Unix-like operating systems, Intel iRMX 86, every Microsoft Windows operating system since Windows Server 2003, and on ReactOS. It is a concatenation of the words "Who am I?" and prints the effective username of the current user when invoked.

In computing, which is a command for various operating systems used to identify the location of executables. The command is available in Unix and Unix-like systems, the AROS shell, for FreeDOS and for Microsoft Windows. The functionality of the which command is similar to some implementations of the type command. POSIX specifies a command named command that also covers this functionality.

On Unix-like computer systems, seq is a utility for generating a sequence of numbers.

References

  1. factor(1)    Plan 9 Programmer's Manual, Volume 1
  2. manual page from Fifth Edition Unix (section 6: "user maintained programs")
  3. factor manual page from Sixth Edition Unix (section 6: "user contributed")
  4. "Native Win32 ports of some GNU utilities". unxutils.sourceforge.net.