Difference between revisions of "MS-DOS to Linux commands"
From Tech-Wiki
Line 6: | Line 6: | ||
! Command's Purpose !! MS-DOS !! Linux !! Example | ! Command's Purpose !! MS-DOS !! Linux !! Example | ||
|- | |- | ||
− | | Copies files || copy || cp || cp thisfile.txt /home/ | + | | Copies files || copy || cp || cp thisfile.txt /home/directory |
|- | |- | ||
− | | Moves files || move || mv || mv thisfile.txt /home/ | + | | Moves files || move || mv || mv thisfile.txt /home/directory |
|- | |- | ||
| Renames a file || ren || mv || mv thisfile.txt thatfile.txt | | Renames a file || ren || mv || mv thisfile.txt thatfile.txt | ||
Line 16: | Line 16: | ||
| Changes directories with a relative path || cd .. || cd .. || cd .. | | Changes directories with a relative path || cd .. || cd .. || cd .. | ||
|- | |- | ||
− | | Changes directories with a specified path (absolute path) || cd pathname || cd pathname || cd / | + | | Changes directories with a specified path (absolute path) || cd pathname || cd pathname || cd /home/directory |
|- | |- | ||
| Creates a directory || mkdir || mkdir || mkdir directory | | Creates a directory || mkdir || mkdir || mkdir directory | ||
Line 22: | Line 22: | ||
| Shows your location in the file system || chdir || pwd || pwd | | Shows your location in the file system || chdir || pwd || pwd | ||
|- | |- | ||
− | | Shows contents of a file || type || cat || cat | + | | Shows contents of a file || type || cat || cat file.txt |
|- | |- | ||
− | | Screens through a file || more || less || less | + | | Screens through a file || more || less || less file.txt |
|- | |- | ||
| Filter contents of a file || find || grep || cat thisfile.txt <nowiki>|</nowiki> grep abc | | Filter contents of a file || find || grep || cat thisfile.txt <nowiki>|</nowiki> grep abc | ||
Line 40: | Line 40: | ||
| "Echoes" output on the screen || echo || echo || echo this message | | "Echoes" output on the screen || echo || echo || echo this message | ||
|- | |- | ||
− | | Edits files with simple text editor || edit || pico || pico | + | | Edits files with simple text editor || edit || pico || pico 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 | + | | Finds a string of text in a file || find || grep || grep this word or phrase file.txt |
|- | |- | ||
− | | Formats a thumbdrive|| format D: || mke2fs (or mformat) || /sbin/mke2fs /dev/usb0 | + | | 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) | | Displays command help || command /? || command --help || ls --help (or man ls) |
Revision as of 01:52, 21 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 |
---|---|---|---|
Copies files | copy | cp | cp thisfile.txt /home/directory |
Moves files | move | mv | mv thisfile.txt /home/directory |
Renames a file | ren | mv | mv thisfile.txt thatfile.txt |
Lists files | dir | ls | ls |
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 | mkdir | mkdir | mkdir directory |
Shows your location in the file system | chdir | pwd | pwd |
Shows contents of a file | type | cat | cat file.txt |
Screens through a file | more | less | less file.txt |
Filter contents of a file | find | grep | cat thisfile.txt | grep abc |
Clears screen | cls | clear | clear |
Closes prompt window | exit | exit | exit |
Displays or sets date | date | date | date |
Displays the time | time | date | date |
Deletes files | del | rm | rm thisfile.txt |
"Echoes" output on the screen | echo | echo | echo this message |
Edits files with simple text editor | edit | pico | pico file.txt |
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 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 | procinfo |
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 chmod: Change file permissions chown: Change file owner and group sudo: Execute a command as the superuser or another user apt-get/yum/dnf: Package management commands for installing packages ps: Display information about active processes kill: Terminate processes crontab: Schedule tasks