So i use termux and newbie,i want to save -help command from package as txt in internal storage with specific file name Ex:youtube-dl --help,aria2c -h,etc How to do that?


1 Answer 1


What you want to do is called "output redirection". By assuming the program whose output we need to be redirected is youtube-dl, the full command to issue becomes

youtube-dl --help &> /sdcard/help.txt

In the above string, youtube-dl --help is the program whose output you want to save, alongside any needed argument. &> means "redirect the standard input and standard error"; it's important to redirect both, as some programs output their help message to stderr. /sdcard/help.txt is a file in the internal storage, where the output will be saved.

Take care when using this method, as the target file will be recreated anew if it already exists, thus its contents will be lost. To concatenate the new input to an already existent file, use e.g.

youtube-dl --help &>> /sdcard/help.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .