Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

seq command in Linux with Examples

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

seq command in Linux is used to generate numbers from FIRST to LAST in steps of INCREMENT. It is a very useful command where we had to generate list of numbers in while, for, until loop. 

Syntax:  

seq [OPTION]... LAST
  or
seq [OPTION]... FIRST LAST
  or
seq [OPTION]... FIRST INCREMENT LAST

Options:  

  • seq LAST: When only one argument is given then it produces numbers from 1 to LAST in step increment of 1. If the LAST is less than 1, then is produces no output. 

  • seq FIRST LAST: When two arguments are given then it produces numbers from FIRST till LAST is step increment of 1. If LAST is less than FIRST, then it produces no output. 
     

  • seq FIRST INCREMENT LAST: When three arguments are given then it produces numbers from FIRST till LAST in step of INCREMENT. If LAST is less than FIRST, then it produces no output. 
     

  • seq -f “FORMAT” FIRST INCREMENT LAST: This command is used to generate sequence in a formatted manner. FIRST and INCREMENT are optional. 

  • seq -s “STRING” FIRST INCREMENT LAST: This command is uses to STRING to separate numbers. By default this value is equal to “\n”. FIRST and INCREMENT are optional. 

  • seq -w FIRST INCREMENT LAST: This command is used to equalize width by padding with leading zeroes. FIRST and INCREMENT are optional. 

  • seq –help: It displays help information. 

  • seq –version: It displays version information. 

 

 

My Personal Notes arrow_drop_up
Last Updated : 06 Jul, 2021
Like Article
Save Article
Similar Reads