tofrodos(1)
πΈ tofrodos πΈ
okay bestie, sit down, hydrate, because we're about to talk about the most iconic little line-ending glitch-fixer in the game: tofrodos. it converts text files between DOS and Unix formats, and yes that IS as important as it sounds π
β¨ NAME β¨
tofrodos β converts text files between DOS and Unix formats π¦
no cap, that's the whole job description.
β¨ SYNOPSIS β¨
fromdos [ options ] [file...]
todos [ options ] [file...]
two whole icons, two whole names, same slay energy β¨
β¨ DESCRIPTION β¨
okay so here's the tea, and it's actually kind of fascinating. DOS text files traditionally use a carriage return and line feed pair as their newline character, while Unix text files just use the line feed as their newline character. it's giving "same vibe, different encoding," and the way that invisible characters cause so many problems is genuinely unhinged π
so:
fromdosconverts ASCII and Unicode UTF-8 text files from the DOS format to the Unix format πtodosconverts them from the Unix format to the DOS format π
both programs accept multiple filenames and wildcards as their arguments, which is so convenient of them, honestly, we love an inclusive queen π
and you can also use them in a pipe! if either program finds its input redirected, it will process stdin and place the output on stdout. main character energy, truly π«Ά
β¨ OPTIONS β¨
here come the flags, bestie. memorize them, love them, don't get them confused π
-bβ make a backup of the original file. the original file gets a.bakextension appended to the original filename, and it will silently replace any existing file of that name. for example, a file called "filename.ext" becomes "filename.ext.bak", replacing any existing file having the name "filename.ext.bak".
β οΈ important: the program behaves differently if it is compiled for DOS (as compared to being compiled for Windows, Linux, Mac OS X or other systems). in view of the filename restrictions present on DOS, the DOS executable will strip the original file extension, if any, from the file before appending the .bak extension. for example, "filename.ext" becomes "filename.bak". so like, watch out for that π
-dβ convert from DOS to Unix. this forces the program to convert the file in a particular direction. by default, if the program is namedfromdosordos2unix, it will assume that the input file is in a DOS format and convert it to a Unix format. if the program is namedtodosorunix2dos, it will assume that the input file is in a Unix format and convert it to a DOS format. using the-doption forces the program to convert from a DOS format to a Unix format regardless of how the program is named. likewise, using the-uoption forces the program to convert from a Unix format to a DOS format regardless of the name of the program. it's giving "identity crisis, but make it a command-line flag" β¨-eβ abort processing on any error in any file. normally, the program will simply skip to process the next file on the command line when it encounters any errors. this option causes it to abort on errors. strict queen behavior π-fβ force: convert even if the file is not writeable (read-only). by default, if the program finds that the file does not have write permission, it will not process that file. this option forces the conversion even if the file is read-only. consent revoked? don't care, converting anyway π-hβ display a short help screen on the program usage and quit. your lil emergency cheat sheet π-l<logfile>β log error messages to<logfile>.
β οΈ note that if your command line has an error, such as when you specify an unknown option, the error message for the command line option error will be issued to stderr instead and not logged. so the log is not catching everything, bestie, don't be fooled π
-oβ overwrite the original file (no backup). this is the default. bold, fearless, no regrets π₯-pβ preserve file ownership and time on Unix-type systems (like Linux). on Windows and MSDOS, it only preserves the file time.
β οΈ note that on many Unix-type systems, including Linux, the file ownership will only be preserved if the program is run as root, otherwise it will just set the file time and silently fail the change of file ownership. on such systems, if you want a warning message when the file ownership cannot be changed, use -v (the verbose flag) as well. silent failure is the villain of this whole page fr fr π
-uβ convert from Unix to DOS. see the-doption above for more information π-vβ verbose. tell me everything, I want the drama π£οΈ-Vβ show version message and quit. (capital V, bestie, lowercase-vis a whole different thing, do not mix them up π)
β¨ EXIT CODE β¨
tofrodos terminates with an exit code of 0 on success and 1 on error. simple. clean. iconic β¨
if the program is invoked with multiple files on the command line, the default behaviour is to skip to the next file in the list if an error is encountered with any file. in such a case, the exit code returned will be the status of the last file processed (ie, 0 on success, 1 on failure).
if this is not desirable, use the -e option, which will force the program to abort immediately with the appropriate exit code on encountering any error. no skipping, no mercy π
β¨ AUTHOR β¨
the program and its documentation are copyrighted (c) 1996-2024 by Christopher Heng. All rights reserved. they are distributed under the terms of the GNU General Public License Version 2. π
the latest version of tofrodos can be obtained from http://www.thefreecountry.com/tofrodos/index.shtml π
and that's the whole page, bestie π go forth and fix those line endings, you absolute legend π¦β¨
Version 1.8.3 Β· 2024 Β· tofrodos(1) β mwah, no notes, periodt π π
π¦ where this page comes from
- ubuntu resolute: tofrodos 1.8.3+ds-1 Β· GPL-2.0-only
- ubuntu stonking: tofrodos 1.8.3+ds-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms