SlideShare a Scribd company logo
LINUX BASICS
Module 1, Part A
Contents
Kernel
Shell
Linux Filesystem Hierarchy
Run Level
Linux Booting Procedure
Basic Commands
      Text Processing Commands
      Archives and Compressions
      System states




                   ustlinuxschool.blogspot.com
OVERVIEW OF LINUX SYSTEM

Linux
     Linux is a clone of the operating system Unix, written from scratch by
     Linus Torvalds with assistance from a loosely-knit team of hackers
     across the Net.

     It aims towards POSIX and Single UNIX Specification compliance –
     Kernel.org

External Links: tldp




                       ustlinuxschool.blogspot.com
Kernel External Links IBM

  Linux Kernel is the core component of GNU/Linux Operating System. Some of its
  functions include Process Management, Memory Management, File System, Device
  Drivers, I/O Management and Networking.


  The complete source code of the Linux Kernel can be freely downloaded from
  http://kernel.org/




                     ustlinuxschool.blogspot.com                        Contents..
Shell
   Shell is an interface between user and kernel. Shell interprets your input as
   commands and pass them and pass them to kernel.


Common shells in popular Linux Distributions include C Shell, Sh, K Shell, Bash


     A program that interprets commands
     Allows a user to execute commands by typing them manually at a
      terminal, or automatically in programs called shell scripts.
     A shell is not an operating system. It is a way to interface with the
      operating system and run commands.




                      ustlinuxschool.blogspot.com                              Contents..
LINUX COMMAND FLOW




          ustlinuxschool.blogspot.com   Contents..
FEATURES OF LINUX OS

   Multi-user & Multi- tasking
   Supports full multitasking and multiuser functionalities.


   Files and Process
        Data, directory, processes and Hardware, almost everything are expressed
         as a file.
        Process is an running program identified by a unique id (PID).


   Case Sensitivity
        Linux like UNIX is case- sensitive ( MYFILE.txt, Myfile.txt, mYfiLe.txt all are
         different)




                       ustlinuxschool.blogspot.com
NORMAL USER AND SUPER USER

    In Linux system, one special user is created by default during installation
     which has almost unlimited power. This special user is called root or
     super user.


         Conventionally, a normal User has the shell prompt ending in
          „$‟ sign.
         Super User shell prompt ends in ‘#’




                      ustlinuxschool.blogspot.com                            Contents..
Linux Filesystem Hierarchy



. Top directory
is “/”, which is
called slash or
root.




                    ustlinuxschool.blogspot.com
/home This is where user home directories are stored


/etc Various system configuration files are stored here.

/var Contains variable data like system logging files, mail and printer spool directories, and
transient and temporary files.




/dev This contains various devices as files, e.g. hard disk, CD-ROM drive, etc.


/sys This contains the Kernel, Firmware and system related files


/proc Process information pseudo-file system (system memory, devices mounted, hardware
configuration, etc)



/opt Reserved for all the software and add-on packages that are not part of the default installation.


/tmp Contains mostly files that are required temporarily. Many programs use this to create lock
files and for temporary storage of data
                                                                                          Contents..
/boot Has the bootable Linux kernel and boot loader configuration files(GRUB)




/bin This contains files that are essential for correct operation of the system. These are available for
    use by all users.



/sbin Binaries which are only expected to be used by the super user



/usr Contains user documentation, games, graphical files, libraries



/lib Contains Library files




                              ustlinuxschool.blogspot.com
RUN LEVEL
 The init process, by default, runs the system in one of the eight
 runlevels.


                                     Run Level

   Runlevel 0    Halt System - To shutdown the system

   Runlevel 1   Single user mode

   Runlevel 2   Basic multi user mode without NFS

   Runlevel 3   Full multi user mode (text based)

   Runlevel 4   Unused

   Runlevel 5    Multi user mode with Graphical User Interface

   Runlevel 6   Reboot System


                                                                     Contents..
LINUX BOOTING
   External Links Thegeekstuff IBM




                                      Contents..
LINUX BOOTING
 BIOS


    BIOS stands for Basic Input/Output System
    Performs some system integrity checks
    Searches, loads, and executes the boot loader program.
    It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key
     (typically F12 of F2, but it depends on your system) during the BIOS startup
     to change the boot sequence.
    Once the boot loader program is detected and loaded into the memory, BIOS
     hands over the control to it.
LINUX BOOTING
 MBR


    MBR stands for Master Boot Record.
    It is located in the 1st sector of the bootable disk. Typically /dev/hda, or
     /dev/sda
    MBR is less than 512 bytes in size. MBR has three components

         1) Primary boot loader info in 1st 446 bytes
         2) Partition table info in next 64 bytes
         3) MBR validation check in last 2 bytes.


    MBR holds the first stage of GRUB boot loader (or LILO – Linux Loader in
     older systems).
LINUX BOOTING
 GRUB



    GRUB stands for GNU Grand Unified Boot loader.
    GRUB is dynamically configurable. It loads its configuration at
     startup, allowing boot-time changes, such as selecting
     different kernels or initial RAM disks
    GRUB can display splash screen. It loads the default kernel image as
     specified in the grub configuration file.
    GRUB is highly portable. It supports multiple executable formats and is
     geometry translation independent.
    GRUB supports operating systems that do not multiboot (MS Windows), by
     using chain loading.
LINUX BOOTING
 KERNEL


    Mounts the root file system as specified in the “root=” directive in the
     grub.conf file
    Root file-system can also be specified in the GRUB prompt.
    Kernel executes the /sbin/init program
    Since init is the first program to be executed by Linux Kernel, it has the
     process id (PID) of 1. Do a „ps -ef | grep init‟ and check the pid.
    initrd stands for Initial RAM Disk.
    initrd is used by kernel as temporary root file system until kernel is booted and
     the real root file system is mounted. It also contains necessary drivers
     compiled inside, which helps it to access the hard drive partitions, and other
     hardware.
LINUX BOOTING

 INIT
    Looks at the /etc/inittab file to decide the Linux run level (In Red Hat Linux).
    Following are the available run levels (In Red Hat Linux)
        0 – halt
        1 – Single user mode
        2 – Multiuser, without NFS
        3 – Full multiuser mode
        4 – unused
        5 – Graphical environment
        6 – reboot
    Init identifies the default initlevel from /etc/inittab and uses that to load all
     appropriate program.
    Execute „grep initdefault /etc/inittab‟ on your system to identify the default run
     level
    If you want to get into trouble, you can set the default run level to 0 or 6.
     Since you know what 0 and 6 means, probably you might not do that.
    Typically you would set the default run level to either 3 or 5.
LINUX BOOTING
 RUNLEVEL PROGRAMS


    When the Linux system is booting up, various services getting started. Those
     are the runlevel programs, executed from the run level directory as defined by
     your run level.
    Depending on your default init level setting, the system will execute the
     programs from one of the following directories.
       Run level 0 – /etc/rc.d/rc0.d/
       Run level 1 – /etc/rc.d/rc1.d/
       Run level 2 – /etc/rc.d/rc2.d/
       Run level 3 – /etc/rc.d/rc3.d/
       Run level 4 – /etc/rc.d/rc4.d/
       Run level 5 – /etc/rc.d/rc5.d/
       Run level 6 – /etc/rc.d/rc6.d/
BASIC COMMANDS

   External Link: SS64 oreillynet




   man - format and display the on-line manual page
             man date


   help - Display help for a built-in command


             date –help



   info - information about the command   („info‟ utility must be installed)
            info date
BASIC COMMANDS


    ls      (ls     lists the content of directory)


    ls -l     list the files with all information
    ls –a     list files including hidden files
    ls –la        long list with hidden files




Check „man‟ page for all available options.
BASIC COMMANDS
   cd Change Directory

           cd /home/user/




   .
   cd home/user/myfile.jpg,
   cd .. goes one directory back
   cd - return to the last directory
   cd ~ go to the current user's home directory
BASIC COMMANDS




   Absolute bath /home (absolute path: Relating to file systems, the
    location of a directory or file that can be accessed regardless of the
    current working location of a user)

       cd /home/user/mypicture.jpg


   A reative pathname does not begin with a slash ( / ). Generally you
    specifies location relative to your current working directory

       cd user/mypicture.jpg
BASIC COMMANDS




   mkdir Create one or more directories


    mkdir folder1 folder2
    mkdir -p work/junk/questions work/junk/answers (mkdir -p Create intervening
       parent directories if they don't exist)
BASIC COMMANDS


   pwd Print the full pathname of the current working directory.
       See also the dirs shell command built into bash.


           Pwd



   cp Copy files/directories


         cp file1 file2
         cp –vrf dirA dirB



   mv move files to another location or rename files


         mv /home/user/myfile /home/Admin/myfile
         mv myfile your file
BASIC COMMANDS




   rm remove files/directories

        rm myfile
        rm -rf mydirectory (rmdir remove directory)


   find search for files in a directory hierarchy,

        find /home -name myfile
BASIC COMMANDS




   history shows the history of commands

    History
        -c Clear the history list
    !        Start a history substitution, except when followed by a space
    !n      Refer to command line n.
    !-n     Run the command n lines back.
    !!       Run the previous command.
BASIC COMMANDS




   mount             mounts a file system
   The file structure on device is mounted on directory. If no device is
    specified, mount looks for an entry in /etc/fstab to find out what device is
    associated with the given directory.


         mount /dev/sdb1 /media
         mount -t to limit this to all filesystems of a particular type.



   umount allows to unmount the mounted filesystems
         umount /dev/sdb1          or umount /media




                        ustlinuxschool.blogspot.com
BASIC COMMANDS




   fdisk Linux command line disk partitioning tool


   du      Estimate file space usage



   df       shows the disk free



    dd       Convert and copy a file, write disk headers, boot
    records, create a boot floppy. dd can make an exact clone of an
    disk, this will include all blank space so the output destination must
    be at least as large as the input.dd if=linux_cd_image.iso of=/dev/sdb
BASIC COMMANDS




   touch to create empty file or updating the date and time to the
    current time


   diff   Display the differences between two files


   clear Clear terminal screen


   echo display a line of text
    echo "hello world" (displays hello world in command line)




                      ustlinuxschool.blogspot.com
BASIC COMMANDS




wc - print the number of newlines, words, and bytes in files
    wc file1.txt


grep - print lines matching a pattern
ls /etc |grep –i network




                    ustlinuxschool.blogspot.com
BASIC COMMANDS
MOST POPULAR TEXT PROCESSING COMMANDS


                                     cat
Read one or more files and print them on standard output.

   cat filename.txt (display the content of filename.txt)
   cat -n myfiles.txt number all output lines, starting with 1
   cat > newfile to exit, enter EOF (Ctrl-D)
   cat >> newfile to append the file




                     ustlinuxschool.blogspot.com
BASIC COMMANDS


VI EDITOR
   External Link 1 2

   A screen-oriented text editor. Vi has two modes insert mode
    and command mode.


#vi filename (creating or opening a filename)
esc + i insert the text
:wq Save and exit
:q exit without save
:wq! save and exit forcefully (! forcefully)




                          ustlinuxschool.blogspot.com
BASIC COMMANDS




Formatting in command line

   mke2fs /dev/sda1
   mkfs.ext3 /dev/sda1
   mkfs.ext4 /dev/sda1




                  ustlinuxschool.blogspot.com
BASIC COMMANDS




TAR
was initially developed to write data to sequential I/O devices for tape
backup purposes. It is now commonly used to collect many files into one
larger file for distribution or archiving


    tar -cvf mytarball.tar file1 file2 file3
    tar -xvf mytarball.tar




                        ustlinuxschool.blogspot.com
BASIC COMMANDS




   System states
   shutdown      init 0, poweroff
   Reboot        init 6, reboot
   Sleep         echo mem > /sys/power/state
   Hibernation   echo disk > /sys/power/state




                   ustlinuxschool.blogspot.com
LINUX FILE SYSTEM TYPES


Ext2

Ext2 does not have journaling feature.
On flash drives, usb drives, ext2 is recommended, as it doesn‟t need to do the
  over head of journaling.
Ext3

The main benefit of ext3 is that it allows journaling.
Ext4

Supports huge individual file size and overall file system size.
Maximum individual file size can be from 16 GB to 16 TB
In ext4, you also have the option of turning the journaling feature “off”.



                       ustlinuxschool.blogspot.com

More Related Content

PPTX
Linux basics
PPTX
Introduction to Unix
PPTX
Unix Administration
PPT
Ch1 linux basics
PPTX
Unix Introduction
PPTX
Linux booting process - Linux System Administration
PPTX
Unix Operating System
PPTX
Unix Operating System
Linux basics
Introduction to Unix
Unix Administration
Ch1 linux basics
Unix Introduction
Linux booting process - Linux System Administration
Unix Operating System
Unix Operating System

What's hot (20)

PPTX
Unix operating system architecture with file structure
PPTX
Unix
PDF
Lecture 5 Kernel Development
PPTX
Unix operating system basics
PPTX
Unix and shell programming | Unix File System | Unix File Permission | Blocks
PDF
An Introduction To Linux
PPTX
Operating systems unix
PPT
Unit 1-a-brief-history-of-unix-ppt
PPTX
PPTX
How to design a file system
DOCX
Unix operating system
PPTX
ODP
Linux internal
PDF
Unix - An Introduction
PDF
Linux Presentation
PPT
Linux training
PDF
Linux admin course
PDF
Linux kernel architecture
PPT
Unix lecture1
DOCX
Linux notes
Unix operating system architecture with file structure
Unix
Lecture 5 Kernel Development
Unix operating system basics
Unix and shell programming | Unix File System | Unix File Permission | Blocks
An Introduction To Linux
Operating systems unix
Unit 1-a-brief-history-of-unix-ppt
How to design a file system
Unix operating system
Linux internal
Unix - An Introduction
Linux Presentation
Linux training
Linux admin course
Linux kernel architecture
Unix lecture1
Linux notes
Ad

Similar to Linux basics (20)

DOC
6 stages of linux boot process
DOCX
6 stages of linux boot process
PPT
Linux Booting Procedure system and networking.ppt
PDF
OS_lab_file.pdf
PPT
Unix Administration 2
PDF
Linux basics 1/2
PPT
Linux Booting Process
PDF
Linux systems - Linux Commands and Shell Scripting
PDF
Linux Systems: Getting started with setting up an Embedded platform
PPTX
Order of boot process in Linux
DOCX
6 stages of linux boot process
DOCX
6 stages of linux boot process
PPTX
Presentation for RHCE in linux
PDF
Linux introduction (eng)
PDF
Useful Linux and Unix commands handbook
PPT
Linux filesystemhierarchy
PPT
Intro to linux systems administration
PDF
Linux Fundamentals and how to use linux.pdf
PPTX
18 LINUX OS.pptx Linux command is basic isma
PDF
Introduction to linux
6 stages of linux boot process
6 stages of linux boot process
Linux Booting Procedure system and networking.ppt
OS_lab_file.pdf
Unix Administration 2
Linux basics 1/2
Linux Booting Process
Linux systems - Linux Commands and Shell Scripting
Linux Systems: Getting started with setting up an Embedded platform
Order of boot process in Linux
6 stages of linux boot process
6 stages of linux boot process
Presentation for RHCE in linux
Linux introduction (eng)
Useful Linux and Unix commands handbook
Linux filesystemhierarchy
Intro to linux systems administration
Linux Fundamentals and how to use linux.pdf
18 LINUX OS.pptx Linux command is basic isma
Introduction to linux
Ad

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Spectroscopy.pptx food analysis technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Cloud computing and distributed systems.
PDF
Approach and Philosophy of On baking technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Review of recent advances in non-invasive hemoglobin estimation
Spectroscopy.pptx food analysis technology
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
Cloud computing and distributed systems.
Approach and Philosophy of On baking technology
NewMind AI Weekly Chronicles - August'25 Week I
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
sap open course for s4hana steps from ECC to s4
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?

Linux basics

  • 2. Contents Kernel Shell Linux Filesystem Hierarchy Run Level Linux Booting Procedure Basic Commands  Text Processing Commands  Archives and Compressions  System states ustlinuxschool.blogspot.com
  • 3. OVERVIEW OF LINUX SYSTEM Linux Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance – Kernel.org External Links: tldp ustlinuxschool.blogspot.com
  • 4. Kernel External Links IBM Linux Kernel is the core component of GNU/Linux Operating System. Some of its functions include Process Management, Memory Management, File System, Device Drivers, I/O Management and Networking. The complete source code of the Linux Kernel can be freely downloaded from http://kernel.org/ ustlinuxschool.blogspot.com Contents..
  • 5. Shell Shell is an interface between user and kernel. Shell interprets your input as commands and pass them and pass them to kernel. Common shells in popular Linux Distributions include C Shell, Sh, K Shell, Bash  A program that interprets commands  Allows a user to execute commands by typing them manually at a terminal, or automatically in programs called shell scripts.  A shell is not an operating system. It is a way to interface with the operating system and run commands. ustlinuxschool.blogspot.com Contents..
  • 6. LINUX COMMAND FLOW ustlinuxschool.blogspot.com Contents..
  • 7. FEATURES OF LINUX OS  Multi-user & Multi- tasking  Supports full multitasking and multiuser functionalities.  Files and Process  Data, directory, processes and Hardware, almost everything are expressed as a file.  Process is an running program identified by a unique id (PID).  Case Sensitivity  Linux like UNIX is case- sensitive ( MYFILE.txt, Myfile.txt, mYfiLe.txt all are different) ustlinuxschool.blogspot.com
  • 8. NORMAL USER AND SUPER USER  In Linux system, one special user is created by default during installation which has almost unlimited power. This special user is called root or super user.  Conventionally, a normal User has the shell prompt ending in „$‟ sign.  Super User shell prompt ends in ‘#’ ustlinuxschool.blogspot.com Contents..
  • 9. Linux Filesystem Hierarchy . Top directory is “/”, which is called slash or root. ustlinuxschool.blogspot.com
  • 10. /home This is where user home directories are stored /etc Various system configuration files are stored here. /var Contains variable data like system logging files, mail and printer spool directories, and transient and temporary files. /dev This contains various devices as files, e.g. hard disk, CD-ROM drive, etc. /sys This contains the Kernel, Firmware and system related files /proc Process information pseudo-file system (system memory, devices mounted, hardware configuration, etc) /opt Reserved for all the software and add-on packages that are not part of the default installation. /tmp Contains mostly files that are required temporarily. Many programs use this to create lock files and for temporary storage of data Contents..
  • 11. /boot Has the bootable Linux kernel and boot loader configuration files(GRUB) /bin This contains files that are essential for correct operation of the system. These are available for use by all users. /sbin Binaries which are only expected to be used by the super user /usr Contains user documentation, games, graphical files, libraries /lib Contains Library files ustlinuxschool.blogspot.com
  • 12. RUN LEVEL The init process, by default, runs the system in one of the eight runlevels. Run Level Runlevel 0 Halt System - To shutdown the system Runlevel 1 Single user mode Runlevel 2 Basic multi user mode without NFS Runlevel 3 Full multi user mode (text based) Runlevel 4 Unused Runlevel 5 Multi user mode with Graphical User Interface Runlevel 6 Reboot System Contents..
  • 13. LINUX BOOTING  External Links Thegeekstuff IBM Contents..
  • 14. LINUX BOOTING BIOS  BIOS stands for Basic Input/Output System  Performs some system integrity checks  Searches, loads, and executes the boot loader program.  It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.  Once the boot loader program is detected and loaded into the memory, BIOS hands over the control to it.
  • 15. LINUX BOOTING MBR  MBR stands for Master Boot Record.  It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda  MBR is less than 512 bytes in size. MBR has three components  1) Primary boot loader info in 1st 446 bytes  2) Partition table info in next 64 bytes  3) MBR validation check in last 2 bytes.  MBR holds the first stage of GRUB boot loader (or LILO – Linux Loader in older systems).
  • 16. LINUX BOOTING GRUB  GRUB stands for GNU Grand Unified Boot loader.  GRUB is dynamically configurable. It loads its configuration at startup, allowing boot-time changes, such as selecting different kernels or initial RAM disks  GRUB can display splash screen. It loads the default kernel image as specified in the grub configuration file.  GRUB is highly portable. It supports multiple executable formats and is geometry translation independent.  GRUB supports operating systems that do not multiboot (MS Windows), by using chain loading.
  • 17. LINUX BOOTING KERNEL  Mounts the root file system as specified in the “root=” directive in the grub.conf file  Root file-system can also be specified in the GRUB prompt.  Kernel executes the /sbin/init program  Since init is the first program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a „ps -ef | grep init‟ and check the pid.  initrd stands for Initial RAM Disk.  initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
  • 18. LINUX BOOTING INIT  Looks at the /etc/inittab file to decide the Linux run level (In Red Hat Linux).  Following are the available run levels (In Red Hat Linux)  0 – halt  1 – Single user mode  2 – Multiuser, without NFS  3 – Full multiuser mode  4 – unused  5 – Graphical environment  6 – reboot  Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.  Execute „grep initdefault /etc/inittab‟ on your system to identify the default run level  If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.  Typically you would set the default run level to either 3 or 5.
  • 19. LINUX BOOTING RUNLEVEL PROGRAMS  When the Linux system is booting up, various services getting started. Those are the runlevel programs, executed from the run level directory as defined by your run level.  Depending on your default init level setting, the system will execute the programs from one of the following directories.  Run level 0 – /etc/rc.d/rc0.d/  Run level 1 – /etc/rc.d/rc1.d/  Run level 2 – /etc/rc.d/rc2.d/  Run level 3 – /etc/rc.d/rc3.d/  Run level 4 – /etc/rc.d/rc4.d/  Run level 5 – /etc/rc.d/rc5.d/  Run level 6 – /etc/rc.d/rc6.d/
  • 20. BASIC COMMANDS  External Link: SS64 oreillynet  man - format and display the on-line manual page man date  help - Display help for a built-in command date –help  info - information about the command („info‟ utility must be installed) info date
  • 21. BASIC COMMANDS  ls (ls lists the content of directory)  ls -l list the files with all information  ls –a list files including hidden files  ls –la long list with hidden files Check „man‟ page for all available options.
  • 22. BASIC COMMANDS  cd Change Directory  cd /home/user/  .  cd home/user/myfile.jpg,  cd .. goes one directory back  cd - return to the last directory  cd ~ go to the current user's home directory
  • 23. BASIC COMMANDS  Absolute bath /home (absolute path: Relating to file systems, the location of a directory or file that can be accessed regardless of the current working location of a user)  cd /home/user/mypicture.jpg  A reative pathname does not begin with a slash ( / ). Generally you specifies location relative to your current working directory  cd user/mypicture.jpg
  • 24. BASIC COMMANDS  mkdir Create one or more directories mkdir folder1 folder2 mkdir -p work/junk/questions work/junk/answers (mkdir -p Create intervening parent directories if they don't exist)
  • 25. BASIC COMMANDS  pwd Print the full pathname of the current working directory. See also the dirs shell command built into bash. Pwd  cp Copy files/directories cp file1 file2 cp –vrf dirA dirB  mv move files to another location or rename files mv /home/user/myfile /home/Admin/myfile mv myfile your file
  • 26. BASIC COMMANDS  rm remove files/directories rm myfile rm -rf mydirectory (rmdir remove directory)  find search for files in a directory hierarchy, find /home -name myfile
  • 27. BASIC COMMANDS  history shows the history of commands History -c Clear the history list ! Start a history substitution, except when followed by a space !n Refer to command line n. !-n Run the command n lines back. !! Run the previous command.
  • 28. BASIC COMMANDS  mount mounts a file system  The file structure on device is mounted on directory. If no device is specified, mount looks for an entry in /etc/fstab to find out what device is associated with the given directory. mount /dev/sdb1 /media mount -t to limit this to all filesystems of a particular type.  umount allows to unmount the mounted filesystems umount /dev/sdb1 or umount /media ustlinuxschool.blogspot.com
  • 29. BASIC COMMANDS  fdisk Linux command line disk partitioning tool  du Estimate file space usage  df shows the disk free  dd Convert and copy a file, write disk headers, boot records, create a boot floppy. dd can make an exact clone of an disk, this will include all blank space so the output destination must be at least as large as the input.dd if=linux_cd_image.iso of=/dev/sdb
  • 30. BASIC COMMANDS  touch to create empty file or updating the date and time to the current time  diff Display the differences between two files  clear Clear terminal screen  echo display a line of text echo "hello world" (displays hello world in command line) ustlinuxschool.blogspot.com
  • 31. BASIC COMMANDS wc - print the number of newlines, words, and bytes in files wc file1.txt grep - print lines matching a pattern ls /etc |grep –i network ustlinuxschool.blogspot.com
  • 32. BASIC COMMANDS MOST POPULAR TEXT PROCESSING COMMANDS cat Read one or more files and print them on standard output. cat filename.txt (display the content of filename.txt) cat -n myfiles.txt number all output lines, starting with 1 cat > newfile to exit, enter EOF (Ctrl-D) cat >> newfile to append the file ustlinuxschool.blogspot.com
  • 33. BASIC COMMANDS VI EDITOR  External Link 1 2  A screen-oriented text editor. Vi has two modes insert mode and command mode. #vi filename (creating or opening a filename) esc + i insert the text :wq Save and exit :q exit without save :wq! save and exit forcefully (! forcefully) ustlinuxschool.blogspot.com
  • 34. BASIC COMMANDS Formatting in command line mke2fs /dev/sda1 mkfs.ext3 /dev/sda1 mkfs.ext4 /dev/sda1 ustlinuxschool.blogspot.com
  • 35. BASIC COMMANDS TAR was initially developed to write data to sequential I/O devices for tape backup purposes. It is now commonly used to collect many files into one larger file for distribution or archiving tar -cvf mytarball.tar file1 file2 file3 tar -xvf mytarball.tar ustlinuxschool.blogspot.com
  • 36. BASIC COMMANDS  System states  shutdown init 0, poweroff  Reboot init 6, reboot  Sleep echo mem > /sys/power/state  Hibernation echo disk > /sys/power/state ustlinuxschool.blogspot.com
  • 37. LINUX FILE SYSTEM TYPES Ext2 Ext2 does not have journaling feature. On flash drives, usb drives, ext2 is recommended, as it doesn‟t need to do the over head of journaling. Ext3 The main benefit of ext3 is that it allows journaling. Ext4 Supports huge individual file size and overall file system size. Maximum individual file size can be from 16 GB to 16 TB In ext4, you also have the option of turning the journaling feature “off”. ustlinuxschool.blogspot.com