Presentation is loading. Please wait.

Presentation is loading. Please wait.

PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.

Similar presentations


Presentation on theme: "PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training."— Presentation transcript:

1 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training Academy Linux Series

2 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Why Use the Shell? The command prompt on Windows is also called the shell, the terminal, or the console on Linux It is also worth noting that you can use Linux without using the shell However, all tasks can be completed using the shell Q. Why should you use consider using the command prompt? A. You can perform your tasks quicker, access more powerful programs with more options, and have an ability to automate your tasks

3 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Some Notes Everything in Linux is treated as a file by the operating system, e.g. processes, executables, text files, etc. If you are logged in as a normal user, you should see a dollar sign in your shell $ or a right arrow > If you are logging in as the super user or the root user, you should see a hash sign in your shell # On Windows you may have been used to using the term folder, on Linux folders are more commonly called directories

4 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Some Notes To make your life easier in the shell, you should avoid creating files and directories with spaces in them Instead Linux users usually use a dash, underscore, or capitalise first letters of words. For example: project_results, project-results, projectResults Finally, always keep your files and directories organised. In particular, give your files meaningful names

5 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Navigation pwd: print working directory – To find out where you are in the filesystem, type: pwd ls: list files – e.g. to list the files in a directory type: ls – To list extra information about files (long listing), type: ls -l

6 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Navigation cd: change directory – e.g. to change into the projects directory, type: cd projects – If you ever get lost in the filesystem, you can type cd on its own: cd – To go back a level you can use: cd..

7 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Navigation – Note: The location of the current directory is represented by a single dot. – Note: The location of the previous directory is represented by 2 dots.. – Note: The location of your home directory is represented by a tilde sign ~ and this allows you to use the shortcut cd ~/myprojects instead of cd /home/ict/myprojects

8 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Viewing cat – concatenate file contents all at once – e.g. to output the contents of poetry.txt type: cat poetry.txt more – view file contents by screen less – view file contents by screen For example, if your poetry file is very large, you can use more or less to output the contents one screen-full at a time They are more or less the same! Except that less allows you to go backwards

9 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Creation touch: create an empty file – e.g. to create an empty file named project_results, type: touch project_results mkdir: make a directory – e.g. to create an empty directory named course_work, type: mkdir course_work

10 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Editing vi – text editor basics: The vi editor is available on all Linux and Unix systems. For this reason it is worth learning You must choose a mode to enter, for example, insert mode to insert new text To exit a mode use the Esc key, e.g. Press i to enter insert mode – Usage: vi filename – Search forward: /searchword – Search backward: ?searchword – Undo: u – Save and exit: :wq – Exit without saving: :q

11 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Editing emacs – text editor basics: While emacs is available on the majority of Linux and Unix machines, it is not guaranteed like vi – Usage: emacs filename – Save: Ctrl-x Ctrl-s – Search forward: Ctrl-s – Search backward: Ctrl-r – Undo: Ctrl-shift-underscore – Help: Ctrl-h – Exit: Ctrl-x Ctrl-c

12 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Commands: Editing gedit – text editor gedit is an editor available on the Gnome desktop similar to WordPad on Windows The equivalent of gedit on the KDE desktop is kwrite Both these editors support syntax highlighting and other useful intuitive features

13 PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Command Line Exercises 1)Using the command line, list the contents of your home directory 2)Check that you are in your home directory using a command 3)Create a directory called projects and change into it 4)Use emacs to create a file called poetry.txt inside the projects directory and save a few lines from a poem 5)Exit emacs and check the contents of poetry.txt in the terminal 6)To finish, return to your home directory using the least amount of keystrokes possible


Download ppt "PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training."

Similar presentations


Ads by Google