YouTip LogoYouTip

Linux Comm Cut

# Linux cut Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux cut command is used to display the text from the beginning of each line, from position num1 to num2. ### Syntax cut cut cut **Usage Description:** The cut command cuts bytes, characters, and fields from each line of a file and writes these bytes, characters, and fields to standard output. If the File parameter is not specified, the cut command reads from standard input. One of the -b, -c, or -f flags must be specified. **Parameters:** * -b : Cut by bytes. These byte positions will ignore multi-byte character boundaries, unless the -n flag is also specified. * -c : Cut by characters. * -d : Custom delimiter, default is the tab character. * -f : Used with -d, specifies which field to display. * -n : Do not split multi-byte characters. Only used with the -b flag. If the last byte of a character falls within the range indicated by the List parameter of the -b flag, that character will be output; otherwise, the character will be excluded. ### Example When you execute the who command, it outputs content similar to the following: $ who rocrocket :0 2009-01-08 11:07 rocrocket pts/0 2009-01-08 11:23 (:0.0) rocrocket pts/1 2009-01-08 14:15 (:0.0) If we want to extract the 3rd byte of each line, we do this: $ who|cut -b 3 c c [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm LnLinux Comm Indent β†’