Wednesday, March 14, 2012

FILE SEARCH

LOG IN TO ROOT USER:

[root-@local host]#

SEARCH FILE AND DIRECTORY INTO ROOT FILE SYSTEM FROM '/':
[root-@local host]#find / -name file1

SEARCH FILES AND DIRECTORIES BELONGING TO 'user1':
[root-@local host]#find / -user user1

SEARCH FILE WITH 'bin' EXTENSION WITHIN DIRECTORY '/home/user1':
[root-@local host]#find /home/user1 -name \*.bin

SEARCH BINARY FILES ARE NOT USED IN THE LAST 100 DAYS:
[root-@local host]#find /usr/bin -type f -atime +100

SEARCH FILES CREATED OR CHANGE WITHIN 10 DAYS:
[root-@local host]#find /usr/bin -type f -mtime -10

SEARCH FILES WITH '.rpm' EXTENSIONS AND MODIFY PERMITS:
[root-@local host]#find / -name *.rpm -exec chmod 755 '{}'\;

SEARCH FILES WITH '.rpm' EXTENSION IGNORING REMOVABLE PARTITIONS AS CDROM, PEN-DRIVE,....
[root-@local host]#find / -xdev -name \*.rpm

FIND FILES WITH THE '.ps' EXTENSIONS -FIRST RUN 'UPDATED' COMMAND:
[root-@local host]#locate \*.ps

SHOW LOCATION OF A BINARY FILE, SOURCE OR MAN:
[root-@local host]#whereis halt

SHOW FULL PATH TO A BINARY/EXECUTABLE:
[root-@local host]#which halt


FILES AND DIRECTORY

LOG IN TO ROOT USER:
[root-@local host]#

ENTER THE HOME DIRECTORY:
[root-@local host]#cd /home
GO BACK ONE LEVEL:
[root-@local host]#cd..

GO BACK TWO LEVELS:
[root-@local host]#cd../..
GO TO HOME DIRECTORY:
[root-@local host]#cd

GO TO HOME DIRECTORY:
[root-@local host]#cd ~user1

GO TO PREVIOUS DIRECTORY:
[root-@local host]#cd -

COPYING A FILE:
[root-@local host]#cp file1 file2

COPY ALL FILES OF A DIRECTORY WITHIN THE CURRENT WORK DIRECTORY:
[root-@local host]#cp dir/*

COPY A DIRECTORY WITHIN THE CURRENT WORK DIRECTORY:
[root-@local host]#cp -a /tmp/dir1

COPY A DIRECTORY:
[root-@local host]#cp -a dir1 dir2

OUTPUTS THE MIME TYPE OF THE FILE AS TEXT:
[root-@local host]#cp file file1

LIST KNOWN ENCODINGS:
[root-@local host]#iconv -l

CONVERTING THE CODING OF CHARACTERS FROM ONE FORMAT TO ANOTHER:
[root-@local host]#iconv -f fromEncoding -t toEncoding inputFile > OutputFile

BATCH RESIZE FILES IN THE CURRENT DIRECTORY AND SEND THEM TO A THUMBNAILS DIRECTORY  :
[root-@local host]#find -maxdepth 1 -name *.jpg -print -exec convert

CREATE A SYMBOLIC LINK TO FILE OR DIRECTORY:
[root-@local host]#ln -s file1 lnk1

CREATE A PHYSICAL LINK TO FILE OR DIRECTORY:
[root-@local host]#ln file1 link1

VIEW FILES OF DIRECTORY:
[root-@local host]#ls

VIEW FILES OF DIRECTORY:
[root-@local host]#ls -F

SHOW DETAILS OF FILES AND DIRECTORY:
[root-@local host]#ls -l

SHOW HIDDEN FILES:
[root-@local host]#ls -a

SHOW FILES AND DIRECTORY CONTAINING NUMBER:
[root-@local host]#ls *[0-9]*

SHOW FILES AND DIRECTORY IN A TREE STARTING FROM ROOT(2):
[root-@local host]#lstree

CREATE A DIRECTORY CALLED 'dir1':
[root-@local host]#mkdir dir1

CREATE TWO DIRECTORIES SIMULTANEOUSLY:
[root-@local host]#mkdir dir1 dir2

CREATE A DIRECTORY TREE:
[root-@local host]#mkdir -p /tmp/dir1/dir2

RENAME/MOVE A FILE OR DIRECTORY:
[root-@local host]#mv dir1 new_dir

SHOW THE PATH OF WORK DIRECTORY:
[root-@local host]#pwd

DELETE FILE CALLED 'file1':
[root-@local host]#rm -f file1

REMOVE A DIRECTORY CALLED 'dir1' AND CONTENTS RECURSIVELY:
[root-@local host]#rm -rf dir1

REMOVE TWO DIRECTOIES AND THEIR CONTENTS RECURSIVELY:
[root-@local host]#rm -rf dir1 dir2

DELETE DIRECTORY CALLED 'dir1':
[root-@local host]#rmdir dir1

MODIFY TIMESTAMP OF A FILE OR DIRECTORY-(YYMMDDHHMM):
[root-@local host]#touch -t 0712250000 file1

SHOW FILES AND DIRECTORIES IN A TREE STARTING FROM ROOT(1):
[root-@local host]#tree








SHUTDOWN, RESTART AND LOGOUT OF A SYSTEM


LOG IN TO ROOT USER:
Syntax: $su – (or) $su
$password: enter your root password.
[root-@local host]#
SHUTDOWN SYSTEM(2):
Syntax: [root-@local host]#init 0
LEAVE SESSION:
Syntax: [root-@local host]#logout

RESTART SYSTEM:
Syntax: [root-@local host]#reboot

SHUTDOWN SYSTEM(1):
Syntax: [root-@local host]#shutdown -h now

PLANNED SHUTDOWN OF THE SYSTEM AT 11.00
Syntax: [root-@local host]#shutdown -h 11.00 &

CANCEL A PLANNED SHUTDOWN OF THE SYSTEM:
Syntax: [root-@local host]#shutdown -c

REBOOT(1):
Syntax: [root-@local host]#shutdown -r now

SHUTDOWN SYSTEM(3):
Syntax: [root-@local host]#telinit 0
SHUTDOWN KDE SYSTEM:
Syntax: [root-@local host]#poweroff

LINUX SYSTEM INFORMATION

LOG IN TO ROOT USER:

Syntax: $su – (or) $su
$password: enter your root password.
[root-@local host]#
SHOW SYSTEM ARCHITECTURE:
Syntax[root-@local host]#arch

SHOW THE TIME TABLE OF 2012:
Syntax:[root-@local host]#cal 2012

SHOW INFORMATION CPU INFO:
Syntax:[root-@local host]#cat /proc/cpuinfo

SHOW INTERRUPTS:
Syntax[root-@local host]#cat /proc/interrupts

VERIFY MEMORY USE:
Syntax[root-@local host]#cat /proc/meminfo

SHOW FILE(S) SWAP:
Syntax[root-@local host]#cat /proc/swaps

SHOW VERSION OF THE KERNAL:
Syntax[root-@local host]#cat /proc/version

SHOW NETWORK ADAPTERS AND STATISTICS:
Syntax[root-@local host]#cat /proc/net/dev

SHOW MOUNTED FILE SYSTEM(S):
Syntax[root-@local host]#cat /proc/mounts

SAVE DATE CHANGES ON BIOS:
Syntax[root-@local host]#clock -w

SHOW SYSTEM DATE:
Syntax[root-@local host]#date

SET DATE AND TIME:
Syntax[root-@local host]#date 041217002012.00

SHOW HARDWARE SYSTEM COMPONENTS:
Syntax[root-@local host]#dmidecode -q

DISPLAYS THE CHARACTERISTICS OF A HARD DISK:
Syntax[root-@local host]#hdparm -i /dev/hda

PERFORM TEST READING ON A HARD DISK:
Syntax[root-@local host]#hdparm -tT /dev/sda

DISPLAY PCI DEVICES:
Syntax[root-@local host]#lspci -tv

SHOW USB DEVICES:
Syntax[root-@local host]#lsusb -tv

SHOW ARCHITECTURE OF MACHINE:
Syntax[root-@local host]#uname -m

SHOW USED KERNAL VERSION:
Syntax[root-@local host]#uname -r





Sunday, March 4, 2012

LINUX BEGINNERS





WHAT IS LINUX?
  • Linux Linux is a free Unix-type operating system for computer devices.
  • Linux is Freely available to everyone.
HOW TO UNDERSTAND FILES AND FOLDER?
  • Everyone In The Linux Is File.
  • Folders are used to Organize the Files.
  • The lowest possible folder is root / where you will find the user homes called /home/.
/
/home
/home/parent
/home/parent/child


NOTE: Another name of Folder is Directory.
ROOT FOLDER CONTAINS THE FOLLOWING:

  • /bin - use by all users.
  • /boot - used for system start up (having boot loader files).
  • /dev -  Device files, links to your hardware devices.
  • /etc - having system configuration files.
  • /home - Save your personnel files.
  • /lib - Library and Kernel modulus.
  • /mnt - use to mount CDRom.
  • /opt -  used for application software packages.
  • /usr - used to store the user files.
  • /var - used for spool directories  and Temporary files.
  • /proc - Storing the System information.
HOW TO UNDERSTAND USERS AND PERMISSION?
There are three types of users in the linux:
1.User,
2.Group,
3.Others.
There are three types of Permissions in the linux:
1.Read,
2.Write,
3.Execute.
HOW TO OPEN TERMINAL WINDOW?
GNOME:

  •             Menu--> System--> Terminal.

KDE:

  •             K--> System--> Konsoll.

XTERM:

  •             Ctrl+Alt+F2 -- F6 Return To The Old Window Press Ctrl+Alt+F1.






HOW TO WORK SHELL SCRIPTS IN FEDORA SYSTEM



HOW TO WORK "SHELL" PROGRAM IN FEDORA:
STEP 1Open your Fedora Terminal window.
STEP 2: Then type this commands.
Syntax: $vi sample.sh then enter.
STEP 3open the vi editor window.
STEP 4: Pres the insert "i" button.
STEP 5: Then type your "SHELL SCRIPTS" Program.
           echo "Welcome to Fedora"
                cal
STEP 6:Then save and quit your shell script program.
syntax: press Escape key and  then type wq: then press enter key.

HOW TO RUN "SHELL" PROGRAM IN FEDORA:
STEP 1Type this command and run your "SHELL SCRIPT" program.
STEP 2: Change permission to your shell script program.
Syntax: $chmod +x sample.sh
STEP 3: Run your shell scripts program.
Syntax: $./sample.sh
output:  
         Welcome to Fedora
              March 2012     
     Su Mo Tu We Th Fr Sa
                             1  2  3
            4  5  6  7  8  9 10
    11 12 13 14 15 16 17
    18 19 20 21 22 23 24
    25 26 27 28 29 30 31

Thursday, February 23, 2012

HOW TO INSTALL AND WORK JAVA PROGRAMS IN FEDORA

HOW TO INSTALL "JAVA" COMPILER IN FEDORA
STEP 1: Open your fedora Terminal window.
STEP 2: Connect Internet to your System.
STEP 3: Then type this commands.
LOG IN TO ROOT USER:
  Syntax: $su – (or) $su
  Syntax: $password: enter your root password.
  Syntax: [root-@local host]#
STEP 4: INSTALL JAVA COMPILER OR JDK COMPILER:
  Syntax: [root-@local host]#$yum install java-1.7.0-openjdk
STEP 5: Display the available packages.
STEP 6: Then install JAVA compiler.
STEP 7: Finish the installation.


HOW TO WORK "JAVA" PROGRAMS IN FEDORA:
STEP 1Open your Fedora Terminal window.
STEP 2: Then type this commands.
  Syntax: $vi sample.java then enter.
STEP 3open the vi editor window.
STEP 4: Pres the insert "i" button.
STEP 5: Then type your "JAVA" Program.
    import java.io.*;
      class sample
       {
               public static void main(String args[])
            {
              System.out.println("Hello world");
            }
       }
NOTE: Using Netbeans also we can Run the Java programs.

HOW TO WORK "NETBEANS" IN FEDORA:
STEP 1: Open Terminal window.
  Syntax: #yum install netbeans
STEP 2: Display the available packages.
STEP 3: Then install netbeans software
STEP 4: Finish the installation.


HOW TO COMPILE "JAVA" PROGRAMS IN FEDORA:
STEP 1: Compile your "JAVA" program.
  syntax: $javac sample.java
STEP 2: Find errors and correct the errors. 
STEP 3: Then save and close.


HOW TO RUN "JAVA" PROGRAMS IN FEDORA:
STEP 1Type this command and run your "JAVA" program.
  syntax: $java sample
  output: Hello world
STEP 2: Close the terminal window.





HOW TO INSTALL AND WORK C PROGRAMS IN FEDORA SYSTEM

HOW TO INSTALL "C" COMPILER IN FEDORA:
STEP 1: Open your fedora Terminal window.
STEP 2: Connect Internet to your System.
STEP 3: Then type this commands.
LOG IN TO ROOT USER:
  Syntax: $su – (or) $su
  Syntax: $password: enter your root password.
  Syntax: [root-@local host]#
STEP 4: INSTALL GCC COMPILER OR C-COMPILER:
   Syntax[root-@local host]#yum install gcc*
STEP 5: Display the available packages.
STEP 6: Then install gcc compiler.
STEP 7: Finish the installation.

HOW TO WORK "C" PROGRAM IN FEDORA:
STEP 1: Open your Fedora Terminal window.
STEP 2: Then type this commands.
  Syntax: $vi sample.c then enter.
STEP 3: open the vi editor window.
STEP 4: Pres the insert "i" button.
STEP 5: Then type your "C" Program.
#include<stdio.h>
  void main( )
    {
      printf(" Welcom to C program ");
    }
STEP 6:Then save and quit your c program.
  syntax: press Escape key and  then type wq: then press enter key.

HOW TO COMPILE "C" PROGRAM IN FEDORA:
STEP 1: Compile your "C" program.
  syntax: $cc sample.c 
STEP 2: Find errors and correct the errors. 
STEP 3: Then save and close.

HOW TO RUN "C" PROGRAM IN FEDORA:
STEP 1: Type this command and run your "C" program.
  syntax: $./a.out
output: Welcome to C program
STEP 2: Close the terminal window.



Monday, February 20, 2012

COMPUTER HARDWARE TRICKS & TIPS

Changing file attributes using windows command prompt.
Syntax :
1.To hide your file.
attrib +h +r +s <folder/filename>

2.To view file.
attrib -h -r -s <folder/filename>

Notes :
  • The file has been hided by this procedure can't view by anyone(including show hidden file in windows explorer folder option).
  • This problem usually occur in memory card and USB pendrive.You can use this command to retrieve your files in windows even if the explorer cann't able to view the hidden files that really but placed in your storage device.