atoll - Linux


atoll converts a decimal integer to a string. It is commonly used to manipulate integers as strings and is particularly useful in scenarios like parsing input or generating output in specific string formats.


atoll [OPTIONS] integer


| Option | Description | Default |
| -w, --width | Pad the resulting string with spaces to the specified width. | None |
| -z, --zero-pad | Pad the resulting string with zeros instead of spaces. | False |
| -u, --unsigned | Treat the input integer as an unsigned number. | False |


Example 1: Convert the integer 1234 to a string and print it.

$ atoll 1234

Example 2: Convert the integer -123 to a string, zero-padded to a width of 10.

$ atoll -z -w 10 -123

Example 3: Convert the unsigned integer 123 to a string.

$ atoll -u 123

Common Issues

  • Ensure that the input integer is a valid decimal number.
  • If the -w or -z options are used, the specified width must be greater than the length of the resulting string.


atoll can be combined with other Linux commands to perform complex string manipulations. For instance:

$ echo 123 | atoll -z -w 10 | rev

This command reverses the digits of the integer 123, zero-padded to a width of 10.

Related Commands

  • atoi: Converts a string to an integer.
  • printf: Formats and prints data in a specified manner.