Skip to content

echo

Bash
echo "something"
Bash Session
something

Echo something into file (it will create file if it doesn't exist)

Bash
echo "something" > file

Emptying file with echo (file will be empty after this command)

Bash
echo > file

Nice trick

Bash
cat << "EOF"
       _,.
     ,` -.)
    '( _/'-\\-.
   /,|`--._,-^|            ,
   \_| |`-._/||          ,'|
     |  `-, / |         /  /
     |     || |        /  /
      `r-._||/   __   /  /
  __,-<_     )`-/  `./  /
 '  \   `---'   \   /  /
     |           |./  /
     /           //  /
 \_/' \         |/  /
  |    |   _,^-'/  /
  |    , ``  (\/  /_
   \,.->._    \X-=/^
   (  /   `-._//^`
    `Y-.____(__}
     |     {__)
           ()`
EOF

Echo something into file - cool one

Bash
cat << "EOF" >> awesome.file
Something..
Maybe bash script :D
EOF

Echo with random colors.

Bash
echo -e "\e[38;5;$((RANDOM%257))m" && cat << 'EOF'
          _____                    _____                    _____                    _____                   _______                   _____          
 ________  ___  ___  ________  ________  ________  ___  __       
|\   ___ \|\  \|\  \|\   __  \|\   __  \|\   __  \|\  \|\  \     
\ \  \_|\ \ \  \\\  \ \  \|\  \ \  \|\ /\ \  \|\  \ \  \/  /|_   
 \ \  \ \\ \ \  \\\  \ \   _  _\ \   __  \ \  \\\  \ \   ___  \  
  \ \  \_\\ \ \  \\\  \ \  \\  \\ \  \|\  \ \  \\\  \ \  \\ \  \ 
   \ \_______\ \_______\ \__\\ _\\ \_______\ \_______\ \__\\ \__\
    \|_______|\|_______|\|__|\|__|\|_______|\|_______|\|__| \|__|      
                                                                                                                                                      
EOF
Bash
echo -e "\e[38;5;$((RANDOM%257))m" && cat << 'EOF'
          _____                    _____                    _____                    _____                   _______                   _____          
         /\    \                  /\    \                  /\    \                  /\    \                 /::\    \                 /\    \         
        /::\    \                /::\____\                /::\    \                /::\    \               /::::\    \               /::\____\        
       /::::\    \              /:::/    /               /::::\    \              /::::\    \             /::::::\    \             /:::/    /        
      /::::::\    \            /:::/    /               /::::::\    \            /::::::\    \           /::::::::\    \           /:::/    /         
     /:::/\:::\    \          /:::/    /               /:::/\:::\    \          /:::/\:::\    \         /:::/~~\:::\    \         /:::/    /          
    /:::/  \:::\    \        /:::/    /               /:::/__\:::\    \        /:::/__\:::\    \       /:::/    \:::\    \       /:::/____/           
   /:::/    \:::\    \      /:::/    /               /::::\   \:::\    \      /::::\   \:::\    \     /:::/    / \:::\    \     /::::\    \           
  /:::/    / \:::\    \    /:::/    /      _____    /::::::\   \:::\    \    /::::::\   \:::\    \   /:::/____/   \:::\____\   /::::::\____\________  
 /:::/    /   \:::\ ___\  /:::/____/      /\    \  /:::/\:::\   \:::\____\  /:::/\:::\   \:::\ ___\ |:::|    |     |:::|    | /:::/\:::::::::::\    \ 
/:::/____/     \:::|    ||:::|    /      /::\____\/:::/  \:::\   \:::|    |/:::/__\:::\   \:::|    ||:::|____|     |:::|    |/:::/  |:::::::::::\____\
\:::\    \     /:::|____||:::|____\     /:::/    /\::/   |::::\  /:::|____|\:::\   \:::\  /:::|____| \:::\    \   /:::/    / \::/   |::|~~~|~~~~~     
 \:::\    \   /:::/    /  \:::\    \   /:::/    /  \/____|:::::\/:::/    /  \:::\   \:::\/:::/    /   \:::\    \ /:::/    /   \/____|::|   |          
  \:::\    \ /:::/    /    \:::\    \ /:::/    /         |:::::::::/    /    \:::\   \::::::/    /     \:::\    /:::/    /          |::|   |          
   \:::\    /:::/    /      \:::\    /:::/    /          |::|\::::/    /      \:::\   \::::/    /       \:::\__/:::/    /           |::|   |          
    \:::\  /:::/    /        \:::\__/:::/    /           |::| \::/____/        \:::\  /:::/    /         \::::::::/    /            |::|   |          
     \:::\/:::/    /          \::::::::/    /            |::|  ~|               \:::\/:::/    /           \::::::/    /             |::|   |          
      \::::::/    /            \::::::/    /             |::|   |                \::::::/    /             \::::/    /              |::|   |          
       \::::/    /              \::::/    /              \::|   |                 \::::/    /               \::/____/               \::|   |          
        \::/____/                \::/____/                \:|   |                  \::/____/                 ~~                      \:|   |          
         ~~                       ~~                       \|___|                   ~~                                                \|___|          
                                                                                                                                                      
EOF