15 Linux Cut Command Examples,I Tried it

By | January 25, 2017

Linux ‘Cut’ command is text processing command.we get portion of text from file.It will cut of portion of text from a file.All we need to do is mention the column to cut by specifying the delimiter.

It is not only used to cut data from text files and also can use on csv files.

15 Linux cut Command Examples i tried it

    15 Linux cut Command Examples i tried it

Let’s go by the usage’s of the linux cut command examples.

Let’s print one file content.

[ SLTMachine:]  # cat File.txt

i love simplylearntopics.com

Great content on the simplylearntopics.com

follow facebook page,goolge+ for simplylearntopics.com

Usage 1: How to get first character from “File.txt”

[ SLTMachine: ] # cut -c 1 File.txt




It will print the first character using “-c” option.

Usage 2: How to get first character and 3d character from “File.txt”

SLTMachine: # cut -c 1,3 File.txt




Usage 3: How to get first word from every line from  “File.txt”

[ SLTMachine: ] # cut -f 1 -d ' ' File.txt




Here “-d” means delimiter,we are giving single space as dimilter

Usage 4: How to get first word and third word from every line from  “File.txt”

[ SLTMachine ~]  # cut -f 1,3 -d ' ' File.txt
 i simplylearntopics.com

Great on

follow page,goolge+

Usage Lets'

Usage 5: How to get first word and third word from every line from  “File.txt” which has dilimiter “,”

[ SLTMachine ~]  # cut -f 1,3 -d ', ' File.txt

Usage 6: How to get every line by skipping first 3 letters from every line

[SLTMachine ~]# cut -c 3- File.txt
 love simplylearntopics.com

eat content on the simplylearntopics.com

llow facebook page,goolge+ for simplylearntopics.com

Usage 7:How to get first 3 letters from every line from “File.txt”

[SLTMachine ~]# cut -c 1-3 File.txt
 i l



Usage 8:How to avoid printing first field and print rest of the each line.

[SLTMachine ~]# cut -f 1 --complement -s -d ' ' File.txt

love simplylearntopics.com
 content on the simplylearntopics.com
 facebook page,goolge+ for simplylearntopics.com

I am printing each line except first word and considering ” ” space as one delimiter.

Usage 9:How to replace specific character with another character.

[SLTMachine ~]# echo 'simply;LearnTopics' | cut -d ';' -f 1,2 --output-delimiter=' '

Usage 10:How to print up to 5th Character in given line

[SLTMachine ~]# echo 'simplyLearnTopics' | cut  -c -11


Usage 11: Print from 5th character to the end of the line.

[SLTMachine ~]# echo 'simplyLearnTopics' | cut  -c 10 -

Usage 12:How to display first field from the /etc/passwd file?

[SLTMachine ~]# cut -d':' -f1 /etc/passwd

Usage 13: Print specific column by using specifying the Byte option.

[SLTMachine ~]# cut -b 2 File.txt

Print second character from File.text in every line.The output is equal to output if we use the below option


( or )

[SLTMachine ~]# cut -c 2 File.txt

Usage 14: Get List of File names in the current directory

[SLTMachine ~]#  ls -al | cut -c44-

Usage 15: If you want more options and help on the cut command options,use the following option.

[SLTMachine ~]# man cut


[SLTMachine ~]# cut --help


Thanks for Reading the 15 Linux Cut Command Examples.If you have any new usage of cut command,please post it in the comment section.I will add it in this post.

Happy Simply Learners 🙂

The following two tabs change content below.


Myself SRINIVAS DARIPELLI. I have 15+ Years of Experience in Programming worked on multiple technologies.Apart from it,I am a blogger, writer, editor, artist and dad 🙂 .I believe in reality.I love to share the Helpful things around the Technology. Feel free to connect with me

Leave a Reply