Presentation is loading. Please wait.

Presentation is loading. Please wait.

Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.

Similar presentations


Presentation on theme: "Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar."— Presentation transcript:

1 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar for a specified month apache{kkhan}2: cal January 2008 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

2 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal 6 2008 apache{kkhan}21: cal 6 2008 June 2008 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

3 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal 2008 apache{kkhan}25: cal 2008 Jan Feb Mar S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 2 3 4 5 1 2 1 6 7 8 9 10 11 12 3 4 5 6 7 8 9 2 3 4 5 6 7 8 13 14 15 16 17 18 19 10 11 12 13 14 15 16 9 10 11 12 13 14 15 20 21 22 23 24 25 26 17 18 19 20 21 22 23 16 17 18 19 20 21 22 27 28 29 30 31 24 25 26 27 28 29 23 24 25 26 27 28 29 30 31 Apr May Jun S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14 13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21 20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28 27 28 29 30 25 26 27 28 29 30 31 29 30

4 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cat The command outputs the contents of a text file. cat file1 >> file2 Appends file1 onto the end of file2 apache[kkhan:193] cat foo1 Desktop PUTTY.RND foo1 typescript apache[kkhan:194] cat foo2 Mail QUIZ 2.doc foo2 typescript /net/core/export/home/cs/001/k apache[kkhan:197] cat foo1 >> foo2 Mail QUIZ 2.doc foo2 typescript /net/core/export/home/cs/001/k Desktop PUTTY.RND foo1 typescript

5 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cd – This command changes your current directory location. By default, your UNIX login session begins in your home directory. cd myfiles – will switch to subdirectory named myfiles cd /home/myfiles/mydocs – will switch to mydocs directory cd.. – will move the parent directory of the current directory cd / - to move to the roor directory chmod – This command changes the permission information associated with a file. All UNIX directories and files are stored with the permissions to read, write, or execute the file, abbreviated as r, w, x. These permissions are broken down for three categories of user: the owner of the file ‘u’, a group to which both the user and the file may be associated ‘g’; and all users ‘o’.

6 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands chmod u+x myfile – allow yourself to execute a file that you own chmod o+rx myfile – allow anyone who has access to the directory in which myfile is stored to read or execute myfile; perform ‘ls –l’ to view the directory cp – This command copies a file, preserving the original and creating an identical copy. If you already have a file with the new name, cp will overwrite and destroy the duplicate. It is always safe to use ‘-i’ option; so the system ask for your approval before it destroys any files. cp -i oldfile newfile

7 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cp -i /home/myfiles/notes/meeting1. The. period indicates the current directory as destination, and the -i ensures that if there is another file named meeting1 in the current directory, you will not overwrite it by accident cp -i oldfile ~/myfiles/newfile The ~ character (tilde) is interpreted as the path of your home directory. Note: You must have permission to read a file in order to copy it.

8 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands find This find command lists all of the files within a directory and its subdirectories that match a set of conditions. This command is most commonly used to find all of the files that have a certain name. find. –name lecture* -print find "$HOME/" -name lecture* -print searching for files containing lecture in the name in the home directory

9 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands jobs This command reports any programs that you suspended and still running or waiting in the background (Ctrl-z to suspend) kill Use this command as a last resort to destroy any jobs or programs that you suspended and are unable to restart. Use the jobs command to see a list of suspended jobs kill %3 – to kill a suspended job number three kill -9 %3 – If the job has not been cancelled, harsher measures may be necessary.

10 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands less and more Both less and more display the contents of a file one screen at a time, waiting for you to press Spacebar between screens. This lets you read text without it scrolling quickly off the screen. The less utility is more powerful and flexible than more, but more is available of all UNIX systems while less may not be. less myfile ls –la | less

11 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command lpr and lp These commands print a file on a printer connected to the computer network. The lpr command is used on BSD systems, and the lp command is used in System V Note: BSD: Berkley Software Distribution System V: Developed by AT&T; release in 1983

12 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands lpr –Plp1 myfile will print a files named myfile on a printer named lp1 with lpr lp –dlp1 myfile will print the same file to the same printer with lp command ls – list the files stored in a directory ls –a – will list the configuration files such as.login (dot files) ls –la – to see the file permissions, owners, and sizes of all files ls –la | less

13 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands mkdir – will make a new subdirectory mkdir mystuff create a subdirectory named mystuff in the existing directory mkdir /tmp/mystuff create subdirectory named mystuff in the existing directory named tmp Note: In order to create a subdirectory in a particular directory, you must have permission to write to that directory mv – this command will move a file use mv not only to change the directory location of a file, but also rename files; Unlike the cp command, mv will not preserve the original file

14 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands As with the cp command, you should always use –i to make sure you do not overwrite an existing file mv –i oldname newname to move a file named oldname in the current directory to the new name newname mv –i newhw/hw1 oldhw move a file named hw1 from subdirectory named newhow to another subdirectory oldhw mv -i newhw/hw1 oldhw/firsthw you also want to give the file a new name; such as firsthw

15 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands ps This command displays information about processes that are currently running. ps –alxww (BSD) to view detailed information about all running processes ps –elf (in System V)

16 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands pwd The command reports the current directory path. rm The command will remove (destroy) a file. must enter with -i option for confirmation rm -i junk will permanently remove the file rm –rf oldstuff will remove a directory and all its contents- oldstuff rmdir This command will remove a subdirectory rmdir oldstuff (must be empty)

17 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands set This command displays or changes various settings and options associated with your UNIX session. set | less vi This command starts a vi text editor vi myfile w and who w – gets the list of what users are doing who – gets the computer names of the terminal they are using

18 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands tail show the last 10 lines of a file clear clears the terminal window head writes the first 10 lines of the file to the screen head -5 myfile

19 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands grep search for a string in a file use -i option to ignore upper/lower case distinction use –v option to display lines that do not match sort sort alphabetically or numerically a list ls | sort who | sort ls ?ouse will match one character (house, mouse, not grouse)

20 second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands apropos When you are not sure of the exact name of a command apropos keyword will give you the commands with keyword in their manual pages try apropos copy


Download ppt "Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar."

Similar presentations


Ads by Google