Linux Command Reference
CREATED:
November 2000
Updated: 12-2001,12-2005,
07-2008,
==================================================================================================
Pros and Cons of Linux
PROS:
Free alternative to Microsoft Windows. Designed
and supported for the benefit of the human race. Very solid core operating
system.
CONS: Weak x-window shell (the point and click
desktop interface); Gnome and KDE are easily broken and it can be difficult to
fix. Installing and uninstalling software
is overly complex.
TIP: Install Fedora by
creating a virtual machine with Virtual Box by Sun. This helps keep a clear separation between
windows and linux on your PC. ==================================================================================================
Case: Linux is usually case sensitive: Type “clear” not “Clear” or
“CLEAR”.
|
COMMAND |
DESCRIPTION |
ARGUMENTS |
EXAMPLE |
|
|
|
|
|
|
|
|
|
|
|
Terminal |
MacOS
X (Unix) search for this using spotlight so you can open a command shell
where many of the commands here will help you. |
Command
key + space bar, type terminal. A
shortcut can be added to the desktop or the dock. |
|
|
updatedb (creates and then
updates the quick search file database(file index) that the locate command
uses.) |
Updates
the rapid search data base. If it has
never run it must be run manually first.
Don’t forget to login as root. |
|
Open
a terminal window, type su root <Enter> then the root password then… updatedb <Enter> |
|
alias (not
to be confused with a Symbolic Link – which is what a shortcut is in
Microsoft Windows) |
These
command-line shortcuts save a lot of typing.
TIP:
You can recreate the same dos shortcuts you may be used to ex dos
cls or clear screen is done with “clear” in Unix you could type alias
‘cls=clear’ |
alias <Enter> will show what alias’s are
currently setup – note do to a bug some may appear messed up or different
than you typed. EXAMPLES
IN /etc/bashrc.bash # Do not leave any space
see example # correct: # alias d='clear ; ls -all -h ; pwd' alias alias cls='clear' alias vismb='vi /etc/samba/smb.conf' alias restartsmb='/etc/rc.d/init.d/smb restart;
sleep 2; smbclient -NL fedora' alias vibash='vi /etc/bashrc' alias vimsg='vi /var/log/messages' alias cpsys='cp /etc/samba/smb.conf /windows/sysinfo/
cp /etc/bashrc /windows/sysinfo/' alias shut='shutdown -h
now' alias x='startx' alias www='cd
/var/www/cgi-bin/;chmod +755 *; clear; ls -all -h; pwd' alias viipaddr='cd
/etc/sysconfig/network-scripts/; ls -all ifcfg-eth*' alias kde='switchdesk
kde | startx' alias
locateupdate='/etc/cron.daily/slocate.cron' #the above localupdate
will force locate database of all files on # the
hard drive to be updated. |
each time you logout or restart the Unix box the
alias will be forgotten. To make the
system remember and load it each time go to this file but be careful because
it is critical. TIP
Get familiar with the vi dos shell text editor first the basics of vi aren’t
hard but vi will frustrate the hell out of you until you learn its basics
commands!!!!!!!! cd
/etc vi
bashrc <Enter> inside the vi editor DON’T JUST START PRESSING KEYS
UNLESS YOU KNOW HOW TO DO THINS IN VI!!!!! press the insert key on your keyboard use down arrow
to go to last empty line press <Enter> key several times. now
type alias
‘cls=clear’ now press the esc or escape key to exit insert or
typing mode press the shift key and
hold it down now press the letter Z twice this will save and exit. IF YOU MADE ANY MISTAKES PRES ESC KEY THEN
SHIFT AND THE : COLON KEY NOW TYPE q! <Enter> this will exit you without
saving and you can try again. |
|
Apache
(httpd) |
This
is the default Linux Web server that dominates the internet (~ 65%). httpd is http protocol d stands for daemon which
just means a service that your computer is providing. |
Where
is my home page? /var/www/html/
directory the file name is index.htm.
To edit it from the DOS Window/shell prompt type: vi
/var/www/html/index.htm <Enter> Tip:
make a backup copy of files before editing them. Ex. type cp
index.htm index_bk.htm <Enter> |
service
xinetd restart service
httpd restart <Enter> |
|
Bash
(see
shell in this chart) How
do I know what shell I’m in? From any
shell type echo $0<Enter> (zero not “Oh”) |
This is one of the “dos” shells or really
shell
prompt environments you can work in.
It is my favorite and I highly recommend it for beginners + advanced
users too. It has cool stuff like the
up and down arrow keys will scroll through commands you type – not all shells
do this. |
A
number of commands or features are available in this shell that the ‘c’ shell or korn or borne shell don’t support. |
There
is a version written for Sun Solaris Unix that can be install
on Sun. |
|
calculator type
bc |
Simple
system calculator |
NONE |
bc
<Enter> now
type a calculation ex 5*50 <Enter> TO
EXIT: type quit <Enter> |
|
cd (see pwd) |
Change
directory. Careful most common
mistakes is not leaving a space between cd and .. or / in ms dos you can type it either way. |
.. backs up one dir or folder level at a time / go to the highest level of
the hard drive useful if you then want to search for a file through entire
HD. cd <Enter> will take you to the “home”
directory of the user you are currently logged in under. cd
– go to last dir you were in |
cd [space] ..
wrong “cd..” right “cd ..” wrong
dos way cd\ wrong Unix way cd/
correct Unix way cd [space] /
or cd / this
example works from any dir you’re in because is spells out the full or
“absolute” path go to a folder
called /dir1/dir2/dir3 cd /dir1/dir2/dir3/ notice the slash on the
end it clearly tells the system dir3 is a directory NOT A FILE CALLED dir3. |
|
CDROM
Access |
To
do a manual mount at the shell prompt type: mount –t iso9660 /dev/cdrom
/mnt/cdrom <Enter> |
|
type
cd /mnt/cdrom <Enter> now type ls –1
or dir –1 to see a directory of the CD
contents. (remember a CDROM disc must be present in the drive) |
|
cfdisk
(also
see fdisk) |
Great
Non-Windows MENU - driven utility that shows you all your hard disk
partitions and hard drives at a glance.
|
Use
the tab key to navigate menu choices and arrows to select drive or partition - Warning be careful this util
can delete partitions and chg the bootable status etc. |
cfdisk
<Enter> |
|
chmod
(also
see chown) |
Modify
the permission “Mode” this is basically a built-in set of file or access permissions expressed in hexadecimal
#’s. |
755
(rwxr-r-) read write eXexute read typically used for web pages. -R
recursively chg permissions |
chmod
755 mydocument.txt “no such file or directory” err msg when trying to execute
a perl script. |
|
chown Change
Owner also
see chmod |
change
owner |
-h
changes the ownership of a symbolic link (shortcut) but not the file that it
points to. -f
suppress error messages. -R
Descends directories Recursively (allows you to make the change effective in
all subdirectories EXAMPLE: chown
mrbios:mrbios filename this says change the ownership to the user mrbios
and the group mrbios with a colon in-between then the filename you wish to do
this to. Chown
userID:GroupID
filename if you don’t specify a group then just the
owner will change and the group will not. WARNING: this can create havoc
esp. if different sub directories grant access that is not granted in the
upper level directory this will strip those owners. (continued… -> ) |
(continued…) Ex
Top level dir folder called
Data contains Admin and Root.
but below are all the end user’s sub directories each end user has
ownership or access to their folder if you are working in DATA and do a chown
–R and make the owner root this will strip any other owners out of the
individual end users folders and all end users will now not be able to access
their folders (home directories). You
will then need to re add them one at a time on a folder by folder basis. Or
restore from tape backup. chown
–R root:apache * meaning
ch all subfolders and files to userID
of root and a GroupID of apache |
|
clear |
clears the screen same as dos cls command. |
|
clear <Enter> |
|
copy
file |
see
cp |
|
|
|
cp |
copies
a file |
-R
copy and creates sub dir's as needed. src: . or *.* |
cp
-R /Source_dir /Destination_dir ex: cp -R . /Destination_dir <TIP> Destination
dir must exist or will not copy. -R
Recursive copy and all cmd line arguments must come first before src and dst
dir’s. |
|
cp
= copy file |
Copy
file |
|
cp file1.txt file1_bkup.txt
<Enter> |
|
ctrl+alt
F1 |
Break
out of an Xwindows hang |
|
follow up with ctrl+c a few times to break out once
you are back at the shell prompt. |
|
Customize
Default Windows
shell prompt |
Customize
Default Appearance of shell prompt windows under KDE environment Get
a nice EZ on the eyes shell prompt under KDE x-windows shell. |
N/A |
Click
on “Terminal Emulation” Icon usually at bottom of screen. Now a dos shell should be open click on
Options, Schema, chk “White on Black”, then click on Options, Font, chk Huge
– if using large monitor. Finally,
to save changes: click Options, Save Options. If you don’t the preference
setting will get forgotten. |
|
daemon |
pronounced demon. Very
important item / concept in Linux and windows 2000/NT and even windows 9x/ME. Remember
it’s this simple: daemon = service and service = daemon. this
explains the magic letter ‘d’ that so often follows name that would make
sense then get a ‘d’ slapped on the end. Ex:
http heard of it? how about httpd
now it seems mysterious - it’s just apache web server. Read “httpDaemon” smbd
- smb is short for samba services which are windows compatible shares so this
would be read “smbDaemon” |
This
is a service meaning it is running in the background all the time. The equivalent in windows 95/98/ME is
Norton antivirus - which is not visible except in the “notification area” in
the lower right hand corner - there it runs and watches all files opened,
created, run etc. It works away
silently scanning and watching for viruses. Now
you CAN run Norton antivirus in “application mode” which means you find the
icon and double click it - now you can MANUALLY run a full system scan, or
change options - like schedule weekly scans etc. |
But
I digress, lets get back to Linux. In Linux (and win 9x but mainly 2000 / NT ) as you gain
knowledge and ambition you can start and stop services. Why? Lets
say you change a configuration to your apache web server, or add a new samba
(windows compatible share) you could reboot to see the effect of these change
or just restart the service instead and see the effects immediately without
the wasting time rebooting just to find out the change didn’t work and then
have to chg again and reboot and so on. Security:
Shut down *things* services you don’t use.
There’s an old saying: turn off all services - now turn on only the
ones you need. This helps close doors
to your system that you didn’t know were open! |
|
date (see
tip 1st) |
Lets
you print or set the date and time. Note
when you set the time you ONLY enter digits no letters allowed! Or cmd will fail. **TIP: if you just want to go
1hr ahead or behind then you can do just that as a shortcut and avoid the
risk of messing up the system clock which can cause problems with system
processes! BE CAREFUL on production
boxes. The stuff here is geared
towards home use of Linux where there aren’t important business programs running. date
--set=‘+2 minutes’ <Enter> or
for daylight savings time in spring (ahead) date
--set=‘+1 hours’ <Enter> TIP2: You can also run X
windows (if installed) and chg the time there. |
date
+ “%D” show me date only date
+ “%r” show me time only Setting
the Time/Date: 1.)
date <Enter> #REMARK:
displays current date/time in human readable format. Mon
Apr 08 2.)date
+%m%d%H%M%Y%S 040810462002
<--System Output 04=April
08= 8th 1046= 3.)
Now basically retype the all digits output above and just chg the item you
want: ex: 040809462002
<Enter> ^^ 09 instead of 10 to roll back 1hr for
daylight savings time. |
date <Enter>, shows time and date. NOTE:
be careful to type all commands in the proper upper/lower case exactly as I
type in the examples [unless I made a mistake :) ] |
|
df
(Disk
space Free) |
Disk
space Free - To determine how much free disk space on all hard drives and
file system types: ex ext2, iso9660/cdrom, etc. |
-h show the output in ez to read human format |
df
-h |
|
dir |
list
contents of a directory |
FILLIN |
|
|
dmesg
also
ctrl pg/up pg/dn key |
display messages that you see at the startup of Unix
/ Linux. |
press
and hold ctrl now press either pg/up
pg/down |
lets you scroll the display backup any time you
missed something. dmesg | more <Enter> display system msg’s pg
at time. to see dmesg
| grep eth0 <Enter> |
|
DOS
(vfat, FAT16 or FAT32 i.e. Microsoft)
Partition Access |
In
order to access any drive such as a: CD ROM, floppy disk, or another hard
drive or partition or logical drive (extended partition) you must --------------------------> |
first
login as root make a “mount point” which is just a normal
directory. For example: mkdir
/mnt/vfat <Enter> (note vfat mounts both FAT16 and FAT32 partition
types with NO Change to the command above) now mount it by typing mount
–t vfat /dev/hda1 /mnt/vfat to
set this so it mounts every time windows starts |
|
|
echo |
used
to echo the contents of important “system variables” or environment variables
etc. |
echo
$FILLIN THIS CMD LATER echo
–n to dress up the output of a batch file or script in Unix |
echo
–n |
|
etc/sysconfig |
|
|
|
|
exit |
Shell
prompt command that logs you off the system (if you are not x
windows) or will exit you from a shell environment ex… |
Tip:
from ms windows open a DOS window: click start, run type command
<Enter> now type command <Enter> again and you will have opened a
2nd shell. Now type Exit
<Enter> and you will be back in the first shell now type
exit <Enter> to close the shell prompt or “dos window”. |
from xwindows open a shell prompt or xterm window
(click on the monitor icon towards the bottom left). now type csh to
enter the C shell. now
type exit <Enter> to return to the first shell, exit again will close
the shell prompt or xterm window. Now
quit windows to
the shell only “Dos” prompt. type exit and you will be logged off. |
|
fdisk
(See
cfdisk more user friendly) |
NOT
the Microsoft DOS fdisk but a different program that does similar things but is
run from Linux or a Linux boot disk vs. ms dos. |
m - shows you all the commands available p - Great command so you can
not only see all the partitions on the disk but also see what Linux considers
them and how Linux label’s them: ex hda1 for the first disk and the 1st
primary partition. (EXERCISE
GREAT CARE when running fdisk). type: df<Enter> this is to discover the
device name: basically it will be ‘hda’ for IDE hard drives - most home
pc’s. And ‘sda’ for SCSI or rem:
hda = ‘s IDE hard drive 1 but if you wish to see a 2nd HD then it
would be hdb and so on. Same with SCSI
sda, sdb etc. |
fdisk
/dev/yourharddrivetype<Enter> ex. fdisk
/dev/hda <Enter> m
<Enter> - you will see all commands. p
<Enter> you now see a nice neat list of partitions and labels etc. finally
type: q <Enter> to quit, note if
you make a mistake and use your backspace key or delete key you may get funny
characters - to get out of the situation press and hold ctrl
then hit the c key. This will let you
break out and exit the program. |
|
File
Permissions (Also
see chmod) |
Unix/Linux
File permissions look strange and cryptic but in reality there are a few
common ones that get used most of the time. |
What
is "CHMOD" and what do all those numbers mean? Basically
CHMOD refers to setting the access privileges for a file. 777:
all can read/write/exec 755:
owner can do all, group/others can read/exec 644:
owner can read/write, group/others can read only For
Directories: 777:
all can read, write, search 755:
owner can do all, others and group can only search |
Typical
settings: cgi
scripts: 755 data
files: 666 configuration
files: 644 (files not updated by scripts) directories:
777 (with proper permissions on files in directory) chmod
+777 file.txt <Enter> |
|
find
(see
grep and especially locate /slocate) |
searches for things like file names similar to dos
dir *.txt or dir filename.doc etc. standard
way: (won’t work in Linux) find -i . -name term-paper -print find
-iname *.* <Enter> common
mistake: user’s
forget to type -name followed by the filename |
-name – makes the command more dos like and very useful. TIP
to search entire Hard drive don’t go to /root
type cd / always case insensitive search with -i unless you
really need to match case. This is a
good reason to keep most files lower case + uppercase the first letter of
directories to make them stand out more. “
” quotes used with –name will let you select exact parts of file names to
search for *
same a above find –name “*.txt” or “*essag*” -atime
+[number of days you choose] -depth descend sub directories first then search the
current directory – great if you are at the root directory i.e. ‘/’ then all
subdir will be chked. -mount – don’t look in mounted systems like the CDROM or
floppy disk. Ex:
find
/etc | xargs grep "duck" 2> /dev/null grep -s …
^ find
/etc | grep "duck" 2> /dev/null ^ Not using xargs can be bad. it _will_ work, however it will
only look through one file at a time. using xargs allows you
to use the bare minimum number of grep's as possible. say there were 1000 files, your
way will launch grep 1000 times. however, using xargs, grep may get
executed only 10 times. (assuming that 100 filenames will fit on
the command line argument) find
/dir -type f | xargs grep "string" /dev/null |
find
/ –name “filename.*” or find / -iname “filename.*” case insensitive! find / –name “*ash*” find
/ -name “*partfilename*” | grep oot find
–name “*filename*” -atime +30 \ this
will find files that are 30 days old or older and will be case sensitive find
–iname –depth –mount “*filename*” find
-iname your-file-name <Enter> looks only in the current directory find / –iname –depth –mount “*filename*” the slash says search the entire HD which take a find /etc | xargs grep
"duck" 2> /dev/null won't get any msg’s about files you
couldn't access, you might end up missing the file if u don’t have rights to
it. |
|
FLOPPY
DISK mtools |
how to find and access a dos floppy disk in
drive A: |
mtools <Enter> will give you a simple list of ms dos
commands that you can use to access and manipulate copy delete etc dos files
two and from Linux. |
basically all the familiar dos commands but with an ‘m’
in front of them. mread mdir
– to see a director mcd and so on. |
|
Floppy
Disk Drive Access |
In Linux, the floppy drive is referred to as
/dev/fd0 |
-t
the file system type vfat for ms dos compatible fat 16 or fat 32. |
mount -t vfat /dev/fd0 /mnt/floppy |
|
free
-t |
same as dos mem, shows you free memory. |
free
-t <Enter> |
|
|
fsck.ext2 or
efsck2 efsck2
is used to check a Linux second extended file system NOTE:
YOU MUST only run this on an UNMOUNTED partition
or volume - do this by exiting all programs you are running esp. windows and
typing: init 1<Enter> then
type umount /dev/yourdev+ partition
<Enter> (type
df <Enter> to determine that cd / <Enter> to get to root. |
File
system repair aka checkdisk / check disk / scandisk for windows complete with
an “automatic” hands-off mode, but different in the typical Linux way can
offer many in-depth file repair options for those ranging from medium to advanced knowledge. or
just fsck or e2fsck fsck.ext2
/dev/hda3 or /dev/hdc1 TIP:
type df <Enter> to see free disk space on various devices and you will
probably see the device of your main root drive then can type the proper
label -> /dev/HD?? for it. |
if you just type fsck.ext2 <Enter> you
will just get a command options summary. Don’t
panic if your disk problem says NOT to just runt fsck.ext2 in “automatic”
mode but rather you are directed to run in MANUAL mode. Next,
you must determine the IDE hard drive device name and partition name on your
hard drive. I
used df <Enter> (Disk Free) to see free disk space on various devices
and you will probably see the device of your main root drive then can type
the proper label that fsck.ext2 needs
in order to scan. -> /dev/HD?? for it. device is the special file corresponding to the device
(e.g. /dev/hdc1). LOST AND FOUND BOX: Where do recovered lost file
or directory fragments go? /lost+found/
is the name of the dir and it is located right off the root. *************************************** SURE
FIRE METHOD (hopefully): start up normally if you can. login as root, type: init 1 for single user
mode, in this mode you will be able to run: umount
/dev/hda3 <Enter> and run
a manual scandisk. In init 1 you are in single user mode
and there are hardly any services running that would prevent un-mounting the
root system drive. If you get the
error system is Clean you can use -f
to force the scandisk to run: umount -f /dev/hda3 e2fsck -f -c -y /dev/hda3 |
NOTE:
YOU MUST be in the root directory!!!! cd / <Enter> or you
will get the error message saying NO
SUPERBLOCK or device found in something location. (search this document for
more extensive type: pwd<Enter> print working directory to
see what dir you are in. remember not
/root which is the root user’s personal directory but rather the file system
root dir ‘/’ This
worked on my system: fsck.ext2
/dev/hda3
MY
STORY: Running
RH Linux v 7.0 on a Pentium 166 with 64 meg of RAM for about 1 year. The system forces a scandisk with fsck.ext2
after a predetermined number of boot’s - example 25. One
day the system would no longer boot past the scandisk message. I considered
deleting and reinstalling Linux but I opted instead to attempt to fix the
problem and learn more about the problem. NOTE:
fsck.ext2 is geared towards ext2 type of partitions/file system. There is an e2fsck.ext3. I was in a similar situation on "bad
magic number in super-block while ..." The
essential first step it to be sure you are at run level 1# and logged in as
root. Type init 0 <enter> and su
root <enter> then run fdisk -l <enter> ( to
make repairs and get more remember hda refers to the first hard drive, and hdb
would be the 2nd and so on. Now
you may see a message that I saw that said: “The
number of cylinders for this disk is set to 11983. There is nothing wrong with that, but this
is larger than 1024 and could cause problems in certain setups: 1.)
software that runs at boot time ...” I
typed m <enter> and a nice menu of choices appears letting you do a
variety of things. Note you can only press a letter, not arrow, backspace,
delete key etc. If you do you get
garbage characters. that’s ok press enter. then
I got an error when printing the partition table: “Partition
table entries are not in disk order” |
|
grep (See
find, grep is used in combination with many other commands) |
Super
useful command that teams up very nicely with many other commands. A sort of
search or filter command. TIP:
Watch out! grep
IS case sensitive. TIP2:
double up! history
| grep cd | grep root you can look for 2 things at once! grep so useful it’s not funny! take a look at this
-------------> |
locate | grep messages locate
with no files after it will find all files grep
says I’ll look at that list and show you only entries that match in this case
must contain the word messages another
time you are in a directory /etc you could type ls –1 –1 | grep hosts and the hosts file will be listed. ls -R -all to search all directories for a particular
file do this: ls -R -all | grep .txt <--- will find all .txt files. WARNING: do no use wildcard characters with
grep or quotes. *.txt will match
nothing. instead
use .txt or filename.txt type search item exactly as it will appear. find
/etc | xargs grep "duck" 2> /dev/null grep -s … find
/dir -type f -exec grep "string" {} /dev/null \; <Enter> |
Lets say you edited an important file but forgot
the location and command line arguments you used. history
| specialfile.txt this
will show you all commands you ran in the history list that contained the
filed called “specialfile.txt and
especially to quickly fine a service and see if it is running: ps
ax | grep sendmail grep
* <Enter> will give you a list of all directories in your current dir.
or you can specify a dir: > grep /etc/* <Enter> To
search for the word duck type: grep
'duck' /etc/* <Enter> |
|
groups |
displays
the groups a given user belongs to |
userid |
groups
root |
|
grub
(see
lilo) |
A
multi-boot loader that can kick off Linux and other OS’s. GRUB
an alternative to LILO. GRUB now comes with many distributions and will be
the default in Fedora. GRUB can boot many more OS's than LILO and is more
flexible. |
|
|
|
gunzip
gzip |
Tip
use windows winzip! |
-v |
gzip
-v filename.tar.gz |
|
hardware |
how to run the setup wizard in DOS (Shell
prompt). |
FILLINWindows
Xconfigurator (capitalize the ‘X’) or at the beginning: LinuxConf (all lower case,
I believe). |
|
|
help Also
see |
to
find help in the Unix dos shell |
command
--help FreeBSD
Unix command for help = command
-H <Enter> ex
cp -H <Enter> |
clear --help
or cd --help or whatever
command you want help on. TIP: often
you will need the more and | or “pipe” cmd command ls --help | more |
|
history and ! or ‘bang’ |
previously
typed commands TIP:
you can set how many commands you wish the system to store by editing the
following file: profile located:
/etc HISTSIZE=1000
(default size) (note
it’s NOT HISTORY=’s but HISTSIZE=’s) |
type
history then <Enter> !
the bang symbol followed by a # in the command
list. ( Example !20 <Enter> ) !!
<Enter> to repeat the last command typed. a list of commands followed by #’s will appear. to
see the root user’s history file go to /root/.bash_history |
located
in a file called .bash_history To
perform a command without scrolling to it type !20
for example to run command #20. TIP:
don’t run this from the /root folder it and other commands don’t seem to get
recognized there. if
your in /root type cd / <Enter> to back-out of there. also right= !20
wrong way ! 20
no space between the bang symbol and its argument value (the
number 20 in this case). |
|
hosts
file |
/etc/hosts
file static mappings for netbios names. |
sample
of file would look 192.168.0.106 www.fedora.com 192.168.0.106 fedora |
vi
/etc/hosts <Enter> |
|
I
- Interactive startup (booting Fedora) |
When
starting watch carefully and you will see the msg “Press I for Interactive Startup” this will let you respond [Y]es
or [N]o to the system’s request whether to start each service. |
Not
applicable (n/a) |
I
corrupted the Sendmail service by forcibly shutting it down as a part of
testing the kill command. The result
was that the system hung the next time I rebooted at the point of starting
the sendmail service. So I used
Interactive mode and said no to it
then used ntsysv to unchk it from auto start then R & R it – Removed and
Reinstalled the RPM sendmail package. |
|
ifconfig |
Equivalent
to ipconfig in win NT or winipcfg in win 9x/ME. It displays IP Cards and the addresses they
currently have. |
FILLIN
ifconfig | more
<Enter> to see everything if running multiple NIC cards. |
/sbin/ifconfig
<Enter> Tip:
Unless you are logged in as root user you must type the full path to the
system file. |
|
|
gives you extended |
|
|
|
install (see rpm) |
See
rpm - that stands for Fedora package manager. Keep
in mind installing packages is not quite so easy as
windows. Some packages may fail to
install be cause they rely on other modules (programs) packages etc to be
present or be a certain version. It
can be easy to get frustrated. |
Note
you do NOT need to specify the full path. Just type rpm --install packagename.rpm and YES your package name better end in rpm and
not tar and or gz. If it has tar or gz
anywhere in the name it has been zipped with tar and or gz and must be
extracted first. Search this doc for
that procedure. Often tar and gz are
used together. |
[root]# rpm --install linuxconf-1.25r7-3.i386.rpm
<Enter> |
|
IP
Address - Setting it for the System NIC or Network Card(s). You
can also start Gnome and run LinuxConf which will proof what you type for
mistakes. |
/etc/sysconfig/network-scripts/ifcfg-eth0 this folder contains both the IP Address for each network card -
Careful the first card is numbered like in math eth0 not eth1 which would be
the 2nd card if you have 2 NIC cards in your system. WARNING:
** The
system in no-way proofs these files for mistakes. So you can type anything -
the errors will affect other services. TIP:
always copy a file and add _bk and the date BEFORE changing it. This way you have a simple “UNDO”
available. |
This
is a sample of a typical NIC Card file: The
IP addr’s DEVICE=eth0 ONBOOT=yes Now to restart your network reboot or type
this: /etc/rc.d/init.d/network restart then type ifconfig eth0 <Enter> or just ifconfig | more to see the config for all NIC's. |
<Enter> Careful
- The wrong Subnet mask will cause httpd the web server to fail and SMB or
Samba windows sharing service too. To
create an alias that a NIC with two or more IP Addresses … use
vi editor to create an a file containing the same stuff as the sample file
accept the line will be chg as follows: DEVICE=eth0:0
the :0 indicates a virtual IP address for the first card this way you
can have an unlimited number of IP address that all point back to one
physical network card. The next alias or virtual IP would be: DEVICE=eth0:1, DEVICE=eth0:2, and so on. |
|
IP
Addresses DNS Alternative file Use this anytime but especially if you are NOT
running a DNS server or DHCP Server |
How,
where do I set the IP address for the Linux system and How can I add multiple
IP Addresses? Solution:
Edit /etc/hosts file. |
from
any directory… type vi
/etc/hosts <Enter> Now
press the insert key to begin typing, then press esc
key then Ctrl ZZ to save and exit. To
exit and Not save press esc, shift+: , q!
<enter> Remember
hosts is NOT a directory it’s a file in a directory
called /etc. Often files in Linux have
no extension such as .sys or .txt etc. |
examples: IP
Address Fully Qualified Domain
name Host name 24.130.184.55 fedora.domain1.com fedora 24.130.148.115
www.w2kmain.com w2kmain This
lets you set the host address for Linux, add multiple IP’s (multihomed) and
add IP address for other hosts - necessary esp. If you aren’t running a DHCP
or DNS server. |
|
kill |
Kills
a process or service. However, this
doesn’t work quite as simply as it might seem: you can’t just type kill
<enter> |
-s the signal you wish to send to the process -pid where pid is
the number of the process you wish to kill. |
kill
–s kill 1701 Be
careful what process you kill. You can
corrupt your system. A great way to safely experiment is to run a process
such as the vi editor in the background and then kill it. ex: vi
madeupfilename.txt & <Enter> now
type ps ax near the bottom of the list
you will see vi madeupfilename.txt
followed by a pid or process ID # now
type kill –kill 1788 1788
is just an example of a process ID or pid.
Now run ps ax again to see if
the process # is really gone or “killed” |
|
lilo |
FILLIN
a lot could be said here and more will be added. |
To
the Rescue: Installed or reinstalled windows and now Linux won't boot. Let's
look at a common mishap: in this scenario you have a dual-boot Linux/Windows
computer and you happily use LILO in your master boot record partition (MBR)
to boot to one OS or the other. You decide to upgrade or re-install your
Windows setup. Zap! There goes the MBR (Windows ALWAYS zaps the MBR when it
installs even though it's unnecessary and in decidedly poor form). |
Now
you're in a pickle. Your Linux partition is still fine, but it's inaccessible.
How do you get back into Linux in order to re-run lilo so that it can rewrite
the multi-boot loader into the MBR? Why with your boot disk, of course. With
the Fedora boot disk, it's a piece of cake. Just insert the floppy, boot, log
in as root and type lilo at the command line. Everything's back to normal. |
|
lilo.conf |
Your
boot configuration file. It contains
the Also
contains the partition that Linux is on and the hard drive. Located:
/etc/ |
Note:
I made changes but there were NOT reflected after rebooting.???? |
|
|
Linux
single |
single
user mode to start Linux if you forgot the root password |
at
the login prompt type Linux
single |
once
in type passwd root and choose a new password. |
|
Linux”
(LIN-NUCKS) |
pronounced LIN-NUCKS NOT LINE-NICKS
- don’t feel bad - I said it wrong in the beginning too. |
In
my opinion one of the best things about getting involved in some way with
Linux and the Open Source Movement is the honest Open sharing of knowledge. There
are many good online communities about people helping people - the world
could sure use more of that! |
Also,
because of Linuxs' complexity and power you don’t have to horde knowledge as
often happens in Information Technology departments in corporations with Microsoft products - which are much
simpler to use - so people fear losing their edge or value an thus horde
knowledge and keep it to themselves.
Linux - offers you limitless ways to find places in the OS to
specialize your knowledge - this makes you a valuable contributor but at the
same time dependent on your fellow users in the Linux community. |
|
linuxconf Tip:
At boot to chg timeout of config menu go to Configuration, boot and chg default. |
There
are two versions of this utility that are basically the same: 1.)
runs under windows in Gnome xwindows click: Programs, System, LinuxConf DOS
based configuration utility.
Is the same as the Xwindows configuration util. Just type Click Programs, System, linuxconf
<Enter> use the enter key to open up items on the tree and tab to get
to the exit button. |
N/A |
LinuxConf
<Enter> This
utility may seem a bit crude: it took a lot work and I read it is 80,000
lines of programming in the C++ language. |
|
lmhosts
file |
/etc/samba/lmhosts
file, used
by the Apache web server to determine the IP of certain static web sites most
importantly a mapping between the netbios name ‘localhost’ and the default IP
Address: 127.0.0.1 |
|
|
|
locate (Note:
locate is just an alias/shortcut/or pointer to slocate). WARNING:
this IS case sensitive AND adds files like once a session / day to it’s
database so if you make a new file it won’t appear unless -> locate
is like spotlight in the Mac |
awesome fast file and directory search tool. That
searches THE ENTIRE HARDDRIVE and any other mounted drives. ex /mnt/cdrom, etc. Note:
this and other utilities may fail if run while you are in the /root
directory. So always change
directories TIP:
Fedora Linux install you must run ‘updatedb’ while logged in as root
to create the catalog or Database. And
to force it to update. |
best
part is that you don’t have to use wildcards to
search for message1.txt message_RA-5.doc and
Rhlinux_message_system.db all of the
files can be searched for by typing: locate
Message <Enter> no quotes are needed nor command line options
etc. Note
you must be logged in as the root surperuser. ---->
you force a Manual Update! To
force an immediate manual update (no matter which directory you are in) type: ./etc/cron.daily/slocate <Enter> |
NOTE:
File index NOT updated in real time, only when a scheduled “cron job” runs
every hour/day or not at all. locate
*.conf locate
-i host.conf <Enter> -i
ignores case matches UPPER or lowercase. TIP: if you are using a new
system type su root <Enter> then the root password now type updatedb
<Enter> this will run for a while and either update your file database
- if it is empty then trying to match files as mentioned above will not work
if the database has never been created or is empty. TIP2:
combine it with grep to filter the results locate
“*moz*” | grep “Mozilla” slocate
host.conf <Enter> calling it directly vs. by it’s shortcut name locate
which is really just a pointer:
locate->slocate |
|
login
-
text or command line instead of the GUI |
Often
power users want to start with the text or DOS based style login not
xwindows. |
key
words: text login, text only login, command line login, text
logon command logon…. etc. |
vi /etc/inittab and change
the line that says, Fedora tested 4/2002 works fine. |
|
logro |
this is one of the standard system maintenance
routines. look in the /etc/cron.daily/ directory and you
will see a list of daily jobs that can be modified or you could add your own
routines there. Any “job” or batchfile
that you add there will automatically be run daily by the system. |
Same
notation for /etc/cron.weekly/ and /etc/cron.monthly/ folders. |
|
|
lpstat |
shows
pending print jobs in the queue |
you
can kill print jobs |
lpstat
<Enter> now
take a job # and type lpstat lj-1756 lj-1756
is an example of a made up job # |
|
ls
(also
see dir) |
list
or directory list |
-R recursive search just like dir /s in ms dos world! Very useful option!!! ls
–a1 | less -1
display one file or folder per line. B move back Space
Bar to move forward q to
quit!!! Great cmd to search for part of a file
ls
-all *ilenam* will return files called filename, coolfilenames.doc, etc. |
less is same as dir /p in ms dos says show me a page at a time. And
finally: use
ls to see the date, and time, individual and group ownership of an individual
file: ls
-all filename.txt ls -R -all search
all dir’s for a file do this: ls -R -all | grep .txt ß
will find all .txt files. WARNING: do
no use wildcard characters with grep or quotes. *.txt will match nothing. instead use .txt
or filename.txt type search item exactly as it will appear. |
|
man |
FILLIN |
FILLIN |
|
|
mkbootdisk
|
to
make a bootable system floppy disk |
you can create a new boot disk by logging in as root and
executing the command mkbootdisk. You need to
know your kernel version and your floppy device (usually /dev/fd0). Use the uname -a command to
display your kernel version as in this example session: my kernel is : 2.2.16-22 mkbootdisk
--device /dev/fd0 2.2.16-22 Note you may need to unmount you floppy disk first: umount /dev/fd0 and that’s NOT UNmount
but Umount - but typed all in lowercase I’m just emphasising the U vs UN. Also, if your in any
version of xwindows exit first then run this from the bash shell. |
In
Linux, the floppy drive is referred to as /dev/fd0. uname –r (TO Discover which Kernel version you are
using) mkbootdisk
--device /dev/fd0 2.2.x-yy Finally:
Test the disk. I tested mine and it
failed with “Error 0x10” - this typically indicates a problem with the floppy
disk itself (or possibly the floppy disk drive). So I did a full format of the disk under
windows then re-ran the process under Linux and test booted it and it worked
fine. so test yours! |
|
more
and
the | or “pipe” command |
lets you see output that is longer than one page
just one page at a time works exact same way dos. also Shift+PageUp will let you scroll backup to
see previous pages. Tip: if you do
this at the start of Linux you can see all the start up screen messages. |
‘|’
the pipe symbol. Read from left to right.
The output of
command on the left becomes the input for the command on the
right. TIP:
Did you know when you use more to display one page at a time that you can use
enter and space bar to scroll. ls
-all | more <Enter> now pressing Enter again will scroll down one
line at a time and pressing space bar will scroll one page at a time! |
ls
–help | more <Enter> |
|
mount
(see also umount - cmd to unmount) (mount
point) is a directory that can be located on almost any partition or
directory but normally you should go to /mnt directory and then create a new directory such as
‘ext1dos’ for example for a ms dos logical drive in the extended partition. |
mounts a device like a: hard drive, floppy drive, or
CD Linux
does some of this automatically but sometimes you will need to do it
manually. Drive
Labels: (IDE Drives) physical
hard drive #1: /dev/hda
physical
hard drive #2: /dev/hdb physical
hard drive #3: /dev/hdc physical
hard drive #4: /dev/hdd (the normal limit is 4 IDE drives for a PC). SCSI
drives are same as above but are labeled ‘sd for SCSI drive instead of HD. Partition
Numbers: 1-4 are the 4 primary partition's. 4 is special because it can be designated
as an extended partition (ext) and then can contain logical drives which will
receive the number 5 for the 1st logical drive, 6 for the next and
so on. Example: /dev/hdb2 =’s second
primary partition on the second IDE drive. /dev/hda5
=’s first logical drive in the extended partition on drive1. |
To
mount the floppy disk: mount /dev/fd0 /mnt Then cd to /mnt and the contents of the floppy disk will be
available. If you have a MSDOS disk that you want access to, you
can use the command: mount -t msdos /dev/fd0 /mnt To check and see if it mounted you can cd to the
directory and type 'ls' and see if
the contents have changed or type df to see a nicer list. When you are done with the floppy disk, you will have
to unmount it from the file system. To do this type: umount /dev/fd0 OR umount /mnt Either one will successfully unmount the file system.
You cannot unmount a file system while you are in the directory that the
filesystem is mounted to. This will give you a device busy error. You will
have to cd out of that directory before unmounting it. Note the name of
the command is 'umount' and not 'unmount' -- this is often a source of frustration with new
users of Linux. Now when you cd
to /mnt it should be empty. |
Warning
Experienced Users’ only! Here’s
a sample of creating then mounting a partition: Caution be careful when using
fdisk that you are working with had aka the floppy disk and not your hard
drive! 1. bash# fdisk /dev/hda 2. bash# mkdir /test 3. bash# mount /dev/hda1 /test 4. bash# ls /test 5. You should see root-partition list like this - 6. bin fd lib mnt proc sbin usr 7. boot dev etc home lost+found opt root tmp var Create
a mount point: mount
–t vfat /dev/hda1 /mnt/vfat <Enter> mounting
an extended drive: mount
-t vfat /dev/hda5 /mnt/xxx
<Enter> mount
floppy MS-DOS disk: (-t MS-DOS is optional, if the disk is ms dos format) mount
-t MS-DOS /dev/fd0 mnt/floppy
<Enter> TIP:
type vi /etc/fstab <Enter> Now
you can view the contents of your File System Table or fstab. Be careful, if you want to make changes
make a backup copy of the file first in the same directory and don’t change
the main system ext2 or swap partitions. In
this file you can set additional DOS partitions you might wish to use or
store data on such as user home directories. 1.
start Linux and open terminal window or start with
command prompt if windows not loaded.
Good method if you need to load a video driver because your kde
xwindows won’t start. 2.
logon as root 3.
make a directory called USB as follows: md /mnt/USB 4.
plug-in the USB device and type dmesg which will
display the system message if the system recognized the USB device. 5.
typical USB mount for 1st device, assuming
you are not using a USB mouse/keyboard etc. 6.
mount -t vfat /dev/sba1 /mnt/USB <Enter> there should be
no messages - error or otherwise. Note: sba1 the 1 means partition 1. 7.
type ls /mnt/USB you should see the contents of
the device. 8.
if successful type cd /mnt/USB <Enter> 9.
Done, if it didn’t work type dmesg and look back and see what
the device was mounted as. |
|
mouseconfig |
Run
from the shell prompt to configure your mouse. |
|
mouseconfig <Enter> Use Tab to move cursor around and Enter to
press button. |
|
MySQL |
Great
open source Database Server. Not installed in Fedora by default. You dnload and install it from www.MySQL.com. Note:
You also NEED to dnload the client rpm also in order to run the essential mysqladmin
utility. |
|
|
|
Network
card configure
manually |
Method
to configuring your network card manually.
1 discover Linux driver name.
Ex my card is an Intel pro 100b.
the driver name is ‘eepro100’ edit
/etc/modules.conf |
Add
the following line: alias
eth0 eepro100b note this assumes you are using a PCI nic not an
old ISA. Search online for similar
directions. edit(create)ifcfg-eth1 vi
/etc/sysconfig/network-scripts <Enter> |
add
the following: DEVICE=eth0 IPADDR=192.168.1.1 ONBOOT=yes edit: vi
/etc/sysconfig/network NETWORKING=yes FORWARD_IPV4=yes last: etc/rc.d/init.d/network
restart <Enter> type
ifconfig eth0 <Enter> |
|
nfs |
Network
File System - this is the main way Linux to Linux pc’s share or “export”
files. |
create
a sample share folder ex: mkdir
/nfs_share <Enter> edit
the exports file: vi /etc/exports
<Enter> Allow
no spaces. Any blank lines should
begin with ‘#’ # /nfs_share
(rw) <--
Best method! Simple # but insecure. # or
by IP addr /nfs_share
192.168.0.10() |
client side mounting the remote Linux pc’s share
from a Linux pc! mount
hostname:/nfs_share /mnt/remotepc_nfs_share <Enter> See:
http://www.saragossa.net/LinuxG3/ls-nfs.shtml |
|
ntsysv
(services manager run from dos/shell prompt) |
List
of services starting automatically, you can add or remove from the list of
services which start automatically |
|
vital for samba to make sure “smb” is set to start
automatically each time the system starts. |
|
path (please see “Script, how
to run it!) |
Setting
the system path in Fedora Linux. First
be aware that programs can be executed by typing there name ONLY if the
directory where they are located is in the path. This is similar to ms dos |
The settings for all users are in /etc/profile, including
the path stmt. path arguments are separated by the colon. also add the thing about making scripts from for dummies book. |
vi /etc/profile just follow the existing syntax if you add
directories to the path or remove them. WARNING: Always make a backup
copy of any critical system file BEFORE you edit them!! Ex cp
/etc/profile /etc/profile_bk <Enter> AND:
put a comment in the file you edit with the date and time you made the change
and the reason!!! This way if you look
back at a system log and say hey this err message started on |
|
Pipe Symbol ‘|’ |
pipes
the output that would result from typing one command like dir or fine –name
“some filename” and lets it be used as the input for the next command |
FILLIN
A GOOD USEFUL SETUP USING REAL DEFAULT FILES |
. Example first search for all files less
than 100kb in size | now pipe that output to the sort command which will sort
their names alphabetically and finally | pipe that list to a text file so I
can have it saved. |
|
ps (see kill, and services also). |
process? |
ax |
ps ax | more this will show a list of processes
running one page at a time. |
|
pwd |
Print
Working Directory this cmd shows the full path of where you are located the
Linux prompt only shows just the
current dir name |
none |
pwd
<Enter> WARNING: be careful, Linux DOES
NOT put the full path in the command prompt like dos does. It only puts the current dir in the prompt
so always type pwd to see the full path so you know where you are with out
guessing! |
|
Redirector Symbol. ‘ > ’ (note it works in both Linux and windows in a very
similar way) |
Redirect
output. Why would you want to do this? If
you like working in windows because you know how to do get around well. You may need to check for a file or
something in Linux and want to dump a directory’s file list to a text file
then move on to a --> |
--> floppy disk or over a network to windows to examine
in a word processor like ms word for example.
Or make a help file like this file with out having to type the exact
error message all over etc. |
Example:
in windows then Linux. Each ex shows a
directory list but instead of being outputted to the screen it is
“redirected” or piped to windows:
dir > directory.txt <Enter> to
see contents: edit directory.txt <Enter> Linux: ls -all
> directory.txt <Enter> to
see contents: vi directory.txt <Enter> |
|
Removing
Linux |
It
is not enough to use ms dos boot disk and fdisk to delete all the Linux
partitions (option 3 delete and 4 non-dos partitions) you must also fix the
boot record |
|
after
deleting unwanted Linux partitions boot with a ms dos disk (which must
contain the fdisk command) and type fdisk /mbr this means rebuild the master
boot record if it still won’t boot ok then reboot from the dos disk and type sys c: (you will need the sys.com program copied
on to the disk ) |
|
rm
(delete) |
Re
Move file or directory |
-r
recursively descend into sub directories to delete files. -f
force and NEVER Prompt. Never prompting is needed more than you might
realize. Try making a directory called
dir1 then make a directory inside it called dir2 so it should look like
…/dir1/dir2 now type rm –rif (which is
same as rm –r –i –f) -d
to remove directories; but forget it. It always fails for me with the error “rm:
cannot unlink ‘/dir_delme’” instead just use rm –ri or rm –rif -i will prompt you before deleting good safety
net |
rm
–d –r /directory-name rm
–ri filename rm
-r -f directory-name or
rm
-rf directory-name or rm -ri to remove file or directories and always
get prompted first. TIP:
if your lazy and have a bad memory you might want to do this: edit
your alias file for a particular profile and add the ms dos equivalent (sort
of) alias
then you can just type TIP:
To make your aliases file available for everyone on your system do the
following: chown
mrbios:mrbios aliases chown
mrbios:mrbios aliases.db where mrbios is an ordinary user with no special
access. |
|
rm ( |
delete
files |
|
|
|
route Route
comes into play mainly when you have two or more network cards installed and
active (If
you get a LONG PAUSE after typing this and pressing enter you probably have
some invalid routes, be patient it may take a minute or so to show what
routes are available.) |
Beginners
– Skip right over this. This is an
advanced topic and is most likely of very little use to you anyways. This
is an advanced command. To really “route” between two “network” or physical (not
logical) networks requires 3 pc’s, 2 hubs (which are not joined with a
network cable – that is the router’s job. And
finally a Linux box/pc with 2 network cards. Yes
Linux can make the PC act as a Router.
Route with no arguments shows the routes that Linux currently has
mapped to get IP packets from one subnet (or network) to another. |
What
is shown in the example is how to add a “route” to a network or IP subnet. To
delete a route type the same thing as on the right to add a route but instead
of –add type – -n , route –n
<Enter> verify that your routes are setup correctly. BEFORE
THE ROUTE TAKES EFFECT: you must at least stop and restart the network card
services. ifconfig
eth0 down ifconfig
eth1 down then
ifconfig
eth0 up ifconfig eth1 up. Often
I find I need to restart Linux all together before the route really works. If
you try to add the same route twice you will get the error “SIOCADDRT: File
Exists.” This is just telling you the route is already mapped. Not to worry. |
“route
add –net 192.168.1.0 netmask
255.255.255.0 dev eth0” <Enter> Now
add a second route on the second network card. “route
add –net 192.168.2.0 netmask
255.255.255.0 dev eth1” <Enter> Tip:
type what’s “inside the quotes” but not the quotes themselves. SAMPLE
ROUTES (Two Network Cards installed): route
add –net 24.130.184.55 netmask
255.255.255.0 dev eth0 route
add –net 24.130.184.56 netmask
255.255.255.0 dev eth1 or
you can edit files to setup and chg routes: /etc/sysconfig/network-scripts/ifcfg-eth0 |
|
rpm (see install) |
Fedora
Package Manager – Use to install, Update or remove packages from your system. What
IS an SRPM and why should you use it over an RPM? There are four reasons why:
1.
The binary RPM is not available.++1(see footnote section at the bottom of
this doc) 2.
The RPM you try to install complains about library and dependency problems. 3.
You want to make changes to the source code. 4.
You want to optimize for a particular CPU. |
-qa (see a list of all packages installed and
their version number) (run rpm -qa | more <Enter> to find the exact pkg
name so you can run the uninstall. or
better yet: rpm
-qa | more | grep -i partialpkg_name <Enter> (-i
means Case insensitive) so to uninstall MySQL… rpm
-qa | more | grep -i mysQl <Enter> -e
packagename – will uninstall a package -Uvh
– use to upgrade a software package ex
rpm –Uvh newerapplication-2.2.i386.rpm Normal
Install: rpm
--install linuxconf-1.25r7-3.i386.rpm <Enter> TIP:
The uninstall name of a pkg ex: “MySQL-3.23.49a-1.i386.rpm” is the same except you drop .i386.rpm rpm -e MySQL-3.23.49a-1 <Enter> will do
the job. As always watch out for
upper/lower case! It must be exact! |
rpm
–qa rpm –qa > installedpkg’s.txt (puts output into a text file). rpm –e sendmail (will uninstall sendmail pkg). Going
from SRPM to RPM:
[root]#
rpm -e linuxconf-1.25r7-3.i386.rpm error:
package linuxconf-1.25r7-3.i386.rpm is not installed This
common error is the result of trying to uninstall a package that is NOT
installed, or the uninstall is damaged. The
proper way to install is: rpm
--install linuxconf-1.25r7-3.i386.rpm <Enter> |
|
samba (see Samba below)
(also
see NFS or Network File System - which is the native UNIX file sharing
method) |
Also
Known As SMB Services – Basically allows 2 way communications between Linux
and Microsoft Windows 95, NT4, W2K. Setting
up Users: useradd
-s /bin/bash -d /home/"userid" -m passwd
"userid" Enter
Password: <pw> smbpasswd
-a "userid" Enter
Password: <pw> |
search for Special “Samba Services Info” section
below this table chart. |
/etc/rc.d/init.d/smb
restart <- Fedora This
restart should immediately reflect the changes you have made to the smb.conf
file. Note:
on the windows side you will often need to close connection in explorer to the Linux
pc then reopen it. Just refreshing the
windows may cause error message that the share is no longer available. |
|
Samba
(smb) Networking
with Windows 95 and Fedora Linux |
If
you want to connect to win95 PC or nt4 and maybe nt5 or win2k you must setup
your Note
the host or PC name is not set in smb.conf but rather /etc/hosts file How
do I see my Current Ms Windows compatible Shares from Linux? Type: smbclient
-L hostname -U% <Enter> If
prompted for a password just press <Enter> ‘hostname’ must be replaced with the (netbios?) name of
your computer. Example:
smbclient
-L fedora -U% <Enter> |
N/A TIP:
copy this file before you edit or make changes to it. Do so with this command cp
/etc/samba/smb.conf /etc/samba/smbbackup.conf type ntsysv <Enter> and then use tab and the space bar to
“check” smb and snmpd to start automatically.
Then you must click Ok to save then shutdown and restart Linux. To
test: samba first can you ping your IP address from Linux ping your.IP.address.number
from the Linux box and a windows pc. next
on the Linux box type: Smbclient
–L yourlinuxhostname
–U% in version 7 you will probably get an “ssn” error message but some
default shares should be listed like [home] and a work group called [Myshare]
keep in mind it is a good idea but NOT necessary to have a DNS or netbios
name server setup. search this document for “smbclient” |
shares
in a file called smb.conf sensible
way to edit it is TYPE: vi
/etc/samba/smb.conf <Enter> For
a real quick simple start don’t change the file when you get samba services
started a share will appear with the host name of your computer ex mine is fedora
and a workgroup will appear in network neighborhood called by default “myshare”. FILLIN <see sheet to walk you through setting
up a Microsoft windows compatible share> My Shortcut: alias restartsmb= '/etc/rc.d/init.d/smb
restart; Manual method Type: /etc/rc.d/init.d/smb
restart <Enter> |
|
scandisk
|
the
equivalent in Linux is called fsck.ext2 or fsck or e2fsck see fsck.ext2 in this table to find out how to
use it. |
|
|
|
Scripting, how to run it! equivalent
to windows batch files or *.bat ex autoexec.bat In
Mac OSX / Darwin FreeBSD Unix environment the path is set in /etc/profiles
file. You must use sudo if you’re not logged on as root /etc/… NEVER
edit this or any sys config file without making a bkup first. Ex:
sudo cp /etc/profile profile.bk1 <Enter> then sudo pico /etc/profile <Enter> Ctrl+X to exit Y to save. |
First
be aware that programs can be executed by typing there name ONLY if the
directory where they are located is in the systems “run path” (you can
determine this by typing which madeupfilename <Enter>
at the shell prompt. The answer will
say no madeupfilename in (usr/…. Your system path will appear
in the parenthesis) TIP:
before trying these examples be sure you verify and
know what directory you are working in!
pwd <Enter> will print the
working directory (full path). The
Linux command prompt does NOT do this like dos does. |
However,
in ms dos you can execute any “batch file” or program if you switch to the
directory where the batch file is located.
In Linux the app will NOT execute even if you are in the directory (if
that directory is not mentioned in the system Path s TIP:
warning. It is ez to be fooled by
Linux if you are used to DOS. Lets say
you have a file that has been made executable in a directory called /scripts so the full
path and file name is /scripts/myscript.fff.
you test it and it works fine (it says Hello
World! [echo Hello World!]. You type which myscritps.fff
<Enter> and
indeed the system confirms that /scripts directory is in the system’s
search path. Create
a disposable folder called /delme at the root, type cd /delme. Create a script that echo’s good bye! [ echo
goodbye] Confirm
the file/dir is not in the search path by typing which myscript.fff. now you make the script executable by typing chmod +755
myscript.fff. Now
you run the script by typing myscrip.fff <Enter> the screen should say
Hello World! because the system NEVER looked in the
current directory for myscript.fff rather, it searched the directories listed
in the system search path, completely unlike DOS which always looks in the
current directory first then the search path if it doesn’t find a match. To be sure what script you are actually
runnint type ./scriptname <Enter>
|
You
can execute it if you preface the script or program or “batch file” with “./” ex to run a script (text file with commands
in it) called myscript.txt type ./myscript.fff <Enter> To
make it “executable” you MUST type chmod 755
myscript.fff <Enter>
this # 755 adds executable the property.
This is very important for cgi perl scripts!! Now you can run the script
from the shell prompt by typing ./myscript.fff (if you are in the same
directory as the script, if you are not then you can execute it by typing the
full path to the file name ex: /scripts/myscript.fff
<Enter> you do not and should not use “./” when you are typing the full
path to the file. Once
again this is very different from ms windows / DOS since the extension in
Linux does NOT tell the system what kind of file it is as opposed to windows
where a batch or script file must end in *.bat. |
|
sendmail |
Email
Server for Internet Mail |
When
you are finished, use the m4 macro processor to generate a new sendmail.cf by
executing the m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf command /etc/aliases
run newaliases to update sendmail. my
internal url http://rhlinux9.domain1.com sendmail
-d0.1 -bv root | grep SASL |
/etc/mail/sendmail.mc /sbin/service
sendmail restart |
|
service
- start starting Stop stopping see
also ps |
This
shows the method for starting and stopping a service. |
just
type service <Enter> and you will get a short but useful list --status-all
will list all services and whether they are running or not --full-restart restart, self explanatory. start stop
|
service
xinetd restart service
httpd restart <Enter> don’t
forget to type ‘service’ will restart / recycle the Apache web server (if you’re not sure if
it is running see ntsysv and be sure httpd[*] has a star next to it to show
that it is set to start). TIP:
to see a list of currently running services a page at a time type ps ax |
more <Enter> Warning:
don’t just randomly pick just any service to recycle - it may corrupt or
crash your system. TIP2:
service --status-all > runningservices.txt <Enter> This
will pipe out all the |
|
setterm (screen
saver - shell prompt adj time) |
Great
“look and feel” preference setting cmd for your DOS shell prompts. You can type it at cmd line or add it to a
file to make the pref chg perm. |
setterm <Enter> to see full list. -blank
is useful sets the time out to blank screen or set to never if you prefer. Adding to this
file did not work on my system. What
did work was simply typing the setterm command at the shell prompt / command
line and pressing Enter: Temporary Setting: (persists until logging
out or rebooting) setterm -blank 0 -store
> /dev/tty1 <Enter> don’t forget to reenter
the command for each virtual terminal ex: setterm -blank 0 -store
> /dev/tty2 <Enter> all the way through tty6 vi
/etc/rc.d/rc.local <Enter> add
the following lines for each terminal: setterm -blank 20 -store
> /dev/tty1 and so on… through
/dev/tty6 setterm
-blank 0 -store > /dev/tty6 |
setterm -blank 10 <Enter> [0-60min
are valid intervals] in one min of no activity your screen will blank. Note:
It mainly makes sense for home use, where you reboot daily, to edit the file
so the change is permanent: vi
/etc/rc.d/rc.local <Enter> add
the following lines for each terminal: setterm
-blank 20 -store > /dev/tty1 NOTE:
I had a problem where the terminal setting of the last entry (tty6) over-wrote
all other previous settings (i.e. tty1-5) settings. |
|
setup |
Super
valuable DOS/shell prompt config tool to run in DOS if you need to chg config
settings including services - this is very important if Xwindows cannot start
do to a misconfigured system. |
|
setup |
|
shell change |
How
do I know what shell I am in? FILLIN How
I move from one shell to another and then get back? |
csh
– C shell bash
– Bash shell sh – Borne Shell ? sh – the prompt changes. Note
when you login as a “regular user” vs. a superuser like root – you will see the command
prompt change. service
SERVICENAME status <Enter> |
at any shell prompt type csh
<Enter> this puts you in the C shell.
Next type exit and you will return to whatever shell you were
previously in (which could even be the c shell). Now type sh <Enter> for the Borne ? shell…. and so on. you will notice the up and down arrow keys don’t work in
the Korn shell. service
httpd status <Enter> TIP:
Type exit <Enter> once to many times and you
will be logged off the system. |
|
Shift+PageUp |
|