Page is a Work in progress


The purpose of this page is to reflect all useful commands I have come across and have used as a one off or has become a staple.

Copying one file into many files

At one point I had to replace 600 symbolic links which all had the same contents of one file but it was 600 unique filenames. First command tee.

What does tee do?

TEE(1) User Commands TEE(1)

NAME
tee - read from standard input and write to standard output and files

SYNOPSIS
tee [OPTION]... [FILE]...

DESCRIPTION
Copy standard input to each FILE, and also to standard output.

-a, --append
append to the given FILEs, do not overwrite

-i, --ignore-interrupts
ignore interrupt signals

--help display this help and exit

--version
output version information and exit

If a FILE is -, copy again to standard output.

How its used. Lets say you have a file called test.txt and you need to make 10 copies.

tee <test.txt test{01..10}.txt >/dev/null
ls -al
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test01.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test02.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test03.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test04.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test05.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test06.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test07.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test08.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test09.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test10.txt
-rw-rw-r--. 1 testuser testuser     6 Oct  8 14:48 test.txt

Now that the files are made, its time to rename every single file but how?

...