Friday, October 7, 2011

Basic commands for Linux


#cat   >filename - create a file
#cat   >filename - see the file contains
#cat   >>filename - Add the extra mater in file without editing
#Ctrl+d - save the file contents
#rm   filename - delete the file
#mkdir   directory name - create a new directory
#cd   directory name - open the directory
#cp   old file   new file - copy file
#mv old file new file - move the file
#cat   >.filename - create a hidden files
#ls   -1 - see the all file and folder
#rmdir   directory name - delete the empty directory
#rm   –rf   filename - delete the directory and it contents
#clear - clear the screen
#cd .. - close the directory stapes by stapes
#cd \ - close the many directory directly
#vi   filename - edit the file
#cleanlinks - remove all empty directories
#pwd - present working directory
#exit - log off the current user
#Ctrl+d - log off the current user
#who   –u - how many open consoles
#kill (process id) - kill the open consoles
#touch   filename - update the file access and modifies time. Associate with a file
#tty - see the terminal type
#head   filename - see the head of file
#tail   filename - see tail of file
#men   command name - see the help
#eject   - eject the CD ROM drive
#eject   –t - close the CD ROM drive
#cal - see the calendar
#find 1 –name filename - see the file location 
#du   filename - see the file contents
#df - see the free space of the hard disk
#ls   –l | more - see the file and directory page wise
#wc   –l   file - see the line of that file
#wc   –w   file - see the word of that file
#wc   –c   file - see the character of that file
#fsck - to check the file system
#mv   –t   file1   file2 - this command is used to over writing without prompting
#mv   –i 1filename 2filename - this command will prompt you for confirmation
#startx - transfer the graphic from text
#mount - see the mounted contents
#compress   –v   filename - compress the file (35%)
#uncompress   filename z - uncompress the compressed files
#gzip   –v   filename - compress the file 65%
#ungzip   filename gz - uncompress the file
#fdisk   –l - see the partition table
#ifconfig - see the IP address this computer on the network
#netconfig - assign the IP address
#ifdown   eth0 - down the network adapter
#ifup   eth0 - active the network adapter
#Ifconfig   etho   ip   address - assign the IP address in common line
#iptables –l - to see the fire wall content down/start
#echo $ - to see the command start or not start
#lokkit - to open security level
#setup - open the configuration tools
#ntsysv - open the configuration service
#sysctl –a - to see the kernel Para meter
#ethtool - to see the used modify the Ethernet tool
#mii   –tool - to see and used modify the network adapter
#pstree - to see the all process
#lsattr - display file attribute
#switchdisk   kde - transfer the GNOME to KDE
#switchdisk   gnu - transfer the KDE to GNOME
#ps   x - to show the process ID
#hwbrowser   - to see the system configuration
#mkfs - this command is used to format the partition
#init   0 - shutdown the pc
#init   6 - restart the pc
#telinit   0 - shutdown the system
#telinit   6 - restart the system
#shutdown   –n   now - reboots the system
#halt - shutdown after halting
#poweroff - shutdown the system
#shutdown   –r   now - reboot the system
#reboot - to restart the system
#su root - login root without log out any user
#service - to start and restart or stop the service     
>i.e. - service network restart
#Hostname   computer name - to modify the computer name
#domainname   net.com - to modify the domain name
#chmod - this command is used to assign the permission
#chown - to change the owner ship
#chgrp - to change the group owner ship
#mkdir   –p   directory name - to create the directory forcefully.

Tuesday, October 4, 2011

LINUX – KEYBOARD SHORTCUTS

Bash Shell keyboard shortcuts for Linux users

Linux Shortcuts for Shell Commands

Ctrl + D : exit a terminal, same as typing `exit` 
Ctrl + L : clears the screen, same as `clear` 
Ctrl + C : breaks/cancels an ongoing operation 
Ctrl + Z: pauses (stops) an ongoing operation. Type `fg` (foreground) to resume it or `bg` (background) to continue the process in the background 
Ctrl + Alt + Del : shuts down computer

Bash Shell shortcuts for moving backward forward

Ctrl + A : Go to the beginning of the line you are currently typing on 
Ctrl + E : Go to the end of the line you are currently typing on 
Ctrl + U: Clears the line before the cursor position. If you are at the end of the line, clears the entire line. 
Ctrl + W: Delete the word before the cursor. 
Ctrl + K: Clear the line after the cursor. 
Ctrl + T: Swap the last two characters before the cursor. 
Esc + T: Swap the last two words before the cursor. 
Alt + F: Move cursor forward one word on the current line. 
Alt + B: Move cursor backward one word on the current line.

History related bash shell shortcuts -

Ctrl + R: Let’s you search through previously used commands. 
Alt + <: Move to the first line in the history. 
Alt + >: Move to the last line in the history.

Other bash shell shortcuts

Ctrl + H: Same as backspace.
Tab: Auto: complete files and folder names. 
Ctrl + Y: to paste it (as in delete and copy) all text in front of the cursor. 
Alt +? : Show current completion list. 
Alt + *: Insert all possible completions. 
Alt + /: Attempt to complete file-name. 
Alt + c: Capitalize the word. 
Alt + l: Make word lowercase. 
Alt + r: Recall command.


Note: Some of these commands may not work if you are accessing bash through a telnet, ssh session, or depending on how you have your keys mapped.

Linux GUI – KDE shortcuts  

Most common Linux Shortcuts for KDE - 

Ctrl + Esc: KDE System Guard process table. 
Alt + F1 : K-Menu popup. 
Alt + F2: Run command. 
Alt + F3: Application control. 
Alt + F4: Terminated active application. 
Alt + F5: Quick application switcher. 
Alt + Tab: Switch between active applications. 
Ctrl + Alt + Shift + PageDN: direct shutdown. 
Ctrl + Alt + Shift + Page UP: direct reboot.

Linux shortcuts for Virtual terminals

 Most common Linux Shortcuts for Virtual terminals - 
   
Ctrl + Alt + F1: Switch to the first virtual terminal. In Linux, you can have several virtual terminals at the same time. The default is 6. 
Ctrl + Alt + Fn: Switch to the nth virtual terminal. Because the number of virtual terminals is 6 by default, n = 1...6.
tty: Typing the tty command tells you what virtual terminal you're currently working in. 
Ctrl + Alt + F7: Switch to the GUI. If you have X Window System running, it runs in the seventh virtual terminal by default. If X isn't running, this terminal is empty. 
 
Miscellaneous Linux shortcuts
 
Most common miscellaneous Linux Shortcuts - 
 
ALT+Ctrl + (F1-F7): To switch between different terminals. Or if GUI is installed then to switch between GUI and text mode.
 
GUI specific - 
 
Ctrl+Q: Mostly to quit from and application (like gimp, konqueror).
 
Switch Desktop - 
   
Desktop 1 : Ctrl +F1 
Desktop 2 : Ctrl +F2 
Desktop 3 : Ctrl +F3 
Desktop 4 : Ctrl +F4 
 
Scroll Lock - 
 
Press Scroll Lock: locks terminal input/output - allows reading console contents when output is going too fast. To unlock, press Scroll Lock once again  

Saturday, October 1, 2011

Installation of Red Hat Linux


Installation of Red Hat Linux –
         
1- To install Red Hat, you will need to download the ISO images (CD Images) of the installation DVD from http://fedora.redhat.com
2- Download the i386 images for 32 Intel Processors, PPC images for Apple Macintosh and x86_64 for 64 bit AMD Processors
3- Burn the ISO DVD images on DVD and use that DVD as Installation DVD

Introduction –
              If you are installing the Red Hat Linux on the new hard disk, you simply have to insert the correct installation CD, set the first boot device to CD ROM from your BIOS setting then restart the system and the installation will start. The Red Hat Linux detects most of the hardware automatically. Most of the persons are afraid about their SATA hard drives. I assure you that there is nothing to panic about, Linux has all the SATA drivers in its enterprise version, it automatically detects SATA and loads its driver and starts installing easily.

Installation
1- Boot the system from Linux CD

            
2- For graphical mode installation press “Enter key”. Or it will automatically start after 60 seconds. We can take rescue mode by typing “linux rescue” and “linux text” for text mode installation. We also can go to installer boot option by pressing F2.

                        
 3- After it next screen will appear. That’s called welcome screen.

                        
4- After the welcome next screen will appear.

                
 5-  Select the appropriate language (English), Press next.

            
6- Select appropriate keyboard for the system (US English), Press next.


                 
 7- On the disk partitioning setup screen select “manually partition with Disk Druid”, Press next.

          
 8- On the disk partitioning setup screen select “manually partition with Disk Druid”, Press next.

          

What is a Partition?

Partitioning is a means to divide a single hard drive into many logical drives. A partition is a contiguous set of blocks on a drive that are treated as an independent disk. A partition table is an index that relates sections of the hard drive to partitions. 

About Partition – 

Hard disk partitions: The disk available, now a days, are quite large. Partitions help us manage the disks easily. Also they help protect our system. Linux is organized into directories. We can mount different directories on different partitions.
Partition types: There are four ways of partitioning a hard disk-
Primary partition: We can have up to 4 different primary partitions on a single hard disk. One of these partitions should be marked as active, to boot the O.S. from. This partition can have the boot loader, such as LILO (Linux Loader) or GRUB (Grand Unified Boot Loader).
Extended partition: If the above four partitions are not just enough, then we can convert any of the primary partition into Extended partition. We can then subdivide this partition into multiple logical partitions, as we require. We cannot use extended partition directly i.e. we cannot mount a directory on it.
Logical partition: We use the extended partition by making logical partitions. Logical partitions are volumes or in Microsoft terms, these are the logical drives.
Swap partition: The swap partition is an exclusive are on the hard disk, which is used as virtual memory. Swap is not the different type of partition, but we can mount swap either on the primary or on the logical partition itself. Recommended size of swap partition is twice the amount of installed RAM.
Partition names: The first two letters of the disk name tell about the kind of disk we are using. For IDE hard disks the letters are hd and for SCSI or SATA disks the letters are sd.
The third letter tells the disk’s position on motherboard. For IDE or SATA it is as under:
1- Primary Master a                            2- Primary Slave b
3- Secondary Master c                        4- Secondary Slave d
And for SCSI, disks letters correspond to their designated ID numbers. For example,
1- SCSI with ID 0 a                 2- SCSI with ID 1 b

Naming of CD and DVD drives has also been, categorized as the hard disk drives.

The fourth letter tells the type and position of the partition on hard disk. The primary partitions have numbers reserved as 1, 2, 3 and 4. The logical partitions get their numbers 5 onwards. Even if we have only one primary partition, the first logical partition will get its position number 5 only.

Typical partition names –

Name and details –

/dev/hdb2 the second primary partition on the hard disk on primary slave

/dev/hda8 the fourth logical partition on hard disk on primary master

/dev/sda1 the first primary partition on first SCSI disk or primary master SATA

/dev/hdc as this has no number; it means it is secondary master CD or DVD on IDE controller.

Linux file system structure – 

Red Hat Linux organizes file into directories. The standard directories are as follows…
/ - This is top level root directory. The remaining directories are kept below this root (/) directory, i.e. these are sub-directories of root directory.
Note: / is different from root. Both are pronounced as root, but former is directory while later is a user with administrative privileges.
/root: This is the home directory for root user (administrator).
/home: This directory is place for keeping all the user’s home directories except root user.
/dev: This directory will list all available device drivers.
/mnt: It contains the mount points of removable media, like /mnt/cdrecorder
/etc: It contains the basic Linux configuration files related to passwords, X window and daemons etc.
/boot: It stores the file and commands to boot Linux on our system.
/bin: It has all the basic command line utilities.
/lib: It lists program libraries, which may be needed by different applications or Linux kernel.
/proc: It includes the kernel related processes which are running currently.
/initrd: It configures one empty directory which is used by Initial RAM disk during boot. We should not delete this directory; else we will not be able to boot the Linux system.
/sbin: It contains commands for system administration.
/var: It contains log file and print spools etc.
/usr: It contains programs and data which is available to all the users.

9- Select the free space and press “new” button. And then select the mount point (/). And select file system type (ext3). And the disk space size in MB.
   

10- Again select the free space, Press New. And then select file system type “swap”. And the disc space size will be in MB.

                    
11- Again select the free space, Press New. And select file system type “/boot”. And select file system type (ext3). And the disk space size will be in MB. And check the mark on (/) partition and click “Next”.
            
                             
12-  And now Select boot loader option as your wish. If you have duel operating system in your computer then select you desired boot option. You can also protect your boot loader by assigning a password of boot loader. And then, Press Next.
                     
                         
13- Following screen will appear only if the LAN card is present in system. Click “Edit” button to assign the IP address for your system. There after select “Manually” radio button & fill the host name for this system (e.g. ajay.net). We can skip the gateway & DNS configuration for which the system will inform, Press continue button twice.

        

14- For the network security purpose Enable the firewall & select active for SELinux, which the default, click Next.

                    
15 – Make your time zone (i.e. Asia/Calcutta). And, Press Next.

       
16- Define the root’s password which should be at least six characters long, press Next.

                 
 17- Select the default for package installation, press next.

                 
18- Press Next for continue your installation. When the installation gets finished after file copying, reboot the system from hard disk.

                    
 19- The system will start with Linux welcome screen. Click “next” to continue.

         
 20- Accept the license agreement & set the Date & Time, press next.

             
21- Now select the resolution on the Display screen (e.g. 1024 x 768), press next.

             
22- If you have Red Hat login account then provide Login name & Password. Other wise click next to continue.
23- Create one or two user accounts, press next.
24- If the sound card has been detected on your computer and its drier is loaded properly, then sound card screen will appear. Click the “play test sound” to hear a sample sound.

                              

25 - Press “Finish” button to finish your installation. After it Red hat login screen will appear. Provide the login information to start working.

         
And now you have successfully installed Red hat Linux enterprise operating system on your computer.