access to linux n.
Skip this Video
Loading SlideShow in 5 Seconds..
Access to Linux PowerPoint Presentation
Download Presentation
Access to Linux

Access to Linux

204 Views Download Presentation
Download Presentation

Access to Linux

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Chapter 9 Part II Linux Command Line Access to Linux • Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will be shown only if the authentication information is correct. • The Linux prompt includes the user name, followed by a @machine name. ( wpilkey@Linux:~# ) • The Linux command syntax is very basic, and starts with a Linux command separated by spaces, and followed by optional parameters and switches. • A switch changes the way a command runs.

  2. Basic Linux Skills and Concepts • Comparing DOS and Linux • DOS is single user, single tasking • Linux is multi-user, multitasking • Many differences & Similarities in command-line interface • The Shell • Character-mode user interface component • Processes commands • Issues error messages and other feedback • Called COMMAND.COM in DOS • Called BASH in Linux

  3. Basic Linux Skills and Concepts • Case Sensitivity • DOS is case insensitive • Linux is case sensitive • Designation of Switches • A switch changes the way a command runs • Switches in DOS begin with a slash (/) • Switches in Linux begin with a dash (-) • Use of Spaces • DOS allows a space to be omitted between a command and a switch • Each part of a Linux command must be separated by a space • These commands will not work in Linux • shutdown-h now • shutdown -hnow

  4. Basic Linux Skills and Concepts • Paths • DOS and Windows • Paths begin with a drive designator (C:) • A backslash (\) after the drive designator indicates the root of that logical drive • Portions of path separated with backslashes • Linux • No drive letter designation • Path begins with a slash (/) indicating the root • Portions of path separated with slashes • Example: /etc/gtk • Everything (devices, services, etc.) is a file • /dev/sda0 (the first hard drive on a SCSI interface) • /dev/hda1 (the first hard drive on an IDE interface)

  5. Basic Linux Skills and Concepts • Linux Feedback • DOS and Linux similar in providing cryptic feedback • No feedback when command is successful • Both provide error messages • Linux provides minimum output • DOS dir command lists more information on files • Linux ls command (without switches) only shows file names

  6. Basic Linux Skills and Concepts • The Command Syntax • command<space>option<space>option… • Options preceded by a - hyphen are switches • Multiple switches can be combined behind one hyphen • Another type of option is a parameter • File name, directory, device name, or other. • Parameter at end of command • Syntax: command –switch parameter • Example: ls –a /etc

  7. Basic Linux Skills and Concepts • Command-Line History • Shell commands are saved during a session • Scroll through the commands at the $ prompt • Up Arrow and Down Arrow • Move within a command to edit it • Left Arrow and Right Arrow • Press Enter to run command • Command history saved in the bash_history file • Command Completion • A feature that completes a command line • Enter portion of a command and press the Tab key • Linux will try to guess the remaining portion

  8. Shells, Terminals, and the Kernel • Terminal • Channel that allows a certain user to log in and communicate with the kernel via a user interface

  9. Shells, Terminals, and the Kernel • Shell • User interface that accepts input from the user and passes the input to the kernel for processing • Shell used by default in Linux is the BASH Shell

  10. The Linux Directory Structure • Is arranged hierarchically using a series of directories to store files, and the location of these directories and files can be described using absolute or relative pathnames Linux Windows Figure 4-2: The Linux filesystem structure

  11. DOS versus Linux • Case sensitivity – Linux is case-sensitive, DOS is Not. • Switches – Linux switches start with a hyphen (-) whileDOS switches start with a slash (/). • Spaces – Linux command line must be separated by a space. DOS commands can work with or without a space • Path - Linux uses the forward slash (/) to indicate a path to a folder, while DOS uses the backslash (\) character to indicate a path to a folder. • Output – Linux provides only the minimum output while DOS provides a very descriptive output.

  12. Shell Metacharacters • Metacharacters: characters that help define other characters • Key combinations that have special meaning in the Linux

  13. Command Sampler

  14. Command Line • The pwd command Print Working Directory - The default action is to show the current folder as an absolute path. • The cd command Change Directory - change the current working directory to a specific Folder. # cd /usr/local/sybase move to sybase folder # pwd print current folder /usr/local/sybase # cd .. move up one folder # pwd print current folder /usr/local/

  15. File Permissions Anatomy of ls –l output

  16. Listing the Contents of a Folder • The ls command is used to list the contents of a folder and information about files, by default the current directory. • By default, the ls command only provides the names of visible files in the current folder. • Some frequently used swicthes: -l, -a, -F # ls –al total 109 drwxr-xr-x 18 root root 4096 Jun 9 21:12 ./ drwxr-xr-x 18 root root 4096 Jun 9 21:12 ../ drwxr-xr-x 2 root root 4096 Jun 9 21:14 bin/ drwxr-xr-x 3 root root 1024 Jun 9 20:32 boot/ drwxr-xr-x 6 root root 36864 Jul 12 10:26 dev/ drwxr-xr-x 34 root root 4096 Jul 12 10:25 etc/ drwxr-xr-x 5 root root 4096 Jun 9 21:28 home/ File type, permissions, hard link count, file owner, group owner, size, mod date, directory name, filename or pointer.

  17. Creating folders and Deleting in Linux • The mkdircommand Create new folder(s), if they do not already exist. Create labdir directory underneath the current directory # mkdir labdir • The rmdir command Remove folder(s), if they are empty. # rmdir labdir • The ‘rm’ command is used for deleting files & folders • The command requires at least one parameter – the name of the file to be deleted. Defaults to –i or interactive prompt # rm filename

  18. Renaming or Moving Files in Linux • The mv command is used to rename a file or to move a file from one folder to another. Defaults to –i or interactive prompt • The command required two parameters – the name of the original file and the new name or location of the file. Rename hosts file to hosts2, if hosts2 exists, you are prompted # mv hosts hosts2 Force rename without prompting # mv –f hosts hosts2

  19. Copying Files in Linux • The cp command is used to copy one or more files to another location. Can be used to do backups. Defaults to –i or interactive prompt • The command requires two parameters – the source file and the destination where the file has to be copied. Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY copy home directory to floppy -f switch means remove existing destinations, never prompt # cp -f /mnt/floppy/* /home/simon Copy file hosts from directory /etc to this directory “ .” # cp /etc/hosts .

  20. Displaying the Contents of a File • The cat command displays the entire contents of a file. # cat filename • The more and less commands display the contents of a file one page at a time, ironically less provides more emulation and extensive enhancements, (moving, jumping, searching, line edit) • The head command displays the first ten lines of a file. • The tail command displays the last ten lines of a file.

  21. Logoff and Shutdown in Linux • The exit command or the CTRL-D key combination can be used to log out Linux • The shutdown –h now command is used to shut down the Linux machine immediately, and halt after shutting down. Normally root can shut down Linux from command line • A Linux GUI will allow ordinary user to shutdown Select Log Out | Shutdown • Root can enable/disable this feature in the GUI • shutdown –h now • Linux shuts down and turns off the computer • shutdown –r now • Linux shuts down and reboots the computer

  22. Basic Linux Skills and Concepts • The Help Manual • Online manual accessed with man command • Syntax: mancommand • Where command is the name of the command you wish to view • Enter man man to see documentation for the man • Page Down & Page Up to scroll one screen at a time • Up Arrow and Down Arrow to scroll one line at a time • man shutdown • The man command will display the complete list of switches for the shutdown command

  23. The Filesystem Hierarchy Standard (FHS) Table 5-1: Linux directories defined by FHS