Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.

Similar presentations


Presentation on theme: "Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things."— Presentation transcript:

1

2 Cosc 4750 Getting Started in UNIX

3 Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.

4 Interesting Note With MS Windows Server 2008 –One install option installs minimal GUI interface and no GUI applications/controls. DOS only, similar to SafeMode. –Everything is supposed to be able to done with the command line and scripting.

5 Login You can use ssh from the open labs –On IT labs and cosc labs, you can use the windows ssh X-terms: Log directly into the UNIX system using their windowing system. Linux: Gnome/KDE SUN: Common Desktop Environment (CDE) Changing your password –Frontier: passwd –Hive/cosc linux systems: yppasswd

6 Editors GUI editors –Emacs, Nedit –Many others. Non-GUI –vi (vim) The only editor a sys admin needs Simple yet very powerful, very little setup, works in a remote session. –pico The editor used by pine.

7 vi Operates in two modes –Command mode (default) When in input mode, press ESC key to get to command mode –Input mode When in command mode, press i key to get to input mode (several other ways as well) Defaults to full screen mode, but when not able it functions as a line editor If arrow keys don’t work, use h(left), l (right), j (down), k (up) in command mode Insert mode, keys act like normal. –press i, then type normally. When finished press ESC key.

8 Command mode commands (case sensitive) –x deletes current character –r replace current letter, R replace until ESC is pressed –dw deletes from current position to end of word –dd deletes current line –You can only exit vi from command mode –:wq or ZZ save the file and exit –:q! exit without saving. Also has cut and past, search and replace, and “wild card” search and replace The just enough UNIX book has lot of the commands –Chapter 14 has an great tutorial for vi. as well as man pages. man vi

9 File Management Remember UNIX is hierarchical –ls  lists contents of current directory –cat  lists contents of a file –more or less  same as cat, only 1 page at a time –rm  deletes a file from the directory Directories are just special files Can be edited, but DON’T do it. –mkdir  create a directory specified directory –rmdir  removes the specified directory –cd  change directory –pwd  tells you what your current working directory is

10 . represents the current directory.. represents the parent directory./x same as x../x not the same as x../x same as cd..;./x cd.. changes to the parent directory You can always specify the path in UNIX –/a/d/mx.exe is an absolute pathname –../a/d/mx.exe is a relative pathname

11 Other File commands cp a b  copy file a to b mv a b  renames file a to b mv a../b  moves file a to the parent directory as b You can use wildcards to specify multiple files –* matches 0 or more characters in the filename –cp *.exe../. cp a*.exe cp add.*../. –? matches a single character, so –cp ?dd.exe../. but not dd.exe

12 Other commands finger talk write –mesg n –mesg y w whereis which grep X head tail

13 Printing lpr prints file to default printer lpr –Pen4059 prints to laser printer in 4059 lpq lists the queue of files to be printed (default printer) lpq –Pen4059 lists files to be printed to 4059 lprm –Pen4059 # removes print # from queue lprm –Pen4059 removes first job from queue lpc status lists the status of all printers lpc status en4059 lists only the 4059 printer

14 Pipes and redirection cat x.txt >y.txt copies x.txt into y.txt cat x.txt >>y.txt appends x.txt into y.txt ls >y.txt lists directory info into y.txt cat <x.txt works like cat x.txt mail bozo <x.txt mails the file x.txt to bozo cat >new.txt control-D or sometimes. and return puts all the text into the file

15 Getting help On-line documentation –man (stands for manual) –man man (help on using help) –man ls (help on the ls command) Man pages can be cryptic at times, but very useful.

16 Other commands UNIX has dozen of commands, I haven’t covered. –Some we will cover as part of the system admin and learn in labs. –You can always look through the Sobell book for more commands. –Some commands don’t work on all UNIX flavors. –vi commands are standard but there are “extra” commands with vim, which may not work on other UNIX/Linux versions.

17 Q A &


Download ppt "Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things."

Similar presentations


Ads by Google