News:

The miracle of Al-Isra' and Al-Mi^raj
(The night journey and the ascension of prophet Muhammad) On Rajab 27.

Main Menu

Linux Operating System

Started by The Tech, 05, 17

Previous topic - Next topic

The Tech

LINUX

Pronounced lee-nucks or lih-nucks. A freely-distributable open source operating system that runs on a number of hardware platforms. The Linux kernel was developed mainly by Linus Torvalds. Because it's free, and because it runs on many platforms, including PCs and Macintoshes, Linux has become an extremely popular alternative to proprietary operating systems.

UNIX?


Pronounced yoo-niks, a popular multi-user, multitasking operating system developed at Bell Labs in the early 1970s. Created by just a handful of programmers, UNIX was designed to be a small, flexible system used exclusively by programmers.

UNIX was one of the first operating systems to be written in a high-level programming language, namely C. This meant that it could be installed on virtually any computer for which a C compiler existed. This natural portability combined with its low price made it a popular choice among universities. (It was inexpensive because antitrust regulations prohibited Bell Labs from marketing it as a full-scale product.)

The Tech

Basic Linux and UNIX Commands


Getting Started
Here are some basic commands to get you started in the wonderful world of Linux and other UNIX variants. Near the bottom are commands dealing with tar/gzip/bzip2, compiling, and Linux RPM management. All UNIX and Linux commands are case sensitive.

ls
Shows you a list of directories.

infconfig
Shows the configuration.

cd
Change directory. This is the command you use to change into different directories. An example would be "cd /mnt" (minus the quotes, always minus the quotes) now you will be the /mnt dir.

mount
Mounts a filesystem. ex, "mount /dev/hda4 /mnt" mounts hard drive partition 4 in your /mnt directory.

cp
Copies files. eg, "cp SomeFile /home/momo/" copies a SomeFile into user momo's home directory.

mv
Move. Does the same as cp except moves the file instead of copying it. You also use the mv command to rename files/directories ex, "mv file1 SomeNewFilename" renames file1 to SomeNewFilename.

mkdir
Make Directory. ex, "mkdir /home/momo/new" creates a directory named new in momo's home directory. If you are currently in the directory you want to make the the new directory in you can just do "mkdir new" to make a directory named "new".

rm
Removes files and directories. ex, "rm file1". To use rm without a hassle you may want to use "rm -rf". This way you won't be prompted to confirm the removal of the file. You can not use rm to remove directories which are not empty unless you use an option telling rm to do otherwise, the -rf option works well for this. Use "rm -rf" carefully ;-).

rmdir
Removes empty directories. ex, "rmdir new".

man
displays the man page for a paticular application or command. ex, "man rm". Man is your friend, please use it :-) .


more to come

The Tech

Using tar, gzip, and bzip2

untar/gzipping a file

The following will decompress .tar.gz and .tgz files. cd into the dir with the file/s then type "tar zxvf yourfile.tar.gz" or "tar zxvf yourfile.tgz".

un-tar a .tar
cd into the dir with the file/s then type "tar xvf yourfile.tar".


un-gzip a file
Type "gzip -d filename.gz".


un-bzip2 a file
Type "bzip2 -d filename.bz2".


tar plus gzip a dir/multiple files
cd into the dir of the files you want to tar(warning, this will put ALL files of the current dir you're in into a tar file), type "tar cvf newTarFile.tar * ". Now to gzip the file, type "gzip -9 newTarFile.tar".


more coming.. learn along.

The Tech

Compiling and Installing Software

tar.gz or .tgz

untar/gzip the file ("tar zxvf file.tar.gz"). cd into the dir. Most source packages will compile by doing "./configure" then "make" then su to root (type "su" press enter then enter in your root password then press enter) and do "make install". I always like to do "make install > /root/program-version" to keep better track of everything. You should always read the INSTALL file first, but the above instructions usually work fine. If you happen to be compiling and installing libs, be sure to type (as root) "ldconfig" after installing them.


src.rpm

You must be root and in the same dir as the src.rpm. Type "rpm --rebuild --target i586" (if you have a intel p2 or higher, you can do i686, if you have a 486 or lower do i486 or i386). Now watch for where the actual rpm was placed (look at last few lines on the screen or scroll up a tiny bit). cd into the dir with the new rpm or cp it to where you are at ("cp /path/to/rpm ."). Now do "rpm -Uvh file.rpm".


Note for slackware users

You can compile source rpms using the above instructions, but instead of installing the rpm, run "rpm2tgz file.rpm" (comes standard with slackware) and install using "installpkg file.tgz".

Installing a regular RPM
cd into the dir that the rpm you want to install is in. su to root (type "su" press enter, enter in your root password, press enter). Type "rpm -Uvh filename.rpm" and press enter, boom done ;-).

The Tech

Basic Emacs  Commands


What is emacs and is it for you?

Emacs is the swiss army knife of the computer world. It can be used as a programmers IDE, for sending and receiving email, reading newsgroups, formatting text in various markup languages, to browse the web, and much more. Emacs is also very easy to customize to your own needs. Most (if not all) linux distributions ship with Gnu emacs. There is also a variant of emacs named Xemacs which the below information in this tutorial can also be applied to.

If you are someone who is just looking for a word processor and does not feel like being bothered with all this then check out the following links:


There are way to many things emacs can do for me to cover here, so, for now I am going to focus on opening files, basic editing of files, saving files, spell checking, emacs online help, closing emacs, and I'll touch briefly on Gnus. As time goes on I hope to add how to use emacs as a mail client and for various other tasks. Onto some Emacs commands.

Note: The Ctrl key will be referred to as C. The Alt or Esc (either one, it doesn't matter) will be referred to as M. An example would be "C-c C-x", this would mean to hold down the Ctrl key while you then press the c key, let go, then hold down the Ctrl key while you then press the x key. with the M (Alt or Esc) you press down and then release before you strike the next key, ex, "M-x" would mean to press down the Alt or Esc key, release it, then press the x key.


Basic Editing


Starting Emacs
"emacs file" Opens emacs. "file" is either the name of the file you want to edit, or the new file you are making.

C-x C-c
Quits emacs
* C is the Ctrl key on your keyboard which is Control.

C-g
Sometimes you can get all tripped up with commands, if you do, use this command to be put back in the text doc you were working on.

C-h
Online help. I suggest you use this. It is well written so newbies to emacs should seasily understand it.

C-x C-f
Opens a file into emacs.

C-x C-v
Open another file in place of the current one.

C-x C-s
Save

C-x C-w
Save as

C-x u
Undo. Multiple undo is supported in emacs.

C-x i
Inset a file at where the cursor (referred to as pointer by most emacs users)

The Tech

Reading Usenet News with Gnus

note: first open up /etc/nntpserver (as root) with a text editor, and put in your news server.
Opening Gnus

You first open emacs (just type "emacs"), then type "M-x gnus", then hit return. Give it some time, it will have to download all your nesgroups. If you see it "Garbage collecting" just sit back for a minute. After emacs is done retrieving the newsgroups from your server you will see about 3 newsgroups displayed.


q
quits gnu news

s
saves the .newsrc file

A k
Lists all the newsgroups on the server. You will see a K in front of them, it stands for "kill", don't worry about it.

u
Subscribe or unsubscribe to currently highlighted newsgroup.

SPACE
Start reading the newsgroup the cursor (pointer) is on. You move through the newsgroups using the up and down arrows.

l (lowercase L)
Lists newsgroups that you have subscribed to.

SPACE
When you are reading a newsgroup, SPACE moves down a page at a time.

DEL
When you are reading a newsgroup the DEL key moves back one page at a time.

a
generate a news post, use it wisely.

F
Post a reply.

C-C C-C
Post the article.

q
When you are reading a newsgroup, q gets you back to the your list of newsgroups.

And there you have it!

Basic linux, unix, emacs, gnu commands.

The Tech

There's more commands to learn.

But what we have here are to get you just started!