Skip to main content

Linux command: cut

Illustration: Scissors | src: https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwjSzIjQlbjhAhWt-GEKHZMyCEMQjRx6BAgBEAU&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFile%3AScissors_icon_black.svg

cut - remove sections from each line of files

$ which cut
/usr/bin/cut
$ cut --version
cut (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 David M. Ihnat, David MacKenzie, and Jim Meyering.

Examples of cut

List all VMs in Qubes OS, then use cut to get the first column

Qubes OS: list all VMs

$ qvm-ls | cut -d " " f 1 # Number 1 NOT letter L
$ qvm-ls | cut -d" " f1  # or NO space in between options and value
Use cut to get the first column

Extract username and id from /etc/passwd file

Delimiter is ":", username is in column 1 and id is in column 3.

$ cut -d: -f1,3 /etc/passwd
Extract username and id from /etc/passwd file
'cut' selects columns, 'head' and 'tail' select rows

Popular posts from this blog

IIS: Delete cached files on server running IIS

Delete cached files on server running IIS When changing css, javascript files, check to delete if IIS still caches old files in the default folder C:\inetpub\temp\IIS Temporary Compressed Files\<sitename>\$^_gzip_D^\ Apply to: IIS 8.5

Linux command: du - disk usage

Where have all my storage gone? du summarize disk usage of the set of FILEs, recursively for directories.

ManageEngine ServiceDesk Plus - Reset password

Let's reset the default administrator's password to 'admin'