1 / 20

Introduction to Linux Commands

Introduction to Linux Commands. By:- GAGAN KUMAR C.S.E 7 TH SEMESTER 3710103. Introduction. SHELL 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.

dextra
Download Presentation

Introduction to Linux Commands

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Linux Commands By:- GAGAN KUMAR C.S.E 7TH SEMESTER 3710103

  2. Introduction SHELL 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 operating system and run commands. BASH BASH= Bourne Again Shell Bash is a shell written as free replacement to the standard Bourne Shell (/bin/ sh) originally written by Steve Bourne for UNIX Systems. It has all the features of the original Bourne Shell, plus additions that make it easier to program with and use from the command line. Since it is Free Software, it has been adopted as the default shell on most Linux Systems.

  3. Command Syntax Commands can run by themselves, or you can pass in additional arguments to make them do different things. Typical command syntax can look something like this: command [-argument] [-argument] [--argument] [file] Examples: ls List files in current directory ls –l Lists files in “long” format ls–l –color As above, with colorized output cat filename Show contents of a file cat –n filename Show contents of a file, with line numbers

  4. Navigating the Linux File system The Linux file system is a tree-like hierarchy of directories and files. At the base of the file system is the “/” directory, otherwise known as the “root” (not to be confused with the root user). Unlike DOS or Windows file systems that have multiple “roots”, one for each disk drive, the Linux file system mounts all disks somewhere underneath the / file system.

  5. The Linux Directory Layout

  6. Working With Files and Directories

  7. Commands for Navigating the Linux Filesystems

  8. Finding Things

  9. Vi Editor Vi Editor is used for editing the documents, it can read and write the text files.

  10. Informational Commands

  11. Other Utilities

  12. Shell Script Write a Shell Script to print the following Linux Command. 1. Ask for the User name to be entered. 2.Print Welcome Mr. User 3. The Date and Time 4. Your are Mr. User 5. Thank You

  13. Steps to Write Shell Script $ cat >scriptdemo echo "Please Enter Your Name" read Name echo "Welcome Mr.$Name" echo "Date and Time is:`date`" echo "You are Mr.`whoami`" echo "Thank You” -> Press (Ctrl + d) to save file $chmod +x script demo $./scriptdemo

  14. Write a Shell Script to Find Sum of Two Numbers $ cat >calculate echo "Enter a" read a echo "Enter b” read b echo "Sum:`expr $a + $b`" ->Press (ctrl +d) to save file $ chmod +x calculate $ ./calculate

  15. Write a shell Script to print 10 numbers cat >while a=0 while [ $a -lt 10 ] Do echo $a a=`expr $a + 1` done

  16. Tree Structure of Directories Cd /usr/local/bin Cat >tree #!/bin/bash SEDMAGIC='s;[^/]*/;|____;g;s;____|; |;g’ if [ "$#" -gt 0 ] ; then dirlist="$@" else dirlist=".” fi for x in $dirlist; do find "$x" -print | sed -e "$SEDMAGIC" Done Press (ctrl +d) to save Chmod +x tree Run in any Directory

  17. Shortcuts to Make it all Easier!

More Related