Basic GNU/Linux Commands


Installs Debian Packages RPM Packages Compression Hardware Network Find Apache Bash Shell X Windows Text Editors Vi Commands Emacs Commands Dos Utilities Special Keys Linux Sites

Back to Mainpage

GNU/Debian/RedHat Setup

Make boot disk in DOS

CD:\Dosutils\rawrite

Image file location

CD:\images\boot.img

Needed partitions

Swap (should equal RAM size up to 70MB); /boot (20Mb); / (root shoud be the rest of your available disk space)

Linux partitions can be made using Disk Druid during the install. As of RH 6.2, the installer will do the partitioning for you, just make there is at least 2Gb of free,unformatted Hard Drive space. If you already have another OS installed that formatted your entire drive, but still have free space available, you can use a utility like "Partition Magic" to resize the partition without loosing any data. Once you have at least 2Gig free space, put in the install CD and boot up with the boot disk.

General Linux Setup (aka Debian;)
Most modern BIOSes will boot up a CD-ROM. When installing Linux from CD-ROM, just insert the disk and boot up, you'll get prompted to enter for standard install.

Compiling, Extracting and Generally what to do with program installs
Look for distribution packages first, they are much easier to manage your system with.

Debian packages:
dselect
The main package manager, will show a list of all packages, installed or not, from the CLI.

gnome-apt
The Gnome gui front end for dselect, useful if you find dselect hard to navigate, but it's a little buggy. There is also a package list at www.debian.org

apt-get install
As root, type apt-get install (packagename)
This will not only install the program in the correct place, but will also install any needed dependancies for the program.

apt-get remove
apt-get remove (package name) will remove the program and all of it's unused dependancies.

apt-get upgrade
apt-get upgrade (package name) will upgrade your program to the latest verion.

apt-get dist-upgrade
This will upgrade your entire Debian OS!

The config file for apt-get = /etc/apt/sources.list
Edit this file to include any places to look for packages like web sites, CD-ROM etc.
Be sure to include deb http://security.debian.org/ stable/updates main if you have an internet connection.

apt-cdrom add
If your sources.list is corrupt (error on finding CD index), do the following as root:
insert your Debian CD #1 and type 'apt-cdrom add' for each CD (Woody has 7 CDs).
after all cds have been added, type 'apt-get update'.
Now you should be able to issue apt-get install (package name) without errors.

RPM packages are part of any Red Hat or Mandrake based Linux distro.

.RPM files can usually be uncompressed & installed by launching them from an X Windows file manager like GNOME or KDE, as long as they have EXECUTE rights (chmod 777 [filename]).

To uncompress RPM from CLI (or "shell" in unix lingo): rpm -i filename.rpm i = inflate


Compression: .tar.gz.bz2.tbz.zip.bin
Most compressed files need to be extracted in a shell window. To get a shell, launch the termnial program. A shell is a UNIX term for a command line interface, which looks and acts like a DOS window in Windows .

.zip files: unzip filename.zip

For .tar.gz files (tar & gzip, the most popular) type: tar zxvf filename.tar.gz. It should unZip, eXtract and Verify Filestructure.

To unzip .gz (gzip) files: gzip -dc filename.gz (-dc = Decompress & Check)
To extract .tar files: tar -xvf filename.tar (-xvf = eXtract & Verify File)
.bz2 or .tbz files: bunzip2 filename.bz2, or bunzip2 filename.tbz
.tar.bz2 combo files: tar jxvf filename.tar.bz2
.bin files are executable. Either click on them in a filemanager or launch them from a shell: ./filename
.RPM or .DEB files are not just compressed, they are part of a package management system. See Deb or Rpm sections above.

Most programs for all users on the system are stored and shared from /usr. Check for subdirectories like "games" etc. and put your extracted programs here, if you want them available to every user on the system. If it's a single user PC, you might want to keep all installs in your home dir to make backups easier.

Check to ensure you have write rights to the directory you are installing to (ls -al look for x), issue chmod 777 (filename) to allow executable. This should not be a problem for your home dir, if you plan to keep all new data there.

Check the "install" or "readme" files to see if you need to run any ./configure or make commands.

Run "make filename" or "make all filename" (if more than 1 makefiles) to run the compiler/installer, then launch program, usually in a GUI like GOME or KDE.

Adding Hardware
If the OS installer didn't leave all your hardware working, or if you are adding things like NICS, Modems, Printers, etc.

Kernel:
Most new hardware will require it's module complied/imported into the kernel first.
modconf = module configurator, menu based module importer.
module files are ususally kept at /lib/modules/(kernel version like 2.2.20)/ (subject dir like pcmcia or misc)/ and end in a .o for C object (complied) file.
after the module is imported into the kernel, you can usually find the device listed in /dev.

If modconf fails to find the module, check for a package that contains it, like pcmcia-modules-(kernel#). Then try modconf again.
If you update/replace your kernel, the deb package will modify your /etc/lilo.conf file, but you need to run lilo as root in order for the new configuration to update the linux boot loader. Then reboot and you will get prompted to boot with the new or the old kernel.

insmod -p (module path/name) will tell you if there are conflicts between your module and your kernel.

Network:
ifconfig
ifconfig will list network devs in use. ifconfig -a lists all net devs in the kernel.
ifdown -a
ifdown -a will take down all network devices.
ifup -a
ifup -a will bring up all network devices.
/etc/network/interfaces = the configuration file for ifconfig.
netenv
netenv will run a menu based protocol configurator. Use this to add IP address profiles and the like.
ping
ping will send a brief ICMP echo request, used to check connections to other systems across an IP network.
traceroute
tracroute will list the routers used to connect your system to other systems across an IP network. If the command can't be found, install it's package.

ssh -l username hostname
Secure Shell is an encrytped remote login tool, installed by default in Debian and most Linux distros.

Printer:
printtool
Is a RedHat printer setup for X. In X Windows terminal, su root, type printtool &. If printtool can't be found, install it's package. If printtool fails to print a postscript test page, find the .ppd file for the printer (from the manufacturer), this is a standard postscript config file, so you can use the windows or mac version, just be sure to put a copy of the .ppd file in /usr/share/postscript/ppd/ dir. You may have to rename the .ppd file name to fit the error generated in printtool. HP JetDirect network printers need to be added as DIRECT, and include the port number 9100 in the port field. To print from command line = lpr (filename).

Sound:
sndconf
Some devices need configuring even after they are imported to the kernel by modconf, like soundcards. Try running sndconfig for your soundcard.


The FIND tool:
find [start path] -name 'searchname' [accepts * as wildcard]
example: find / -name 'myfile*' = find anything with the name myfile from root.
note: many areas of the system are unsearchable unless you are root (or have read access).
Optional -type (f = file, d = dir) will narrow your search and wait time.

Apache Web Server

Download:
Apache to /usr
Extract: tar zxvf filename.tar.gz
Install: cd apache dir
./configure --prefix=/usr/local/apache (you can put apache anywhere, but this location matches the help docs)
make, make install

Start: /usr/local/apache/bin ./httpd (check ps -ef to verify)
You can also cp /usr/local/apache/bin/httpd /bin (binarys in /bin execute anywhere without typing ./ first)
Stop: kill (PID#) (check ps -ef for Process ID#)
Configure Settings: /usr/local/apache/conf/httpd.conf (edit with any text editor)
**note; default user= nobody group=nobody; editing this is not recommended
default users are usually webuser and webgroup group.

Edit HTML docs: /usr/local/apache/htdocs/index.html

Authentication:
edit the httpd.conf file to include:

htpasswd -c "/path/accountfile" creates new user accounts for secure sites (cp htpasswd to /bin to make using it easier).

CGI setup:
Create dir for cgi, check chmod so you can execute scripts.
edit the httpd.conf file to include "ScriptAlias /cgi-bin /path to cgi scripts/"
(make sure there is a space between /cgi-bin and your path, also for security, make sure your path is not in htdocs dir).

Virtual Hosts
Use Network Configuration in GNOME, (or similar netconfigurators) in Interface, set an IP address to eth0, and add Alias(es) to bind multiple IP addresses. Set Hosts to give a site name to each bound IP address.(which puts an enty into /etc/hosts)

Use alternative httpd.conf file httpd -d /path/alt httpd.conf

Bash Shell Commands

Close XTerm window exit or ^D
Display current path pwd
Change to a new directory cd /(directory name)
Move up one directory cd ..
Move back to home directory cd ~
List contents of current dir ls (including hidden files = ls -al)
Put list of directory into a file called foo.txt ls -al > foo.txt
Create a directory and call it foo mkdir foo
Remove empty diectories rmdir
Print a file lpr filename.txt
Delete a file rm foo.txt
Edit a text file (name of text editor like pico or vi) filename
Copy foo.txt and call it foo2.txt cp foo.txt foo2.txt
Move a file mv foo.txt /home/foo.txt
Rename a file mv foo.txt foocopy.txt (same as move, but without a new dir)
Create or combind "concatenate" text files cat > filename (^D quits)
Login as root from user prompt su (then root password)
Logout as root back to user prompt exit
Clear the screen of previous text clear
Read a text file less filename.txt (space for next screen, b for back, q for quit)
Combind commands together use the "pipe" key = (shift + \) command1 | command2
Print a listing of all files in a directory ls -al|lpr
List files in brian's homedir one screen at a time ls ~brian|less
Load a flopy disk mount /mnt/floppy (contents then appear in /mnt/floppy/)
Load a CD mount /mnt/cdrom (contents them appear in /mnt/cdrom)
View help file for a command man commandname or info commandname
Print the lpr man page man lpr|col -b|lpr
Find the word "bar" (regardless of case) in foo.txt grep -i bar foo.txt

Find a file by name

find [start path] -type [d=dir f=file] -name "filename"

Check what mounted on the system mount
Check disk space df
Check TCP/IP settings ifconfig
Check for echo response from another system ping -c 3 host.domain (will ping a system by name 3 times; pings are infinite if -c # is not used) Ctrl+C to stop ping loops.
Check route path to another system traceroute host.domain (same as NT/2000; "tracert" in Win95/98/ME)
Display current environment & system settings env
Display system settings only uname -a (all)(prints: sysname[-s], netname[-n], OS release[-r], OS version[-v], Machine type[-m], processor[-p]).
Use menus in terminal mc = midnight commander, the text version of the GNOME file manager.
Display text file one page at a time more
Identify Shell types by prompt $ = bourne shell, $ = user, # = root
Logout of Linux logout
Shut the system down shutdown (-h = off, -r = reboot, +# = minutes to shutdown)
or poweroff, or reboot
halt will stop system only. Then use ctrl+alt+del to reboot.
Switch to another GUI at next XWindow login switchdesk
Format floppy disk mkfs -t ext2 /dev/fd0 (or use gnofloppy/kfloppy when in GUI)
Change login screens Ctrl+Alt+F1-F6 (F7 = default XWindow)
Location of most shared programs /usr/bin (users, binaries)
Set access rights chmod dir or filename permission# (4=read, 2=write, 1=edit; per order= root, owner, allusers) example: 756= root has all, owner has read+edit, allusers have read+write. 'chmod 777 foo.txt' would give all users full rights to foo.
User creating useradd (username) ; passwd newuser (password)


X-Window Commands and Tools
Install or configure X Windows Xconfigurator (writes config to /etc/X11/XF86Config)
Start X Windows startx
How to boot directly into X Windows /etc/inittab, change ID line to 5. Example: id:5:initdefault (3=CLI w/net, 2=CLI no net)
check XWin settings rpm -qa|grep^X (note last line = video type)
Change XWin resolution Ctrl+Alt+"+" key
Users; adding, deleteing, editing rights. userconf (User Configurator, must be logged in Gui as root)
Network settings netconf (Network Configurator, must be logged in Gui as root)
Partition and Network access settings fsconf (File System Configurator, must be logged in Gui as root)
Main GUI source for all settings linuxconf (Linux Configurator, must be logged in GUI as root)
Force Quit ctrl+alt+shift+tab


Text Editors
Pico F1=help, F2=exit & save, F3=Save, F4=Format paragraph, F5=Paste another file, F6=Search for text for no save, F7=Back page, F8=Forward page, F9=Cut text, F10=Paste text, F12=Spell checker, ^X = Exit, N for no save
Vi vi (filename) to create or edit a file. See VIM, the GUI version, or VI Commands
emacs emacs (filename) to make/edit file. See emacs commands


DOS Utilities
View DOS floppy mmdir a:
Format floppy for DOS mformat a:
Copy DOS file from floppy to Hard Drive mcopy a: filename
Copy file from Hard Drive to floppy mcopy filename a:


Special Keys
^ Symbol for the Ctrl key.
Example: ^c = Press the Ctrl+c keys
| The pipe key, used to combind commands together.
Example: du | sort -rn | more
^D The EOF 'End Of File' key, used to signal the end of an entry.
Example: at 12:00 < enter > /home/user/logscript ^D


Top of page     Back to Mainpage
1 1