Saturday, February 28, 2009

Class 10 The gnu-Linux File System


The first thing that most new users shifting from Windows will find confusing is navigating the Linux filesystem. The Linux filesystem does things a lot more differently than the Windows file system.This article explains the differences and takes you through the layout of the Linux filesystem.there is only a single hierarchal directory structure.Everything starts from the root directory, represented by '/', and thenexpands into sub-directories.Windows, the various partitions are detected at boot and assigned a drive letter. Under Linux, unless you mount a partition or a device, the system does not know of the existence of that partition or device. This
might not seem to be the easiest way to provide access to your partitions or devices but it offers great flexibility.

the file system can be classified accourding to the purpose
1)Sharable/Variable
2)Unsharable/Static For eg:

                    Sharable                        Unsharable
..................................................................................
Static           /usr                                    /etc                      
                    /opt                                    /boot

..................................................................................
Variable     /var/mail                             /var/run
                   /var/spool/news                  /var/lock


We cant load them in a different file system location(partition) for eg, we cant load /etc & /lib in other partiotion.it should be under / the (root).here is the list of files n directories under / for fedora linux:

bin
boot
dev
etc
home
lib
lost+found
media
mnt
opt
proc
root
sbin
selinux
srv
sys
tmp
usr
var

some explanations:
/usr->Unique System resource
/etc->Configuration files
/opt->Optional packages
/boot->boot files
/var->variable
/bin->essential executables for every user & to be used in single user mode
/sbin->essential system executables
/lib->essential shared libraries & kernel modules
/boot->static files of bootloader
/dev->device files & scripts called MAKEDEV,device types-c,h,d,b,l

the major no: & minor no: is used by kernel to identify a device
Major no:- it is an indication for which device driver should be used to acess a particular device.
Minor no:- is which tells the kernel the special characterstics of the device to be acessed.

to know the malor & minor no: of a device :- ls -la 'device name' eg: ls -la sd*

we should be familiar with the most of the files n directories under /etc. These files are of high imoprtance and should be modifiled for administration and for trouble shooting! the files n directories under /etc for fedora are:

adjtime
aliases
aliases.db
alsa
alternatives
anacrontab
anthy-conf
asound.conf
asound.state
at.deny
audisp
audit
avahi
bash_completion.d
bashrc
blkid
bluetooth
bonobo-activation
chkconfig.d
ConsoleKit
cron.d
cron.daily
cron.deny
cron.hourly
cron.monthly
crontab
cron.weekly
csh.cshrc
csh.login
cups
dbus-1
default
depmod.d
dhcp6c.conf
DIR_COLORS
DIR_COLORS.256color
DIR_COLORS.xterm
dirmngr
dnsmasq.conf
dnsmasq.d
dumpdates
enscript.cfg
environment
esd.conf
ethers
event.d
exports
favicon.png
fb.modes
fedora-release
festival
filesystems
fonts
foomatic
fstab
gconf
gcrypt
gdm
ghostscript
gimp
gnome-vfs-2.0
gnome-vfs-mime-magic
gnupg
gpm-root.conf
gpm-syn.conf
gpm-twiddler.conf
gre.d
group
group-
grub.conf
gshadow
gshadow-
gssapi_mech.conf
gtk-2.0
gtkmathview
hal
host.conf
hosts
hosts.allow
hosts.deny
httpd
idmapd.conf
init.d
initlog.conf
inittab
inputrc
iproute2
issue
issue.net
jwhois.conf
kde
kernel
kerneloops.conf
krb5.conf
ldap.conf
ld.so.cache
ld.so.conf
ld.so.conf.d
lftp.conf
libaudit.conf
libuser.conf
localtime
login.defs
logrotate.conf
logrotate.d
logwatch
lvm
mail
mailcap
mail.rc
makedev.d
man.config
mime.types
minicom.users
mke2fs.conf
modprobe.conf
modprobe.d
motd
mtab
mtools.conf
multipath.conf
netconfig
netplug
netplug.d
NetworkManager
networks
nscd.conf
nsswitch.conf
nsswitch.conf.bak
ntp
ntp.conf
obex-data-server
openldap
openvpn
opt
PackageKit
pam.d
pam_pkcs11
pam_smb.conf
pango
passwd
passwd-
pcmcia
pki
pm
pm-utils-hd-apm-restore.conf
PolicyKit
popt.d
portreserve
ppp
prelink.cache
prelink.conf
prelink.conf.d
printcap
profile
profile.d
protocols
pulse
purple
quotagrpadmins
quotatab
rc
rc0.d
rc1.d
rc2.d
rc3.d
rc4.d
rc5.d
rc6.d
rc.d
rc.local
rc.sysinit
redhat-release
resolv.conf
rmt
rpc
rpm
rsyslog.conf
rwtab
rwtab.d
samba
sane.d
sasl2
scim
scsi_id.config
securetty
security
selinux
sensors3.conf
services
sestatus.conf
setroubleshoot
setuptool.d
sgml
shadow
shadow-
shells
skel
smartd.conf
smolt
smrsh
sos.conf
sound
ssh
statetab
statetab.d
stunnel
sudoers
sysconfig
sysctl.conf
system-release
system-release-cpe
terminfo
udev
updatedb.conf
virc
vpnc
warnquota.conf
wpa_supplicant
wvdial.conf
X11
xdg
xinetd.d
xml
yp.conf
yum
yum.conf
yum.repos.d


Most of the configuration files for the system lies under /etc.  So please be sure before you edit them, or else take a back-up of it and edit to feel the changes on your system :)
tell2humanlinux@gmail.com

class 9 Answers

will be updated soon!

Thursday, February 19, 2009

Class 8 A few exercises.

Here let us do some exercises using the commands i have mentioned in the above classes.Please try yourselves, answers will be posted in next class!

1)list the last modified file at the beginning.(last modified file should be listed first)
2)descent the files according to its size.
3)to list the files and directories in a list and not in lines
4)to make directories recursively or like a tree ,one inside the other in a single command(ie a ,b inside a,c inside b ...etc)
5)needs to find all the .txt files in the current directory and copy it to a file in a single command
6)to list the files belonging to a user using uid
7)to copy all the files except the directories to a folder
8)to know the disk usage of the current folder


tell2humanlinux@gmail.com

Tuesday, February 17, 2009

Class 7 continued

cat >filename :to i/p the items to a file, but replaces the old data.
cat >>filename :will append the files,wont delete old data.
cat file1 file2 >file3 :file3 contains o/p of file file1 & file2 which are concatenated.
sort : hit enter, n type the data, n press ctrl D . it will sort the data alphabetically.
sort :will sort the contents of 'file' alphabetically.
who | sort :here a pipe '|' is used to o/p the sorted list of users.
host www.website.com : to display the static ip of a 'website'.
grep: to seach inside a file
grep -i "word" file : will search for files with "word" within a directory recursively.
grep -r "word" /etc :will search for "word" inside /etc, recursively.
grep 'word' *.c : to search for files with particular extension *.c
man heir :to know file system hierarchy.

next i wil post the file system hierarchy,some more commands n files.

tell2humanlinux@gmail.com

Saturday, February 14, 2009

Class 6 more commands!

More commands:

Here I am discussing some useful commands that might be helpful to work with,And some explanations for them.*NB: use tab to get the complete list of possible commands
for eg: if we pres tab, after typing 'trace' , will list the possible commands like
tracepath,tracepath6, traceroute, traceroute6. Then type the next letter n tab to display the correct command!

ifconfig:ifconfig (short for interface configurator) serves to configure and control TCP/IP network interfaces from a command line interface (CLI).
here is the screen short for the ifconfig command result--->

lspci:lists PCI devices in the system, pci --v gives more detailed
description.
lsusb:lists the usb port details,lsusb --v
gives more detailed description.
tty:to find the terminal location
type command :shows the type of the command "command".
eg: type reboot shows the result /sbin/reboot,(sbin will be described in the file system,later)
ls -R :recursive listing
ls -r :reverse listing of files directories
ls -lt:longlisting with last modified file at first
ls -sSt: size in bytes,Sorted,longlisting
ls -F:to classify accouirding to directories n files
ls -lh:lists in human readable format

rm -r dir :removes the directory, but wont work if it is empty.
rm -rf dir : removes the directory dir recursively and forcefully.
mkdir -p dir1 dir2 dir3 :makes directories dir1,dir2 and dir3 in a single command
findfs LABEL=/ :to search the file system using label or UUID(universially unique identifier)
dumpe2fs /dev/sda1 | more :shows the UUID for the device dev/sda1, | more is used to show the output of the first command. ' | ' is called as grep which is used to input the output of the first command.
su username : to switch the user to username,su(substitute user)
su - username :goes to the home directory of the username
less /etc/services : will lists all available ports and to which it is assigned to.
ps :shows current running process
ps -aux : all user server process
top :lists live processes

tell2humanlinux@gmail.com

Class 5 gnu-Linux basic commands

Linux Basic Commands!
There are two kinds of commands used in gnu/Linux: Built-in Shell Commands and Linux Commands.
Please note: Commands might vary somewhat in syntax and usage from one distribution of Linux to another, and from one type of shell to another. The command libraries here are provided as general references. Use the 'man command' to see how a command is used in a particular shell and on your particular Linux distribution. This session doesn't covers all commands in gnu-Linux, it just covers the basic commands used to work with for a normal user! I have categorized the commands as:
  1. FILE OPERATION COMMANDS
  2. SYSTEM INFO
  3. PROCESS MANAGEMENT
  4. FILE PERMISSIONS
  5. COMPRESSION
  6. NETWORK
  7. INSTALLATION
  8. SHORTCUTS
  9. SSH
  10. SEARCHING
1)FILE OPERATIONS:
ls – directory listing
ls -al – formatted listing with hidden files
cd dir - change directory to dir
cd – change to home
'cd -' - to goto the previous directory
cd . - current directory
cd.. - previous directory
pwd – show current directory
mkdir dir – create a directory dir
rm file – delete file
rm -r dir – delete directory dir
rm -f file – force remove file
rm -rf dir – force remove directory dir *
cp file1 file2 – copy file1 to file2
cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it doesn't exist
mv file1 file2 – rename or move file1 to file2 if file2 is an existing directory, moves file1 into directory file2
ln -s file link – create symbolic link link to file
touch file – create or update file
cat > file – places standard input into file
more file – output the contents of file
head file – output the first 10 lines of file
tail file – output the last 10 lines of file
tail -f file – output the contents of file as it grows, starting with the last 10 lines

2)SYSTEM INFO:

date – show the current date and time
cal – show this month's calendar
uptime – show current uptime
w – display who is online
whoami – who you are logged in as
finger user – display information about user
uname -a – show kernel information
cat /proc/cpuinfo – cpu information
cat /proc/meminfo – memory information
man command – show the manual for command
df – show disk usage
du – show directory space usage
free – show memory and swap usage
whereis app – show possible locations of app
which app – show which app will be run by default

3)PROCESS MANAGEMENT:
ps – display your currently active processes
top – display all running processes
kill pid – kill process id pid
killall proc – kill all processes named proc *
bg – lists stopped or background jobs; resume a
stopped job in the background
fg – brings the most recent job to foreground
fg n – brings job n to the foreground

4)FILE PERMISSIONS:
we can assign permission for every file and directories.It means that we can define a file/dir as read-only,write only,execute-only or several combinations of it.

chmod octal file – change the permissions of file
to octal, which can be found separately for user,
group, and world by adding:
● 4 – read (r)
● 2 – write (w)
● 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world
For more options, see man chmod.

5)COMPRESSION:
we can compress a file/Dir to reduce its size using just simple commands, no s/w's needed like windows,be careful with the options used.

tar cf file.tar files – create a tar named file.tar containing files
tar xf file.tar – extract the files from file.tar
tar czf file.tar.gz files – create a tar with Gzip compression
tar xzf file.tar.gz – extract a tar using Gzip
tar cjf file.tar.bz2 – create a tar with Bzip2 compression
tar xjf file.tar.bz2 – extract a tar using Bzip2
gzip file – compresses file and renames it to file.gz
gzip -d file.gz – decompresses file.gz back to file

6)
NETWORK:
netstat - to know the network status
ifconfig - to find the ip of our computer
ping host – ping host and output results
whois domain – get whois information for domain
dig domain – get DNS information for domain
dig -x host – reverse lookup host
wget file – download file
wget -c file – continue a stopped download

7)
INSTALLATION:
To Install from source:
./configure
make
make install

dpkg -i pkg.deb – install a package (Debian)
rpm -Uvh pkg.rpm – install a package (RPM)

8)
SHORTCUTS:
Ctrl+C – halts the current command
Ctrl+Z – stops the current command, resume with
fg in the foreground or bg in the background
Ctrl+D – log out of current session, similar to exit
Ctrl+W – erases one word in the current line
Ctrl+U – erases the whole line
Ctrl+R – type to bring up a recent command
!! - repeats the last command
exit – log out of current session

9)
SSH:
ssh user@host – connect to host as user
ssh -p port user@host – connect to host on port
port as user
ssh-copy-id user@host – add your key to host for
user to enable a keyed or passwordless login


10)
SEARCHING:
grep pattern files – search for pattern in files
grep -r pattern dir – search recursively for
pattern in dir
command | grep pattern – search for pattern in the
output of command
locate file – find all instances of file


*please use the commands careafully.Be caution with the options used.

For more options for the commands look 'man'.

tell2humanlinux@gmail.com


Class 4 do's on gnu-Linux?


Reasons for choosing Linux | advantages of linux | Linux gaming | Linux Music Player

Linux Games , Linux music players , features of Linux , why Linux is less virus infected ,

Linux is Less virus infected:

To be very precise about this point,I should say that Linux is multi user operating system by linux less virus and advantagesbirth itself, whereas Windows got transformed to a multi user OS from its original Single user model. Many of those Single user design is still used in modern version of windows.

So if a virus infect a Linux system it is limited to that particular user alone where as in windows access to system files and access to every users is pretty easy. Hence the consequences of virus attach can be much more.

No cost for your operation system:
We have different options to get free linux OS , We may need to pay for support but If you have a good Linux administrator then Security can be handled by them.
Efficient package management system:-

RPM , APT are few efficient package management system implemented in different flavours of linux. These Pakcage management system help in unified and easy patching,More Open source support.Since Linux is developed with a open source concept , most of the applications are available freely. Regular updates are available freely

Different desktop managers:
In Linux we have option to select different desktops such as KDE , GNOME etc.

More security:
As discussed earlier security patches are available easily and freely,most of the Linux systems are secure. Even the patching is made easy with the help of different package managers.

Less restarts:
Most of the updates and upgrades can be done on the fly. so less restarts are required. This is very Ideal for servers.

Gaming support:
With the evolution of X-windows gaming in Linux developed to a far extent. Battle for wesnoth America’s Army A Tale in the Desert Second Life Open Racing .
In the next class i will be dealing with some basic commands that is needed to work with gnu/linux!
tell2humanlinux@gmail.com

Friday, February 13, 2009

Class 3 Getting Help!


Getting Help!

I was very disturbed when i saw the black screen of gnu/linux for the first time.I was used with the GUI of windows XP , which i was using for years. I thought windows was better,since its easy to work with. But time proved that i was wrong. The "Black Window" is so powerful and we can do what ever we would like to with the hepls of "commands".Every task is done using these commands. Comands are case sensetive. The gnu/linux has thousands of commands. Its very hard to remember these commands,so gnu/linux provides help for its users for easy and correct execution of it.
some of the helping agents are:
  • man
  • help
  • whatis
  • apropos
  • howto etc...
eg: 'ls' is a command to list all the files and directories.
the format of a command is - command -[option] [argument]
(command space - option space argument)
ls -a "file.txt"
here command is ls ,option is 'a' , and argument is file.txt.

so there are lots of options available to get different results for the ls commands.If we donno the options , we can ask for help by typing ' man ls ' which list all the detailed options and its explanations. The man pages are saved in the location /usr/share/man.when we goto the above location we can find several directories named as man1,man2,man3...man9 likewise.

Man Pages (short for manual pages) are a standard form of documentation found on most distributions of Linux and Unix. They are broken up into 9 sections as follows:

  1. Executable Programs or shell commands
  2. System Calls
  3. Library Calls
  4. Special Files
  5. File Formats and Conventions
  6. Games
  7. Macro Packages
  8. System Administration
  9. Kernel Routines

to know more about man pages ,just type "man man".

Commands:-
commands helps us to do our tasks .we can type the command after logging to the computer as the root or as a different user.A root is a user who has all the privileges on a computer, or else he is the administrator of a gnu/linux based system.After logging with the user name and password we can type the command.

The 'command line' is the line on which commands are typed in a console or terminal window. A command is an instruction given to  a computer to do something, e.g., to execute a program.

The functions of a command prompt are to inform the user that the system is ready for the next command, data element or other input and to help the user plan and execute subsequent operations.Prompts are found on the command line interface of any operating system that provides a CLI(Command Line Interface). This includes not only Unix-like operating systems but also MS-DOS and the various Microsoft Windows systems.

tell2humanlinux@gmail.com

Class 2 gnu-Linux Desktops



The image i have provided here is the desktop image of a gnome gnu/linux.There are several types of gnu/linux desktops

most commonly used enviornment is GNOME and KDE. KDE is more 3D enhanced that other enviornments .while downloading OS we can select GNOME oR KDE. In gnu/linux the GUI is considered as an application.One can switch between consoles by pressing Alt+Ctrl+(F1,F2,F3..F7 respectively.)

The Window Manager:-what is a window manager?

A window manager is a program responsible for coordinating all the windows on the screen.Some os them are:
FVWM,ICEWM,FLUXBOX,ENLIGHTMENT,BLADEBOX & METACITY .

better to work with the 'Black Screen than GUI, because it dont have any limitations!. 

tell2humanlinux@gmail.com

Class 1 GNU/LINUX Freedom


GNU/LINUX Freedom:

what makes the GNU/LINUX differ from Windows.
the answer is simple, its the "FREEDOM".
GNU-LINUX provides us several freedom:

freedom 0: The freedom to run the program for any purpose
freedom 1: The freedom to study how the program works & adapt it to our needs.
freedom 2: The freedom to redistribute copies ,so we can help our neighbors n friends!
freedom 3: The freedom to improve the program,& can deploy commercially.
lets grab our first freedom.
lets have a free copy of gnu-linux on our computer, run it ,& enjoy!
there are different versions of gnu-linux available for free:
some of them are:-
(click the links to download)
and many more. you can also order for a free disc by mail from www.ubuntu.com.
The downloads will be in the form of ISO file , burn it to a disc, put the disc in and reboot the computer. you can work with gnu/linux either without installing into hard disc ( booting it from the cd on restart) or installing it to the hardisk.

1.And for a desktop user, most importantly, the freedom from viruses, as long as    you use the software downloaded from the software repository of your OS :-) 
2. Multi-User Environment
3. Potability
4. Intimate knowledge of the hardware
5. No BSOD - Blue Screen of Death
6. Upgradeability
7. Customization
8. Security - viruses, worms and trojans
9. Maturity - Stable, Reliable (except for kernel upgrades, no reboot) and Extremely powerful
10. Support
11. Complete development environment while a C compiler for Windows alone    would set you back hundreds of dollars
tell2humanlinux@gmail.com

Introduction -

Linux is an operating system: a series of programs that let you interact with your computer and run other programs.The most important part of an operating system is the kernel. In a GNU/Linux system, Linux is the kernel component. The rest of the system consists of other programs, many of which were written by or for the GNU Project. Because the Linux kernel alone does not form a working operating system, we prefer to use the term “GNU/Linux” to refer to systems that many people casually refer to as “Linux”.

so here onwards let's say 'GNU-LINUX' instead of Linux. That's what i learn from my first class!


It beggined here:-

In 1984 Richard Stallman started the GNU project.He wrote GCC, emacs, bash etc..
The GNU is not a Unit. Bash is a free software Unix shell written for the GNU projects. Its name is an acronym which stands for "Bourne-again shell".

Linus Benedict Torvalds born in December 28, 1969 in Helsinki, Finland is a Finnish software engineer best known for having initiated the development of the Linux kernel. He later became the chief architect of the Linux kernel, and now acts as the project's coordinator.Authority on Linux

About 2% of the Linux kernel as of 2006 was written by Torvalds himself. Since Linux has had thousands of contributors, such a percentage represents a significant personal contribution to the overall amount of code. Torvalds remains the ultimate authority on what new code is incorporated into the standard Linux kernel.

Does Linux have a future? and what is open source?

The idea behind Open Source software is rather simple: when programmers can read, distribute and change code, the code will mature. People can adapt it, fix it, debug it, and they can do it at a speed that dwarfs the performance of software developers at conventional companies. This software will be more flexible and of a better quality than software that has been developed using the conventional channels, because more people have tested it in more different conditions than the closed software developer ever can.

The Open Source initiative started to make this clear to the commercial world, and very slowly, commercial vendors are starting to see the point. While lots of academics and technical people have already been convinced for 20 years now that this is the way to go, commercial vendors needed applications like the Internet to make them realize they can profit from Open Source. Now Linux has grown past the stage where it was almost exclusively an academic system, useful only to a handful of people with a technical background. Now Linux provides more than the operating system: there is an entire infrastructure supporting the chain of effort of creating an operating system, of making and testing programs for it, of bringing everything to the users, of supplying maintenance, updates and support and customizations, etc. Today, Linux is ready to accept the challenge of a fast-changing world.Yes Linux have a Future!

so ˳Expunge the idleness˳®- by faheem