Skip to content
GK24
GK NotesComputer AwarenessMS-DOS and Linux Commands

MS-DOS and Linux Commands: Internal, External and Shell

Exam notes on MS-DOS and Linux commands: internal and external DOS commands, the Linux shell, equivalent command pairs, file permissions and chmod numbers.

By · Published · 4 min read

MS-DOS and Linux Commands: Internal, External and Shell — GK24 title card
MS-DOS and Linux Commands: Internal, External and Shell — GK24 title card

MS-DOS and Linux are both operating systems worked through typed commands, and computer awareness papers test them together because the same job carries a different command name in each. MS-DOS, short for Microsoft Disk Operating System, was released in 1981 for the IBM Personal Computer. Microsoft had bought a system called 86-DOS, written by Tim Paterson of Seattle Computer Products, and sold it to IBM as PC-DOS. It is a single-user, single-tasking, character user interface system whose command interpreter is the file COMMAND.COM. Linux began in 1991, when Linus Torvalds, then a student at the University of Helsinki, wrote a free kernel and released it under the GNU General Public Licence; joined to the GNU tools that Richard Stallman had begun in 1983, it became the multi-user, multitasking, open source family of systems used today. Unix itself, the ancestor of Linux, was written at Bell Laboratories in 1969 by Ken Thompson and Dennis Ritchie.

Internal and external commands in MS-DOS

An internal command is built into COMMAND.COM and loads into memory with the system, so it works even when no program file is present. An external command is a separate executable file with a COM, EXE or BAT extension and must be available on the disk or in the path.

  • Internal: DIR, CD, MD, RD, COPY, DEL, REN, TYPE, CLS, DATE, TIME, VER, VOL, PATH, PROMPT, EXIT.
  • External: FORMAT, CHKDSK, XCOPY, DISKCOPY, ATTRIB, EDIT, TREE, SORT, MORE, LABEL, DELTREE, FDISK, SCANDISK, PRINT.

MS-DOS allows a file name of up to eight characters with an extension of up to three, the rule called the 8.3 convention, and uses the asterisk as a wildcard for any group of characters and the question mark for exactly one character. CONFIG.SYS loads device drivers and AUTOEXEC.BAT runs commands automatically at start up; a file of commands saved with the BAT extension is a batch file.

The Linux shell

In Linux the program that reads commands is the shell. Bash, the Bourne Again Shell, is the common default; sh, csh, ksh and zsh are others. Linux is case sensitive, so LS is not ls, and it uses the forward slash as the separator in a path while MS-DOS uses the backslash. Everything hangs from a single root directory written as a slash, with /home for users, /etc for configuration files, /bin for essential programs, /var for logs and /dev for devices. The pipe symbol sends the output of one command into another, the greater-than sign redirects output into a file and two of them append to it.

Equivalent commands, side by side

TaskMS-DOSLinux
List the contents of a directoryDIRls
Change directoryCDcd
Show the current directoryCD with no argumentpwd
Create a directoryMD or MKDIRmkdir
Remove an empty directoryRDrmdir
Copy a fileCOPY, XCOPYcp
Rename or move a fileREN, MOVEmv
Delete a fileDEL or ERASErm
Display the contents of a fileTYPEcat
Clear the screenCLSclear
Find text in a fileFINDgrep
Compare two filesFCdiff
Get help on a commandHELPman
Show the versionVERuname -r
Change file attributes or permissionsATTRIBchmod
Show free space on the diskCHKDSKdf

Linux commands worth knowing by name

  • Files and directories: ls, cd, pwd, mkdir, rmdir, rm, cp, mv, touch to create an empty file, cat, more and less to read, head and tail for the first and last lines, wc to count lines and words, find to search for files, ln to make a link.
  • System and users: who, whoami, uname, uptime, date, cal, passwd, su to switch user, sudo to run one command as the administrator, ps to list processes, top to watch them, kill to end one, free for memory and df and du for disk space.
  • Text and packages: grep, sort, uniq, diff, echo, nano and vi as editors, tar to archive, gzip to compress, apt and yum to install software, history to see earlier commands, man for the manual.

File permissions and chmod

Every Linux file carries three sets of permissions, for the owner, the group and others, each made of read, write and execute. In the numeric form read is 4, write is 2 and execute is 1, so the three digits of a chmod command are simple sums.

  • chmod 777 gives read, write and execute to the owner, the group and others.
  • chmod 755 gives the owner all three and the group and others read and execute, the usual setting for a program.
  • chmod 644 gives the owner read and write and everyone else read only, the usual setting for a document.
  • The command chown changes the owner of a file and chgrp changes its group.

Points of difference

  • MS-DOS is single-user and single-tasking; Linux is multi-user and multitasking.
  • MS-DOS is proprietary and no longer developed; Linux is free and open source under the GNU General Public Licence.
  • Linux is case sensitive and MS-DOS is not; Linux paths use the forward slash and DOS the backslash.
  • Linux stores a password file and user accounts and needs a login; plain MS-DOS has no login at all.
  • The Linux mascot is the penguin named Tux, and Ubuntu, Fedora, Debian, Red Hat and Mint are well known distributions.

Exam Point of View

Three question types cover almost every paper. First, name the internal or the external command: DIR, CD, COPY, DEL, REN, TYPE, CLS and VER are internal, while FORMAT, CHKDSK, XCOPY, ATTRIB, EDIT and TREE are external. Second, match a DOS command with its Linux equivalent, where TYPE and cat, CLS and clear, FIND and grep, FC and diff, and RD and rmdir are the favourite pairs. Third, read a chmod number, usually 777, 755 or 644, by splitting it into read as 4, write as 2 and execute as 1. Smaller questions ask who wrote the Linux kernel and in which year, which company released MS-DOS and when, what the 8.3 rule means, what the asterisk and the question mark stand for, and which symbol is the pipe. The common traps are calling FORMAT internal, taking pwd as a DOS command, forgetting that Linux is case sensitive, and confusing rm with rmdir, since rmdir removes only an empty directory.

Important Facts

MS-DOS release1981, Microsoft, for the IBM Personal Computer
DOS command interpreterCOMMAND.COM
Startup filesCONFIG.SYS for drivers, AUTOEXEC.BAT for commands at start up
File name rule8.3 convention: eight character name, three character extension
DOS wildcardsAsterisk for any group of characters, question mark for exactly one
UnixBell Laboratories, 1969, Ken Thompson and Dennis Ritchie
Linux kernelLinus Torvalds, 1991, University of Helsinki
GNU projectRichard Stallman, 1983; Linux is released under the GNU GPL
Default Linux shellBash, the Bourne Again Shell
Permission valuesRead 4, write 2, execute 1; chmod 777 is full permission for owner, group and others
Path separatorBackslash in MS-DOS, forward slash in Linux
Linux mascotTux, the penguin
Linux distributionsUbuntu, Debian, Fedora, Red Hat, Mint

Practice MCQs on this topic

Q1.Computer AwarenessEasy

Which of the following is an internal command of MS-DOS?

  1. A.FORMAT
  2. B.CHKDSK
  3. C.DIR
  4. D.XCOPY
Show answer
Correct answer: C. DIR

Explanation

The correct answer is C, DIR. An internal command is written into the command interpreter COMMAND.COM and is loaded into memory along with the operating system, so it can be used even when no separate program file is present on the disk. DIR, which lists the files and sub-directories of a directory, belongs to this group along with CD, MD, RD, COPY, DEL, REN, TYPE, CLS, DATE, TIME, VER, VOL, PATH and PROMPT. Option A is wrong because FORMAT, which prepares a disk by creating tracks and sectors and writing the file allocation table, exists as its own executable file and is therefore external. Option B is wrong because CHKDSK, which checks a disk for errors and reports free space, is also a separate executable. Option D is wrong because XCOPY, the extended copy command that can copy whole directory trees, is likewise an external command. Papers usually ask this question by listing three external commands and one internal one.

Q2.Computer AwarenessEasy

Which Linux command displays the full path of the directory you are currently working in?

  1. A.ls
  2. B.pwd
  3. C.cd
  4. D.path
Show answer
Correct answer: B. pwd

Explanation

The correct answer is B, pwd. The name stands for print working directory, and the command prints the complete path of the directory in which the shell is placed at that moment, counted from the root directory written as a single forward slash. Option A is wrong because ls lists the names of the files and sub-directories inside a directory but does not say where that directory sits in the tree. Option C is wrong because cd changes the directory; in Linux, typing cd with no argument takes the user to the home directory rather than printing the current path, which is a point of difference from MS-DOS, where CD alone displays the current directory. Option D is wrong because path is not a Linux command of this kind; PATH in MS-DOS and the PATH variable in Linux hold the list of directories searched for programs, which is a different idea altogether.

Q3.Computer AwarenessEasy

The MS-DOS command TYPE, which displays the contents of a text file on the screen, corresponds to which Linux command?

  1. A.cat
  2. B.touch
  3. C.echo
  4. D.grep
Show answer
Correct answer: A. cat

Explanation

The correct answer is A, cat. The cat command, short for concatenate, writes the contents of one or more files to the standard output, which is normally the screen, and so does the work of TYPE in MS-DOS. It can also join files together when more than one name is given. Option B is wrong because touch creates an empty file if the name does not exist and otherwise only updates the time stamp of the file; it never shows the contents. Option C is wrong because echo prints the text or the value of a variable written after it, not the contents of a file. Option D is wrong because grep searches for a pattern and prints only the lines that match it, which makes it the equivalent of the DOS command FIND rather than of TYPE. For long files, less and more are used instead of cat so that the text can be read one screen at a time.

Q4.Computer AwarenessEasy

Who developed the first Linux kernel, and in which year was it released?

  1. A.Dennis Ritchie, 1972
  2. B.Richard Stallman, 1983
  3. C.Linus Torvalds, 1991
  4. D.Ken Thompson, 1969
Show answer
Correct answer: C. Linus Torvalds, 1991

Explanation

The correct answer is C, Linus Torvalds, 1991. Torvalds, then a student at the University of Helsinki in Finland, wrote a free kernel for personal computers and released it in 1991 under the GNU General Public Licence, which allowed anyone to study, change and redistribute it. Option A is wrong because Dennis Ritchie is remembered for the C language, which he created at Bell Laboratories in the early nineteen seventies, and for his work on Unix. Option B is wrong because Richard Stallman began the GNU project in 1983 and wrote the General Public Licence; the GNU tools wrapped around the Linux kernel make the complete system, which is why it is also called GNU/Linux. Option D is wrong because Ken Thompson, with Dennis Ritchie, developed Unix at Bell Laboratories in 1969, the ancestor that Linux was written to resemble.

Q5.Computer AwarenessMedium

In Linux, the command chmod 777 on a file gives which set of permissions?

  1. A.Read and write to the owner only
  2. B.Read, write and execute to the owner, the group and others
  3. C.Read and execute to everyone, write to nobody
  4. D.Execute to the owner, read to the group, nothing to others
Show answer
Correct answer: B. Read, write and execute to the owner, the group and others

Explanation

The correct answer is B. In the numeric form of chmod each of the three digits stands for one set of users, in the order owner, group and others, and each digit is the sum of read as 4, write as 2 and execute as 1. Since 4 plus 2 plus 1 is 7, the number 777 grants all three rights to all three sets, which is the widest permission a file can carry and is therefore avoided on shared systems. Option A is wrong because read and write for the owner alone is 600. Option C is wrong because read and execute for everyone with write for nobody is 555. Option D is wrong because such a mixture would be written as a different combination altogether, for example 140, and is not what 777 means. Two other numbers are worth remembering: 755 for programs and directories and 644 for ordinary documents.

Q6.Computer AwarenessMedium

In MS-DOS, which wildcard character stands for exactly one character in a file name?

  1. A.The asterisk
  2. B.The question mark
  3. C.The backslash
  4. D.The colon
Show answer
Correct answer: B. The question mark

Explanation

The correct answer is B, the question mark. A question mark in a file specification matches any single character in that position, so the command DIR FILE?.TXT lists FILE1.TXT and FILEA.TXT but not FILE12.TXT. Option A is wrong because the asterisk matches any group of characters, including none, which is why the pattern made of an asterisk, a dot and TXT selects every text file in a directory. Option C is wrong because the backslash is the separator between directory names in a DOS path and has nothing to do with matching. Option D is wrong because the colon follows a drive letter, as in the C drive written with a colon after it. The same two wildcards continue to work in the Windows command prompt and in Linux, where the shell expands them before the command runs.

Q7.Computer AwarenessMedium

Which Linux command is used to list the processes running on the system?

  1. A.ps
  2. B.df
  3. C.du
  4. D.ln
Show answer
Correct answer: A. ps

Explanation

The correct answer is A, ps. The command ps, short for process status, prints a list of processes with their process identification numbers, the terminal they belong to, the processor time used and the command that started each one. The related command top shows the same information refreshed continuously, and kill followed by a process identification number ends a process. Option B is wrong because df, for disk free, reports how much space is used and available on each mounted file system. Option C is wrong because du, for disk usage, reports how much space a particular directory and its contents occupy. Option D is wrong because ln creates a link to a file, either a hard link, which is another directory entry for the same data, or a symbolic link made with the option s, which merely points to the original path.

Q8.Computer AwarenessMedium

The MS-DOS rule that a file name may have up to eight characters with an extension of up to three is called

  1. A.The 3.8 rule
  2. B.The 8.3 convention
  3. C.The long file name convention
  4. D.The FAT32 convention
Show answer
Correct answer: B. The 8.3 convention

Explanation

The correct answer is B, the 8.3 convention. The name is read as eight dot three: up to eight characters for the name, a dot, and up to three for the extension, as in LETTER.TXT or AUTOEXEC.BAT, with spaces and certain punctuation marks not allowed. Option A is wrong because it simply reverses the two numbers; the name part is the longer one. Option C is wrong because long file names, which allow many more characters and spaces, arrived with Windows 95 and later systems, not with MS-DOS. Option D is wrong because FAT32 is a file system introduced later to handle larger disks and more clusters; a file system decides how data is laid out on the disk, while the 8.3 rule is about the form of the name. Questions on this point often pair the rule with the names of the two startup files, CONFIG.SYS and AUTOEXEC.BAT.

Q9.Computer AwarenessEasy

Which Linux command removes a directory only when it is empty?

  1. A.rm
  2. B.rmdir
  3. C.mv
  4. D.mkdir
Show answer
Correct answer: B. rmdir

Explanation

The correct answer is B, rmdir. The command rmdir deletes a directory only if nothing is left inside it and prints an error such as directory not empty otherwise, which makes it a safe way to clear away empty folders. Option A is wrong because rm deletes files, and with the recursive option it deletes a directory together with everything it contains, which is why it is treated with care on a live system. Option C is wrong because mv moves a file or a directory to another place and is also the way a file is renamed in Linux, the work done by both MOVE and REN in MS-DOS. Option D is wrong because mkdir creates a directory rather than removing one. The MS-DOS counterpart of rmdir is RD, and of rm is DEL, while DELTREE in MS-DOS does the work of a recursive rm.

Q10.Computer AwarenessHard

In the Linux shell, which symbol adds the output of a command to the end of an existing file without erasing its contents?

  1. A.A single greater-than sign
  2. B.Two greater-than signs
  3. C.The vertical bar
  4. D.A single less-than sign
Show answer
Correct answer: B. Two greater-than signs

Explanation

The correct answer is B, two greater-than signs. Writing a command followed by two greater-than signs and a file name appends the output to the end of that file and keeps whatever was already in it, which is how log files are built up. Option A is wrong because a single greater-than sign also redirects output to a file but truncates it first, so the earlier contents are lost; confusing the two is a common mistake and a favourite question. Option C is wrong because the vertical bar is the pipe, which hands the output of one command to another as its input, as when a long listing is passed to less for reading page by page. Option D is wrong because a single less-than sign redirects input, that is, it makes a command read from a file instead of from the keyboard. These three ideas, redirection, appending and piping, are the heart of working at the shell.

Q11.Computer AwarenessMedium

Which of the following statements about MS-DOS and Linux is correct?

  1. A.Both are case sensitive in command and file names
  2. B.MS-DOS is multi-user while Linux is single-user
  3. C.Linux is case sensitive and multi-user while MS-DOS is neither
  4. D.Both use the backslash as the separator in a path
Show answer
Correct answer: C. Linux is case sensitive and multi-user while MS-DOS is neither

Explanation

The correct answer is C. Linux treats upper and lower case as different, so a file named Report is not the same as report, and it is built as a multi-user, multitasking system in which several accounts can work at once with separate permissions and a login. MS-DOS ignores case and is a single-user, single-tasking system with no login at all in its plain form. Option A is wrong because MS-DOS is not case sensitive; DIR and dir do the same thing. Option B is wrong because it reverses the fact, since it is Linux that supports many users. Option D is wrong because the backslash is the DOS separator while Linux uses the forward slash, and in Linux the backslash instead marks an escape character. Two further differences are worth holding: MS-DOS is proprietary and discontinued, whereas Linux is free and open source under the GNU General Public Licence.

Frequently Asked Questions

What is the difference between an internal and an external command in MS-DOS?

An internal command is part of COMMAND.COM and is loaded into memory with the operating system, so it runs without any separate file; DIR, CD, COPY, DEL and TYPE are examples. An external command exists as its own COM, EXE or BAT file on the disk and runs only if that file can be found, as with FORMAT, CHKDSK, XCOPY and ATTRIB.

Which Linux command shows the directory you are working in?

The command pwd, short for print working directory, prints the full path of the current directory. In MS-DOS the same information is obtained by typing CD with no argument, which displays the current directory of the drive.

What does chmod 755 mean?

The three digits stand for the owner, the group and others, and each digit is the sum of read as 4, write as 2 and execute as 1. So 7 gives the owner read, write and execute, and each 5 gives the group and others read and execute but not write. It is the usual permission for a program or a directory.

Who developed Linux and in which year?

Linus Torvalds, then a student at the University of Helsinki, released the first Linux kernel in 1991 and placed it under the GNU General Public Licence. The surrounding tools came from the GNU project begun by Richard Stallman in 1983, which is why the full system is often called GNU/Linux.

What is the difference between rm and rmdir in Linux?

The command rmdir removes a directory only if it is empty, and reports an error otherwise. The command rm removes files, and with the recursive option it can remove a directory along with everything inside it, which is why it is used with care.

What is the 8.3 file naming rule of MS-DOS?

It means a file name may have up to eight characters followed by a dot and an extension of up to three characters, as in LETTER.TXT. Long file names came only with later versions of Windows, so questions on MS-DOS still expect the eight and three limit.

Sources

View all