Google

Command line

Command line

Contact:[email protected]

Taking Command of Your Linux Box
Understanding the Command-Line Interface

By Woody Hughes

If you're new to Linux, then you'll know what we're talking about when we
say the "little OS that could" has a pretty serious learning curve. It's bad
enough when you encounter installation routines trickier than Dick Nixon
himself, but navigating around Linux also involves the wacky world of a
command-line interface. If you're used to DOS, then Linux's command-line fun
will seem old hat. Windows fans however, may find the going no more fun than
an emergency appendectomy. That's where Maximum Linux comes in. We know
you're probably used to Windows, so we thought we'd write a little somethin'
to whet your typin' fingers, in the form of a nice DOS to Linux command
guide. Bolt down that keyboard and break out the Mountain Dew, because we're
taking a little adventure into the Linux command-line world!

When you turn the page, you'll find the ultimate resource for the Linux
beginner: A table neatly listing Linux command-line functions which closely
match those of their Windows, er, DOS, counterparts. And when you start to
get stuck and you're feeling kind of low, just rip the next couple of pages
out, and tape them to your forehead. You'll be glad you did.



NOTE: everything you see here is case sensitive!

WINDOWS/DOS  LINUX
CD�Changes directories.
Usage: cd windows\system cd�Changes directories.
Usage: cd /root/mydirectory
CLS�Clears screen.
Usage: cls clear�Clears screen.
Usage: clear
COPY�Copies one or more files to a destination you specify.
Usage: copy c:\foo.txt c:\windows\foo.cfg cp�Copies directories or files to
a destination you specify.
Usage: cp /root/foo.txt /foo.txt
cp -r (recursive)
DEFRAG�Optimizes disk performance by reorganizing the files on the disk.
Usage: defrag c:
Note: In Windows you would simply select this command in the Systems Tools
folder in your Start Menu. Linux, as a whole, does not have a defrag utility
like its Windows counterpart. Linux does, however, have a few commands that
will assist in debugging and/or repairing a system.
fsck�Checks and repairs the operating system. Generally used when the system
hasn't been properly unmounted during shutdown or reboot.
debugfs�A system debugger. Generally used to examine and change the ext2
filesystem of Linux.
DEL�Deletes files you specify.
Usage: del c:\windows\test.txt rm�Deletes directories and files.
Usage: rm foo.txt
DELTREE�Deletes a directory and its files and subdirectories.
Usage: deltree c:\temp rm�Deletes directories and files. Usage: rm -rf
/root/test
Say What? -rf = Forcibly deletes all subdirectories in a directory.
DIR�Displays the contents of a directory.
Usage: dir ls�Displays the contents of a directory.
Usage: ls /
ls -l /root
Say What? -l = Displays everything in long format
DISKCOPY�Copies the entire contents of one floppy disk to another floppy
disk. It writes over the existing contents of the destination disk as it
copies the new information onto it.
Usage: diskcopy a: a: dd - Copies files and coverts and formats them
according to options given.
Usage: dd if=/floppyimage of=/dev/fd0
ECHO�Displays text as standard output. Also used to "paste" a string within
a file while rewriting the file contents with that string.
Usage: echo My cat is big
echo Kitty > foo.txt echo�Acts the same as Windows in that it displays text
as standard output.
Usage: echo pot pie > /usr/bin/pie
EDIT�Executes the MS-DOS text editor.
Usage: edit foo.txt Linux has 2 common editors that most people use: vi and
pico. They all have the same functionality as most other text editors, but
vi is a little more advanced. Vi is also the oldest of the two.
vi�Unix text editor
pico�Linux text editor
EXIT�Exits an MS-DOS emulation window. Used in DOS 6.22 to "exit" the
command interpreter and returns to the controlling program, if one actually
existed.
Usage: exit exit�Used in Linux to exit a shell.
Usage: exit
FIND�Searches for a specific string of variables in a file or files.
Usage: find "gorilla" c:\windows\zoo.txt Are 'ya looking for something
special in that little document that Daisy wrote for ya? Check it out:
Usage: grep gorilla /windows/zoo.txt
FORMAT�Formats a drive, erasing all data that resides on it.
Usage: format a:  mkfs�Formats a partition and builds a filesystem.
Usage: mkfs -t msdos -c -v /newdosdrive
Say What? The -t syntax specifies what the filesystem is to be. The -c
syntax tells mkfs to check the drive for bad blocks. The -v syntax,
produces, you guessed it, verbose output.
HELP�Starts DOS help. You can also access help in Windows by going to your
Start Menu and selecting "Help".
Usage: help help�Shows commands which are defined internally within Linux.
Usage: help
help alias
MEM�Displays the amount of used and free memory.
Usage: mem  top�Displays process status. Also shows memory used and
available.
Usage: top
MKDIR�Creates a directory.
Usage: mkdir c:\dad
mkdir c:\test mkdir�Creates a directory.
Usage: mkdir /new
MORE�Displays one page at a time.
Usage: find "a" c:\windows\pstrip.txt | more more�Displays one page at a
time.
Usage: more /var/log/secure
MOVE�Moves directories and/or files to a location you specify. Renames files
and directories.
Usage: move foo.txt c:\windows\system move c:\config.sys c:\config.bak
mv�Acts much like its Windows counterpart in that it moves or renames files
and/or directories.
Usage: mv foot.txt /root/foot.txt
MSD�Old DOS command that provided information about your computer.
Usage: msd Sorry folks, this one doesn't exist. Although, some people think
that 'dmesg' is the equivalent, it is not. dmesg is used to examine the
kernel ring buffer, and is often used to read bootup messages in Linux.
PRINT�Prints a text file. (Old)
Usage: print foo.txt lpr - Linux print command.
Usage: lpr foo.txt
RMDIR�Removes directories. Also known as RD.
Usage: rmdir c:\temp (See rm)
RENAME�Renames a file or directory or files and directories.
Usage: rename config.sys config.bak ren config.sys config.bak (See mv)
SCANDISK�A disk analysis and repair tool. Checks drives for any errors and
fixes them. Also accessed via the System Tools folder in your Start Menu in
Windows.
Usage: scandisk c: (See fsck)
UNDELETE�Undeletes that which has been deleted. Essentially replaced by the
Recycle Bin in Windows.
Usage: undelete /? There isn't one. Be careful out there.
VER�Displays the MSDOS or Windows version.
Usage: ver uname�Prints system information.
Usage: uname -a
XCOPY�A utility to recursively copy directories and/or files.
Usage: xcopy c:\windows d:\ (See cp)
PKZIP�This utility will compress files and/or directories into "zip" zip -
Compresses and decompresses files and/or directories
Usage: zip file.zip

That wasn't so difficult, was it? Maybe one of these days Windows will match
Linux in the functionality department...then again, maybe not. Regardless,
now that you've mastered the command-line interface, your co-workers will
regard you with awe, your boss will gleam with delight at your newfound
abilities, and your parental units will be as proud as punch. Hell, maybe
you'll get laid more, too. Or not. But hey, with the power of the penguin
behind you, anything is possible.


Back to the Index