Linux Tutorial

Operating system?

operating system is an interface between user and computer hardware.
the hardware of the computer cannot understand the human readable language
as it works on binaries eg 0 's and 1 's .also it is very tough for humans
to understand the binary language,in such case we need an interface
which can translate human language to hardware vice-versa for effective
communication.




Types of operating system?

  1. single user--single tasking operating system
  2. single user--multitasking operating system
  3. multi user--multitasking operating system


single user--single tasking operating system
in this type of operating system only one user can login into the system
and can perform only one task at the time.
EG:MS-DOS


single user--multitasking operating system
  this type of operating system only one user can login into the system
and can perform multiple task at the time.browsing internet while playing songs.
EG:WINDOWS -98,XP,VISTA,7,8,10 etc.



multi user--multitasking operating system
 

 this type of operating system provides multiple users  to log into system and also each
user can perform various tasks at a time
EG;UNIX,LINUX etc.

linux architecture

 the main concept that unites all the versions of unix is the following four basics-

1.kernel-the kernel is the heart of the operating system.it interacts with the hardware and most of the task like memory management,task scheduling and file management.

2.shell-the shell is the utility that processes your requests.when you type in a command at your terminal,the shell interprets the commands and calls the program that you want.the shell uses
standard syntax for all commands.C shell,Bourne shell and Korn shell are the most famous shells which are available with most of unix variants.

3.commands and utilities- there are various commands and utilities which you can make use of in your day to day  activities.cp,mv,cat,and grep,etc.are few examples of commands and utilities.there are over 250 standard commands and numerous others provided through 3rd party software.all the commands come from various option.

4.files and directories-all the data of unix is organized into files.all files are then organized into directories.these directories are further organized into a tree-like structre called the file system.

file system

1. \

it is a parent directory for all other directories it is called as ROOT directory.it is represented
by forward slash (/).
c:\ of windows.

2. \root

it is a home directory for root user (super user).it provide working environment for root user
\root is similar to c:\documents and settings\administrator.

3. \home
it is a home directory for other users.it provide working environment for
other users(other than root).

4. \boot
 
it contaons bootable files for linux,like vmlinuz(kernel)...
initrd (INITial Ram Disk) and GRUB (GRand Unified Boot loader)....
boot.ini,ntldr.

5. \etc

it contains all configuration files like /etc/passwd -user info,
/etc/resolv.conf-Preferred DNS,/etc/dhcp.conf-DHCP server
/etc is similar to c:\windows\system32\drivers\.

6. \usr 
By default softwares are installed in usr directory(UNIX Sharable Resources)
\usr is similar to c:\Program Files.

7. \opt
it is optional directory for /usr.it contains third party
softwares /opt is similar to c:\Program Files.

8. \bin
 
it contains commands used by all users (Binary Files).

9. \sbin
it contains commands used by only super user (ROOT)(super user binary files).

10. \dev
it contains device files like /dev/had -for hard drives,/dev/cd-rom -for
cd drives /dev similar to device manager of windows.

11. \proc
it contain process files,the contents are not permanent,they keep
changing it also calles as Virtual Directory.its file contain useful
information used by OS like /proc/meminfo..information of RAM/SWAP
/proc/cpuinfo-information of CPU.
/var it contains variables data like mails,log files.

12. \mnt
it is default mount points for any partition.it is empty by default.

13. \media
it contains all of removable media like CD-ROM,pendrive.

14. \lib
 
it contains library files which are used by OS library files in linux
are SO(shared objects)files /lib is similar to .dll files of windows.




BASIC COMMANDS

1     cat > filename

       To create a file

2       
       cat filename

        To display the content of the file

3       
       cat >> filename

       To append the data in the already existing file

      
       touch file1 file2 file3

       Creating multiple files at same time using touch command

5       
        ls

        Directory listing

6       
         ls -a

         list all files including hidden file starting with '.'

7       
        ls --color

        colored list

8       
         ls -d

        list directories - with ' */'

9       
        ls -F

        add one char of */=>@| to enteries

10       
         ls -i

        list file's inode index number

11    
   
        ls -l

        list with long format - show permissions

12       
         ls -la

         list long format including hidden files

13       
          ls -lh

         list long format with readable file size

14       
          ls -ls

         list with long format with file size

15       
          ls -r

          list in reverse order

16       
          ls -R

          list recursively directory tree

17       
          ls -s

          list file size

18       
          ls -S

          sort by file size

19       
         ls -t

         sort by time & date

20       
        ls -X

        sort by extension name

21       
        mkdir dirname

        To Creating a Directory

22       
      mkdir –p dirname/{file1/{subfile1,subfile2},file2/{subfile1,subfile2},file3        /{subfile1,subfile2}}

    Making multiple directories inside a directory

22       
       cp file1 dirname

       Copying files into directory

23       
       cp –rvfp dirname2 dirname

       Copying directories from one location to other

24       
        mv file2 dirname

        Moving files from one location to other (cut and Paste)

25       
       mv dirname dirname2

      Moving a Directory from one location to other

26       
      mv file1 linuxfile

     Renaming a File

27 
      
       mv dirname linuxdir

       Renaming a Directory

28       
        rm filename
       or
      rm –f filename (without prompting)

       Removing a File

29       
       rmdir dirname

       Removing an Empty directory

30       
      ln -s file link

     Create symbolic link link to file

31       
       more file1

      Output the contents of the file

32       
      head file1

      Output the first 10 lines of the file

33       
      tail file1

      Output the last 10 lines of the file

34       
       tail -f file1

       Output the contents of file as it grows,starting with
        the last 10 lines

35       
         touch file1

         Create or update file

36       
        cd directoryname

        Change to directory

37       
       cd ..

       Change to previous directory

38   
    
      clear

     The clear command clears the screen and wipes the board clean

39       
       man ftp

      With the man command, you can retrieve the information in the   manual       and  display it as text output on your screen


FILE PERMISSION COMMANDS

 

1       
     #chmod ugo=rwx filename

     Assigning full permission to the file i.e. rwx to all

2       
     #chmod u=rwx,g=rw,o=r myfile

     Assigning different permissions to the file (user=rwx, group=rw and others=r)

3   
    
     #chmod 764 myfile (where 7 means rwx i.e. 4+2+1, rw=6 i.e. 4+2 and 1 indicates x)

    Assigning different permissions to the file (user=rwx, group=rw and others=r)

4  
     
    #chmod 777 myfile

    Assigning full permission to the file i.e. rwx to all

5  
     
    #chmod 770 myfile (where 0 indicates no permissions)

    Removing all permissions from others


PROCESS MANAGEMENT

 

1
       
    #ps

    The ps command gives the running process of the present terminal and present command.

2  
     
    #ps –a

    To see all the active processes running on the terminal

3  
     
    #ps –u

    To see the processes running by the logged in user (ex root)

4  
     
     #ps -x

     To see which process are attached with some terminals (tty) and which are not

  
    
    #ps –G or #pgrep –G

    To see which process are running by a particular group

6  
     
    #ps –aux

    To see the offline process of the system, already executed

7
       
    #kill –l

    To see list of signals

8  
     
    #kill signalno processid

     To kill the signal

9    
    
    #top

    To monitor all processes in the system use the following command

10
       
      #bg

       List stopped or background jobs,resume a stopped job in the background


SYSTEM INFORMATION


       
   #df

    show the disk usage

2
       
     #du

    show directory space usage

3  
     
     #free

      show memory and swap usage

4    
   
    #whereis app

     show possible locations of app

5   
    
     #which app

     show which applications will be run by default

6   
    
     #date

     show the current date and time

7   
    
     #cal

     show this month's calender

8   
    
    #uptime

    show current uptime

9  
     
    #whoami

    who you are logged in as

10
       
      #finger user

      display information about user

11  
     
     #uname -a

      show kernel information

12  
     
     #cat /proc/cpuinfo

     cpu information

13 
      
     #cat proc/meminfo

     memory information

14 
      
    #man

    show the manual for command

15
       
     #w

     display who is online

FILE COMPRESSION


1
       
   #tar xf file.tar

    Extract the files from file.tar

2  
     
     #tar cf file.tar file

     Create tar named file.tar containing file

3   
    
    #tar czf file.tar.gz files

     Create a tar with Gzip compression

4   
    
     #tar xzf file.tar.gz

     Extract a tar using Gzip
5   
    
    #tar cjf file.tar.bz2

    Create tar with Bzip2 compression

6  
     
   #tar xjf file.tar.bz2

    Extract a tar using Bzip2

7  
     
  #gzip file

  Compresses file and renames it to file.gz

8
       
    #gzip -d file.gz

    Decompresses file.gz back to file


NETWORK COMMANDS


1
       
   #dig -x host

   Reverse lookup host

      
   #wget file

   Download file


      
   #wget -c file

   Continue a stopped download

      
    #ping host

    Ping host and output results

5  
     
    #whois domain

    Get whois information for domains

6  
     
    #dig domain

    Get DNS information for domain

7

    #hostname

    Display the hostname









Comments

Popular posts from this blog

What is Web Hosting And Types Of Webhosting

DuckDuckGo Privacy Search Engine

What is Secure Sockets Layer (SSL) and How it Works