Linux factor Command
Posted on December 7, 2020 (Last modified on July 14, 2022) • 2 min read • 359 wordsfactor command in linux print the prime factors of each specified integer number. If none are specified on the command line, factor command will read them from standard input.
factor command in Linux print the prime factors of each specified integer number. If none are specified on the command line, the factor command will read them from standard input.
factor is part of GNU Coreutils package.
factor [NUMBER]...
factor OPTION
We can pass the number directly to factor as input to be calculated.
$ factor 100
100: 2 2 5 5
$ factor 10
10: 2 5
$ factor 50
50: 2 5 5
If we run factor without input it will ask for input from standard input. For example:
$ factor
10
10: 2 5
20
20: 2 2 5
30
30: 2 3 5
40
40: 2 2 2 5
50
50: 2 5 5
100
100: 2 2 5 5
1000
1000: 2 2 2 5 5 5
To get help of factor command we can use --help
option.
factor --help
Usage: factor [NUMBER]...
or: factor OPTION
Print the prime factors of each specified integer NUMBER. If none
are specified on the command line, read them from standard input.
--help display this help and exit
--version output version information and exit
GNU coreutils online help:
Report factor translation bugs to
Full documentation at:
or available locally via: info '(coreutils) factor invocation'
To check factor version we can use --version
command.
factor --version
factor (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Rubin, Torbjörn Granlund, and Niels Möller.c
You can find factor command source code from the folowing repositories:
In this tutorial we learn how to use factor in Linux with practical examples. Visit our Linux Commands guide to learn more about using command line interface in Linux.