Ubuntu – Command to append line to a text file without opening an editor

bashcommand lineredirectscriptstext-editor

Assuming i have a line that i want to add to a file without opening an editor.

How could i append this line

alias list='ls -cl --group-directories-first'

to this file

config.fish

Best Answer

You can append a line of text to a file by using the >> operator:

echo "hello world" >> my_file.txt

or in your case

echo "alias list='ls -cl --group-directories-first'" >> config.fish

Please take note of the different types of quotes.