dos2unix and unix2dos commands Last Updated : 19 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Sometimes, you will need to move files between windows and unix systems. Window files use the same format as Dos, where the end of line is signified by two characters, Carriage Return or CR or \r followed by Line Feed or LF or \n. Unix files, on the other hand, use only Line Feed (\n). unix2dos is a tool to convert line breaks in a text file from Unix format (Line feed) to DOS format (carriage return + Line feed) and vice versa. dos2unix command : converts a DOS text file to UNIX format. Unix2dos command : converts a Unix text file to DOS format ExampleTask : Create a file in DOS or in notepad with following contentshello everybodywelcome to unixunix is easy now copy this file in unix /home/geeks directory $od –bc myfile.txt0000000 150 145 154 154 157 040 145 166 145 162 171 142 157 144 171 015 h e l l o e v e r y b o d y \r0000020 012 167 145 154 143 157 155 145 040 164 157 040 165 156 151 170 \n w e l c o m e t o u n i x0000040 015 012 165 156 151 170 040 151 163 040 145 141 163 171 015 012 \r \n u n i x i s e a s y \r \n0000060 The CR-LF combination is represented by the octal values 015-012 and the escape sequence \r\n. Note: The above output shows that this is a DOS format file. Now convert DOS file to UNIX format by using dos2unix command $dos2unix myfile.txt$od –bc myfile.txt Conversion of this file to UNIX is just a simple matter of removing the \r. We can also convert UNIX file to DOS format by using unix2dos command $unix2dos myfile.txt$od –bc myfile.txt After Conversion of this file to DOS, \r is added in DOS file. Comment More infoAdvertise with us S Sahil Rajput Improve Article Tags : Misc Linux-Unix linux-command Linux-system-commands Practice Tags : Misc Similar Reads declare command in Linux with Examples The built-in is a powerful built-in feature of the Bash shell. It allows users to declare and set attributes for variables and functions, enabling better control over their behavior. By understanding how to use declare, you can manage variables and functions more effectively in your shell scripts. T 2 min read depmod command in Linux with examples depmod(Dependency Modules) command is used to generate a list of dependency description of kernel modules and its associated map files. This analyzes the kernel modules in the directory /lib/modules/kernel-release and creates a "Makefile"-like dependency file named modules.dep based on the symbols p 7 min read df Command in Linux with Examples There might come a situation while using Linux when you want to know the amount of space consumed by a particular file system on your LINUX system or how much space is available on a particular file system. LINUX being command friendly provides a command line utility for this i.e. 'df' command that 9 min read How to Compare Files Line by Line in Linux | diff Command In the world of Linux, managing and comparing files is a common task for system administrators and developers alike. The ability to compare files line by line is crucial for identifying differences, debugging code, and ensuring the integrity of data. One powerful tool that facilitates this process i 9 min read diff3 command in Linux with examples diff3 command is used to compare the three files line by line. It internally uses the diff command to compare. When three files are compared then the following output may come which have their own meaning: ==== : It means all the files are different. ====1 : File 1 is different. ====2 : File 2 is di 3 min read dir command in Linux with examples The dir command in Linux is used to list the contents of a directory, providing an overview of the files and folders within it. How is the dir command different from ls?dir command differs from the ls command in the format of listing contents that is in default listing options. By default, dir comma 5 min read Dirname Command in Linux with Examples dirname is a command in Linux that is used to remove the trailing forward slashes "/" from the NAME and print the remaining portion. If the argument NAME does not contain the forward slash "/" then it simply prints dot ".". In other words, we can say that the 'dirname' command is a useful tool for e 3 min read dirs command in Linux with examples dirs command shell builtin is used to display the list of currently remembered directories. By default, it includes the directory you are currently in. A directory can get into the list via pushd command followed by the dir name and can be removed via popd command. Syntax: dirs [-clpv] [+N] [-N] It 1 min read enable and disable command in Linux Enables and disables are the built-in shell commands. enable command is used to start the printers or classes whereas the disable command is used to stop the printers or classes. Syntax For enable Command: enable [-a] [-dnps] [-f filename][name ...] Syntax For disable Command: disable [-c] [-W] [ -r 1 min read dmesg command in Linux for driver messages dmesg command also called âdriver messageâ or âdisplay messageâ is used to examine the kernel ring buffer and print the message buffer of the kernel. The output of this command contains the messages produced by the device drivers.Usage of dmesg:When the computer boots up, there are lot of messages(l 5 min read Like