Strange bash piping method that actually does work. And fixing hard disk partitions with fsck.

Posted: August 29, 2013. At: 11:28 PM. This was 4 years ago. Post ID: 6172
Page permalink:

This is a strange bash piping method that actually does work. This pipes the output of one echo command and appends it to another.

ubuntu ~ $ echo "Hello World" >| echo "Me" > out.txt

This is the result of this strange command.

ubuntu ~ $ cat out.txt
Hello World Me

You should not use this syntax in reality; but this is an interesting trick nonetheless.

My laptop needing fsck.
My laptop needing fsck.

This is an interesting photograph. I booted up my Debian 7.0 laptop today and it had a problem with the /dev/sda1 partition. I typed the root password and ran the fsck /dev/sda1 command to fix the issue. This can happen from time to time; but it not too hard to fix when you have experience with Linux. There are more examples of usage for the fsck command here: My example only required me to run the command and then use Ctrl-D to to exit the shell and this then re-booted my laptop and then the problem was fixed.

No comments have been made. Use this form to start the conversation :)

Leave a Reply