Command line

Contact:http://www.packetnexus.com

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