Difference between revisions of "MS-DOS to Linux commands"

From Tech-Wiki
Jump to: navigation, search
(Created page with "Category:Linux Many Linux commands typed at a shell prompt are similar to the commands you would type in MS-DOS. In fact, some commands are identical. {| class="wikitable...")
 
 
(22 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Command's Purpose !! MS-DOS !! Linux !! Basic Linux Example
+
! Command's Purpose !! MS-DOS !! Linux !! Example
 
|-
 
|-
| Copies files || copy || cp || cp thisfile.txt /home/thisdirectory
+
| Lists files || dir || ls || ls -la
 
|-
 
|-
| Moves files || move || mv || mv thisfile.txt /home/thisdirectory
+
| Copies files || copy || cp || cp file.txt /home/directory
 
|-
 
|-
| Lists files || dir || ls || ls
+
| Moves files || move || mv || mv file.txt /home/directory
 
|-
 
|-
| Clears screen || cls || clear || clear
+
| Renames a file || ren || mv || mv thisfile.txt thatfile.txt
 
|-
 
|-
| Closes prompt window || exit || exit || exit
+
| Deletes files || del || rm || rm file.txt
 
|-
 
|-
| Displays or sets date || date || date || date
+
| Deletes folders || rd || rm -rf || rm -rf /home/directory
 
|-
 
|-
| Deletes files || del || rm || rm thisfile.txt
+
| Changes directories with a relative path || cd .. || cd .. || cd ..
 
|-
 
|-
| "Echoes" output on the screen || echo || echo || echo this message
+
| Changes directories with a specified path (absolute path) || cd pathname || cd pathname || cd /home/directory
 
|-
 
|-
| Edits files with simple text editor || edit || pico || pico thisfile.txt
+
| Creates a directory || md || mkdir || mkdir directory
 +
|-
 +
| Shows your location in the file system || cd || pwd || pwd
 +
|-
 +
| Shows contents of a file || type || cat || cat file.txt
 +
|-
 +
| Finds a string in a file || find || grep || grep abc file.txt
 
|-
 
|-
 
| Compares the contents of files || fc || diff || diff file1 file2
 
| Compares the contents of files || fc || diff || diff file1 file2
 
|-
 
|-
| Finds a string of text in a file || find || grep || grep this word or phrase thisfile.txt
+
| Screens through a file || more || less || less file.txt
 
|-
 
|-
| Formats a floppy || format a: (if floppy's in A:) || mke2fs (or mformat) || /sbin/mke2fs /dev/fd0 (/dev/fd0 is the Linux equivalent of A:)
+
| Clears screen || cls || clear || clear
 
|-
 
|-
| Displays command help || command /? || man || man command
+
| Closes prompt window || exit || exit || exit
 
|-
 
|-
| Creates a directory || mkdir || mkdir || mkdir directory
+
| Displays or sets date || date || date || date
 
|-
 
|-
| Screens through a file || more || less || less thisfile.txt
+
| Displays the time || time || date || date
 
|-
 
|-
| Renames a file || ren || mv || mv thisfile.txt thatfile.txt
+
| "Echoes" output on the screen || echo || echo || echo this message
 
|-
 
|-
| Shows your location in the file system || chdir || pwd || pwd
+
| Edits files with simple text editor || edit || pico || pico file.txt
 
|-
 
|-
| Changes directories with a specified path (absolute path) || cd pathname || cd pathname || cd /directory/directory
+
| Formats a thumbdrive || format D: || mke2fs (or mformat) || /sbin/mke2fs /dev/usb0
 
|-
 
|-
| Changes directories with a relative path || cd .. || cd .. || cd ..
+
| Compress files || arj || tar/gzip || tar zcvf /home/directory
 
|-
 
|-
| Displays the time || time || date || date
+
| Displays command help || command /? || command --help || ls --help (or man ls)
 +
|-
 +
| Shows amount of RAM and use || mem || free || free
 +
|-
 +
| Ping a host || ping || ping || ping 8.8.8.8
 +
|-
 +
| Shows network connections || netstat || netstat || netstat -na
 
|-
 
|-
| Shows amount of RAM and use || mem || free || procinfo
+
| Shows IP address || ipconfig || ifconfig || ifconfig
 
|}
 
|}
 +
 +
Additional essential Linux commands, with no equivalent in MS-DOS are listed below:
 +
 +
df: Display disk space usage
 +
find: Search for files and directories within a directory hierarchy
 +
tail: Display the last lines of log files
 +
chmod: Change file permissions
 +
chown: Change file owner and group
 +
sudo/su: Execute a command as the superuser
 +
apt-get/yum/dnf: Package management commands for installing packages
 +
ps: Display information about active processes
 +
kill: Terminate processes
 +
crontab: Schedule tasks
 +
 +
Useful equivalencies to be aware of:
 +
autoexec.bat: /etc/rc.local
 +
Pipe <nowiki>|</nowiki> works the same: cat file.txt <nowiki>|</nowiki> grep abc
 +
C:\Users: /home
 +
Registry: /etc
 +
DLLs: /lib

Latest revision as of 20:33, 24 March 2024

Many Linux commands typed at a shell prompt are similar to the commands you would type in MS-DOS. In fact, some commands are identical.

Command's Purpose MS-DOS Linux Example
Lists files dir ls ls -la
Copies files copy cp cp file.txt /home/directory
Moves files move mv mv file.txt /home/directory
Renames a file ren mv mv thisfile.txt thatfile.txt
Deletes files del rm rm file.txt
Deletes folders rd rm -rf rm -rf /home/directory
Changes directories with a relative path cd .. cd .. cd ..
Changes directories with a specified path (absolute path) cd pathname cd pathname cd /home/directory
Creates a directory md mkdir mkdir directory
Shows your location in the file system cd pwd pwd
Shows contents of a file type cat cat file.txt
Finds a string in a file find grep grep abc file.txt
Compares the contents of files fc diff diff file1 file2
Screens through a file more less less file.txt
Clears screen cls clear clear
Closes prompt window exit exit exit
Displays or sets date date date date
Displays the time time date date
"Echoes" output on the screen echo echo echo this message
Edits files with simple text editor edit pico pico file.txt
Formats a thumbdrive format D: mke2fs (or mformat) /sbin/mke2fs /dev/usb0
Compress files arj tar/gzip tar zcvf /home/directory
Displays command help command /? command --help ls --help (or man ls)
Shows amount of RAM and use mem free free
Ping a host ping ping ping 8.8.8.8
Shows network connections netstat netstat netstat -na
Shows IP address ipconfig ifconfig ifconfig

Additional essential Linux commands, with no equivalent in MS-DOS are listed below:

df: Display disk space usage
find: Search for files and directories within a directory hierarchy
tail: Display the last lines of log files
chmod: Change file permissions
chown: Change file owner and group
sudo/su: Execute a command as the superuser
apt-get/yum/dnf: Package management commands for installing packages
ps: Display information about active processes
kill: Terminate processes
crontab: Schedule tasks

Useful equivalencies to be aware of:

autoexec.bat: /etc/rc.local
Pipe | works the same: cat file.txt | grep abc
C:\Users: /home
Registry: /etc
DLLs: /lib