Print the first colon-separated field from each line.
cut -d: -f1 /etc/passwdExtract selected fields or character ranges from each input line.
cut OPTION... [FILE]...Print the first colon-separated field from each line.
cut -d: -f1 /etc/passwdPrint characters 1 through 12 from each line.
cut -c1-12 names.txt| Option / clause | Description |
|---|---|
-b, --bytes=LIST | Select byte positions. |
-c, --characters=LIST | Select character positions. |
-d, --delimiter=DELIM | Use DELIM as the field delimiter (default tab). |
-f, --fields=LIST | Select fields; requires delimiter-separated input. |
-s, --only-delimited | Skip lines without the delimiter. |
--complement | Select the complement of the chosen bytes, characters or fields. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.