This repo implements the Unix coreutils like head
tail
cat
echo
wc
tree
yes
false
true
env
in Golang
head outputs the first part of the file
-n=num
: print the first NUM lines instead of the first 10
go run cmd/head/main.go [OPTIONS] [FILE]
tail outputs the last part of the file
-n=NUM
: print the last NUM lines instead of the last 10
go run cmd/tail/main.go [OPTIONS] [FILE]
cat concatenate files and print on the standard output With no FILE, or when FILE is -, read standard input.
-n
: number all the output lines
go run cmd/cat/main.go [OPTIONS] [FILE]
echo echoes the STRING(s) to standard output.
-n
: don't output the trailing newline
go run cmd/echo/main.go [OPTIONS] [STRING]
wc print newline, word, and byte counts for each file
-c
: print the bytes counts-m
: print the character counts-l
: print the newline counts
go run cmd/wc/main.go [OPTIONS] [FILE]
tree prints the heirarchy of a given directory If no directory given , prints that of the current directory
-L=LEVEL
: print the heirarchy down to LEVEL number of levels
go run cmd/tree/main.go [OPTIONS] [FILE]
yes repeatedly output a line with all specified STRING(s), or 'y'until killed
go run cmd/yes/main.go [STRING]
true do nothing, successfully, exit with a status code indicating success.
go run cmd/true/main.go
true do nothing, unsuccessfully, exit with a status code indicating failure.
go run cmd/false/main.go
env prints the resulting environment.
go run cmd/env/main.go