for each command you can use –help
touch
– create file
nano
– edit in nano
To copy/paste in nano
– use ^k
(it stays in a buffer)
cat
– output file contents in terminal
cp
– copy
mv
– move
rm
– delete
rm -rf
– recursive deleting (folder), ignoring (force) errors
uniq a.txt > b.txt
– delete duplicates
sort a.txt > b.txt
– sort contents
sort -u
– combine both
uniq a.txt | sort
– the same, but with piping
echo "foo" >> a.txt
– append
head a.txt
– output first 10 rows
tail a.txt
– the same, but from the end
head -n 1 a.txt
– output 1st row
head -n 1 a.txt >> b.txt
– append file b with 1st line from file a
grep
– search in the file
An example of sorting and output in one line of output from the code:
go run . | tr " " "\n" | sort -n | paste -sd' '