Create websites with TailwindCSS
Design blocks for your website
Start building the next great SAAS
Alpine & Tailwind UI Library
Plug'n Play Authentication for Laravel
Create website designs with AI
Blog platform for developers
Build a simple static website
21-day program to build a SAAS
# Using the > operator
echo 'Hello World' > test.txt
ls -la > test.txt
# Using the tee command
echo 'Hello World' | tee test.txt
ls -la | tee test.txt
There may be times where you wish to save your terminal or shell output to a file.
Luckily there are 2 simple ways you can do this:
>
commandtee
command>
operator at the end of your command.echo 'Hello World' > test.txt
Above we will output the command to the test.txt
file. In the example above our command was echo 'Hello World'
. We could also list out the current directory:
ls -la > test.txt
And that would save the output to the test.txt file.
tee
commandTee is a command that takes standing input and writes to standard output. You can |
your command to the tee
command like so:
echo 'Hello World' | tee test.txt
The tee
command will still process the output into your command prompt and it will also write it to the test.txt
file. We can do the same with our ls
command:
ls -la | tee test.txt
And the output will show up in our prompt and in our test.txt
No explanation generated yet.