Difference between revisions of "Basic Linux Command Line for Builders"
m (add introduction) |
m (→listing, linking, removing, tab-completion:: formatting fixes) |
||
Line 8: | Line 8: | ||
If you're on a [[FreekBox]], you can open an xterminal by clicking on the button on the taskbar that looks like a monitor with a black screen. | If you're on a [[FreekBox]], you can open an xterminal by clicking on the button on the taskbar that looks like a monitor with a black screen. | ||
− | ==listing, linking, removing, tab | + | ==listing, linking, removing, tab completion:== |
In this section, students learn that they are located in the file system, that you need to hit enter to make the command run, that the way the command runs can be modified with flags, and how to use tab completion. | In this section, students learn that they are located in the file system, that you need to hit enter to make the command run, that the way the command runs can be modified with flags, and how to use tab completion. | ||
− | * type <code>[[ls]]</code> and hit enter. (list files) | + | * type <code>[[ls]]</code> and hit enter. (list files in the current directory) |
* <code>ls -l</code> (and hit enter... the long listing, point out time/date info) | * <code>ls -l</code> (and hit enter... the long listing, point out time/date info) | ||
− | * <code>ls -a</code> (shows all files, note that most begin with) | + | * <code>ls -a</code> (shows all files, note that most begin with .) |
* <code>ls -al</code> (shows all files the long way) | * <code>ls -al</code> (shows all files the long way) | ||
− | * <code>ls</code> ( | + | * <code>ls</code> (point out the Desktop directory again) |
* <code>ls D</code> and hit tab, and hit enter. (note how it finished out the rest of the word Desktop) | * <code>ls D</code> and hit tab, and hit enter. (note how it finished out the rest of the word Desktop) | ||
* <code>[[ln]] -s D<tab> yourname</code> | * <code>[[ln]] -s D<tab> yourname</code> | ||
* <code>ls -l</code> (note that yourname points to Desktop) | * <code>ls -l</code> (note that yourname points to Desktop) | ||
− | + | Note: periodically remind them about [[tab completion]] if they're not picking it up- it's a real arthritis-saver. | |
− | * ls D<tab> | + | * <code>ls D<tab></code> |
− | * ls yourname (note that it's actually the same files as in Desktop) | + | * <code>ls yourname</code> (note that it's actually the same files as in Desktop) |
− | * [[rm]] yourname | + | * <code>[[rm]] yourname</code> |
− | * ls (note that it removed yourname) | + | * <code>ls</code> (note that it removed yourname) |
==more tab-completion, text editors, modules file:== | ==more tab-completion, text editors, modules file:== |
Revision as of 13:28, 5 August 2005
- The purpose of this class is to teach builders-to-be real basic stuff about using the command line in linux so when we say "ok, now go to dev" you know what to type. This is written as a script that, with ingenuity, can be either a teacher's guide or a self-guided lesson.
to begin the class
This assumes you're at a terminal in the Free Geek classroom.
- log in, close the web browser.
- open an xterminal session,
ctrl-alt-t
(if the text is too small,ctrl +
should make the font bigger) - make the window larger, using either F10 or the maximize button.
If you're on a FreekBox, you can open an xterminal by clicking on the button on the taskbar that looks like a monitor with a black screen.
listing, linking, removing, tab completion:
In this section, students learn that they are located in the file system, that you need to hit enter to make the command run, that the way the command runs can be modified with flags, and how to use tab completion.
- type
ls
and hit enter. (list files in the current directory) ls -l
(and hit enter... the long listing, point out time/date info)ls -a
(shows all files, note that most begin with .)ls -al
(shows all files the long way)ls
(point out the Desktop directory again)ls D
and hit tab, and hit enter. (note how it finished out the rest of the word Desktop)ln -s D<tab> yourname
ls -l
(note that yourname points to Desktop)
Note: periodically remind them about tab completion if they're not picking it up- it's a real arthritis-saver.
ls D<tab>
ls yourname
(note that it's actually the same files as in Desktop)rm yourname
ls
(note that it removed yourname)
more tab-completion, text editors, modules file:
now we're going to use a text editor, which is basically like a very simple word processor- no bold, underlining or italics- just plain old text. (in this example i use nano, since that's what most build instructors end up teaching. mcedit is another text editor that would work)
- nano /etc/m hit tab twice. (note all the possible completions)
- nano /etc/mo<tab><tab> (note the shorter list)
- nano /etc/mod<tab><tab> (note the shorter list)
- nano /etc/modul<tab> (note how it completed it out to modules)
- nano /etc/modules
this file basically contains certain hardware modules(or in windows terms "drivers") to load when the computer starts up. in build, we're usually looking for 3c509, eexpress or ne. use the arrow keys to move the cursor to the bottom of the screen, and type in whatever you want to say....
- ctrl-o to save it. in the "File Name to write: " section near the bottom, it should say "/etc/modules". hit enter to save it. (note, they get a permission denied message, because they are not root)
- try again: ctrl-o, and change "/etc/modules" to "modules"
- ctrl-x to exit.
- ls (note the presence of the modules file)
- nano modules (note that your changes were saved there)
- nano /etc/mod<tab><tab>
system configuration via tab-completion:
- ls<tab><tab>
- lsm<tab> (lsmod: list modules. usually we use this to look for 3c509, eexpress or ne modules)
- ls<tab><tab>
- lspc<tab> (lspci: lists pci devices. look for VGA for video card information)
final check-in:
do they seem to understand the concept of typical command syntax: command <option flags> arguments
"what to do, how to do it, and what to do it to"
any other questions?
==networking== (*optional* if people seem *energetic* and want to learn more- not to be done if people seem bored or tired):
- ping cragg (we're pinging the server named cragg, which is the server used in the build area)
- ctrl-c to quit
- ifconfig (note eth0 has an "inet address")
- ifconfig -a (note eth2 does not have an "inet address" which means it's not active, but available to be configured)
other extras- dmesg, grep, piping:
- dmesg
- dmesg | less
- dmesg | grep eth