![]() |
![]() |
Newbie's Linux Manual |
Command Tutorial #1: cd & ls |
by Laurence Hunter |
[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ] |
* In Linux enter: unzip nlm.zip |
Welcome to Super-DOS! |
That thing that looks like MS-DOS is a Linux terminal (sometimes called a "console"). It's here that all Linux commands are entered. If you're familiar with DOS, then get ready for Super-DOS! |
About Paths |
Whenever I mention a path, I'm speaking about the route taken to get to a file or directory. (Don't confuse this with PATH which is an "environment variable" - discussed later.) One thing I should mention - to prevent confusion - is that drive letters don't exist in Linux. There is no A:, C: or D:, only the root directory (/), which contains everything else. You'll also notice that the backslash (\) is never used in Linux, only the forward-slash (/). |
Absolute And Relative Paths |
We'll be using a file later called fstab. The absolute path to this file is /etc/fstab or in plain English: "You'll find the fstab file in the etc directory which (like everything else) is in the root directory." A relative path means just that, relative to the current directory. You can always tell a relative path because it never starts with a /. If you were in /etc and wanted to move to the directory /etc/defaults then instead of entering the absolute path: cd /etc/defaults ...it's quicker just to enter the relative path: cd defaults Ok, now that you have some fundamental knowledge of paths, it's time to learn the two most important commands, cd and ls. |
cd - change directory |
Examples cd cd - cd .. cd /usr/docs cd reports |
ls - list [a directory] |
Examples ls ls -a Note To make a file or directory "hidden", begin its name with a ".". ls -l Note To combine the above two examples you would enter: ls -al ls --color +------------+---------------+ | grey | regular file | (often a text file) +------------+---------------+ | dark blue | directory | +------------+---------------+ | green | executable | +------------+---------------+ | light blue | symbolic link | +------------+---------------+ | yellow | socket | +------------+---------------+ | brown | FIFO | +------------+---------------+ ls | less Less Keys Down cursor = Down 1 line. Up cursor = Up 1 line. Spacebar = Down 1 screen. b = Back up 1 screen. q = Quit. h = Activate help screen. ls -l /usr | less ls > list.of.files ls >> list.of.files
|
[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ] |
* In Linux enter: unzip nlm.zip |
The Newbie's Linux Manual is reproduced on LinuxMall.com by permission. The Newbie's Linux Manual is written and maintained by Laurence Hunter. You can find much more of Laurence's work at his site: www.Linuxdot.org |
© 1999 Linuxdot.org | Manual's Copyright Terms