Accueil / Système d'exploitation / Linux / How to append text to a system file via terminal with sudo command

How to append text to a system file via terminal with sudo command

Print Friendly, PDF & Email
echo ‘ router’ | sudo tee -a /etc/hosts
tee — pipe fitting

tee [-ai] [file …]
The tee utility copies standard input to standard output, making a copy in zero or more files. The output is

The following options are available:

-a Append the output to the files rather than overwriting them.

-i Ignore the SIGINT signal.

The following operands are available:

file A pathname of an output file.

The tee utility takes the default action for all signals, except in the event of the -i option.

The tee utility exits 0 on success, and >0 if an error occurs.

The tee function is expected to be POSIX IEEE Std 1003.2 (“POSIX.2”) compatible.

À propos Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.

Laisser une réponse

Votre adresse email ne sera pas publiéeLes champs requis sont surlignés *




Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.