Unix Introduction. Part 3

Size: px
Start display at page:

Download "Unix Introduction. Part 3"

Transcription

1 Unix Introduction Part 3

2 More Unix Commands cat more head tail

3 Working with files Now that you can navigate directories and move files around, you need to be able to work with the files and directories themselves.

4 cat - concatenate to link together This command will let you view the contents of a file. $ cat filename

5 cat - concatenate to link Practice: together View the contents of final.paper (in dir2). $ cat final.paper

6 more - view more However, on large files the contents will fly by too quickly to read when you use cat. The command more will let you view the contents of a file, one page at a time. $ more filename

7 more - view more Press the spacebar to go forward one screen. Press the b key to go back one screen. Press the q key to return to the shell prompt.

8 Practice: more - view more View the contents of history.txt (in dir2). $ more history.txt

9 head - view head of file Using head you can view the top ten lines in a file, which can often give you a good idea of what is in the file. $ head filename

10 tail - view tail of file Similar to head, tail will show you the last ten lines of a file. $ tail filename

11 head / tail Practice: View the beginning and end of the file shrodinger (in dir1). $ head shrodinger $ tail shrodinger

12 file - file type In Unix it is not immediately apparent what type of file you have (HTML files, ASCII text, images, etc.) Type file, then the file name. $ file filename

13 file - file type $ cd../dir2/picts $ file Unixbutton.JPG Unixbutton.JPG: JPEG file However, keep in mind that sometimes the output of file is just a guess by the system.

14 Practice: file - file type What is the file type of final.paper? What is the file type of cats in dir2?

15 Review More Unix Commands cat view the contents of a text file more use to view files a screen at a time head see the first few lines of a file tail see the last few lines of a file file filename ask Unix to try to determine the file type

16 Review More Unix Commands Remember to check the man pages for each of the new commands as well.

17 Archiving and Compressing Data

18 Archiving with tar

19 Archiving with tar This subject can fall into the general housekeeping of your files. You can put all of your related files and store them as one larger separate file called a tarfile.

20 Archiving with tar Creating a file archive (tarfile) can help you organize your files for storage or transfer.

21 Archiving with tar You can use a file archive (tarfile) when you:! want to keep files for later reference but are done with them at the moment.! want to compress groups of files for storage or transfer to other hosts.

22 Archiving with tar Tar (tape archive) is one Unix command we use to accomplish this. Tar can also send files directly to a magnetic tape but for our purposes we will use it to make file archives. We used this the first day to extract your Unix_class subdirectory structure.

23 Archiving with tar Creating a tarfile Suppose we want to archive a directory. Let s take dir2 from our Unix_class examples. It is always a good idea to verify the name of the directory you want to archive.

24 tar Practice Start by moving into your Unix_class subdirectory. $ ls l drwxrwxr-x 2 userid userid 512 Jun 28 17:52 Animal drwxrwxr-x 2 userid userid 512 Jun 18 21:31 Shakespeare drwxrwxr-x 2 userid userid 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 userid userid 512 Jun 24 15:38 dir1 drwxrwxr-x 4 userid userid 512 Jun 24 13:55 dir2 drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3 We will keep the example simple and create the archive file in the same directory.

25 tar Practice Type: $ tar cvf dir2.tar dir2

26 tar Practice dir2/ 0K dir2/.ds_store 7K dir2/address_list 1K dir2/final.paper 1K dir2/history.txt 7K dir2/picts/ 0K dir2/picts/unixbutton.jpg 24K dir2/cats/ 0K dir2/cats/catsup/ 0K dir2/cats/cathode/ 0K dir2/cats/caterpillar/ 0K dir2/cats/caterpillar/butterfly 1K dir2/cats/caterpillar/larva 1K dir2/cats/catalyst 1K

27 $ ls l drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 4 userid userid tar Practice 512 Jun 28 17:52 Animal 512 Jun 18 21:31 Shakespeare 512 Jun 18 20:10 Wildcards 512 Jun 24 15:38 dir1 512 Jun 24 13:55 dir2 -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3 If we list our directory we should see the dir2.tar at the same level in hierarchy as dir2.

28 tar Practice You will see that you have a file named dir2.tar and it is not a directory, but a regular file. $ ls l drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 4 userid userid 512 Jun 28 17:52 Animal 512 Jun 18 21:31 Shakespeare 512 Jun 18 20:10 Wildcards 512 Jun 24 15:38 dir1 512 Jun 24 13:55 dir2 -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3

29 Archiving with tar What we did here is create a tarfile called dir2.tar which is a file archive of all the files and directories under dir2. Lets look at tar more closely. There are many options and different ways to use the command, but we will focus on the ones you will use most often.

30 Archiving with tar $ tar -cvf filename.tar directoryname

31 Archiving with tar The options: $ tar cvf filename.tar directoryname

32 The options: Archiving with tar $ tar cvf filename.tar directoryname -c tells tar to create

33 Archiving with tar The options: $ tar cvf filename.tar directoryname -v tells tar to be verbose in the output it provides. This is not necessary, but it is helpful to see what is going on. It tells you what you are doing (appending or extracting) and the file names and sizes.

34 The options: Archiving with tar $ tar cvf filename.tar directoryname -f tells tar that we are using a tarfile and the next [operand] has to specify the name of the tarfile. If we did not specify the -f option then tar would assume that your files are going to tape.

35 Archiving with tar We use certain things in Unix by convention and not by any rule. $ tar cvf filename.tar directoryname

36 Archiving with tar We use certain things in Unix by convention and not by any rule. $ tar cvf filename.tar directoryname When we specify a name for our tarfile (file archive) it is good practice to use the.tar extension.

37 Archiving with tar We use certain things in Unix by convention and not by any rule. $ tar cvf filename.tar directoryname I also recommend, if you are tarring a whole directory as in our example, to have the new filename be the same as the original directory name.

38 Archiving with tar tar cvf /home/jsmith/tarfiles/dir2.tar dir2 tar cvf ~/tarfiles/dir2.tar dir2 If we wanted the tarfile to be stored somewhere else in your directory structure, you could specify an absolute or relative pathname in front of the tarfile. It could be stored anywhere in which you have write permissions. Remember that the tarfiles directory has to already exist

39 Archiving with tar tar cvf /home/jsmith/tarfiles/dir2.tar dir2 pathname tarfile original directory If we wanted the tarfile to be stored somewhere else in your directory structure, you could specify an absolute or relative pathname in front of the tarfile. It could be stored anywhere in which you have write permissions.

40 Extracting with tar Extracting a tarfile: At some point in time you will probably need access to individual files that reside in your archive. You can extract the file individually or the whole archive. For the purpose of our example we will extract the contents of dir2.tar to another location.

41 Extracting with tar First, from our home directory, let s do a listing of our Unix_class directory. $ cd (takes us to the top of our home directory) $ ls -l Unix_class

42 $ cd Extracting with tar $ ls l Unix_class drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 2 userid userid drwxrwxr-x 4 userid userid 512 Jun 28 17:52 Animal 512 Jun 18 21:31 Shakespeare 512 Jun 18 20:10 Wildcards 512 Jun 24 15:38 dir1 512 Jun 24 13:55 dir2 -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3 We want to extract the tarfile to a different location. In this case, the top of our home directory.

43 Extracting with tar When we extract our tarfile using this particular example, we need to be in the directory in which we want the files to end up. For more tar options, see the man page on tar.

44 Extracting with tar $ pwd (always a good habit to get into) Make sure you are in your home directory (not in Unix_class).

45 Extracting with tar Type: $ tar xvf Unix_class/dir2.tar -x ( this option means to extract)

46 Extracting with tar dir2, 0 bytes, 0 tape blocks dir2/.ds_store, 6148 bytes, 13 tape blocks dir2/address_list, 455 bytes, 1 tape blocks dir2/final.paper, 716 bytes, 2 tape blocks dir2/history.txt, 7091 bytes, 14 tape blocks dir2/picts, 0 bytes, 0 tape blocks dir2/picts/unixbutton.jpg, bytes, 48 tape blocks dir2/cats, 0 bytes, 0 tape blocks dir2/cats/catsup, 0 bytes, 0 tape blocks dir2/cats/cathode, 0 bytes, 0 tape blocks dir2/cats/caterpillar, 0 bytes, 0 tape blocks dir2/cats/caterpillar/butterfly, 325 bytes, 1 tape blocks dir2/cats/caterpillar/larva, 103 bytes, 1 tape blocks dir2/cats/catalyst, 174 bytes, 1 tape blocks

47 Extracting with tar The verbose output tells you that it is extracting (the x at the beginning) and lists the file names and sizes.

48 Extracting with tar $ ls Verify dir2 is there in your home directory: dir2 Unix_class

49 Extracting with tar Remember that when you extract, your original tarfile is still there where you put it in the first place. You can extract it as many times as you like to any other locations in which you have write permissions.

50 Compressing and Uncompressing

51 Compressing and Uncompressing Compressing reduces the file size using a special encoding. Tarring files and compressing often go hand in hand. You can compress a whole tarfile without having to compress each individual file.

52 Compressing and Uncompressing This will be helpful if you have large directories that you ve tarred and will not need for some time and you want to save some disk space.

53 Compressing and Uncompressing As you could imagine, it will also save on upload/download times with sftp if your file is compressed before sending it to another host.

54 Compressing and Uncompressing The compression command we recommend is gzip. It was designed to replace the older Unix command simply called compress. It is more efficient and free, therefore it is widely supported on other platforms.

55 Compressing and Uncompressing gzip is used to compress (zip) a file or files gunzip is used to expand (unzip) a file or files gzip produces files with a.gz extension

56 Compressing and Uncompressing Using gzip to compress a file.

57 Compressing Practice Let s find our previous tarfile (dir2.tar) that should reside at the top of your Unix_class directory and try this handy utility. $ cd Unix_class $ ls -l

58 Compressing Practice $ cd Unix_class $ ls l drwxrwxr-x 2 userid userid 512 Jun 28 17:52 Animal drwxrwxr-x 2 userid userid 512 Jun 18 21:31 Shakespeare drwxrwxr-x 2 userid userid 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 userid userid 512 Jun 24 15:38 dir1 drwxrwxr-x 4 userid userid 512 Jun 24 13:55 dir2 -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3

59 Compressing Practice Type: $ gzip dir2.tar Let s take a look at what we did.

60 Compressing Practice $ gzip dir2.tar $ ls l drwxrwxr-x 2 userid userid 512 Jun 28 17:52 Animal drwxrwxr-x 2 userid userid 512 Jun 18 21:31 Shakespeare drwxrwxr-x 2 userid userid 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 userid userid 512 Jun 24 15:38 dir1 drwxrwxr-x 4 userid userid 512 Jun 24 13:55 dir2 -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar.gz drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3

61 Compressing and Uncompressing $ gzip filename In it s simplest form the only [operand] you have to supply to gzip is the filename you want to compress (zip). In this case we used dir2.tar.

62 Compressing and Uncompressing Notice the file size difference between the unzipped file and the zipped one. before: -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar after: -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar.gz Also notice the.gz extension

63 Compressing and Uncompressing Using gunzip to uncompress a file.

64 Compressing and Uncompressing Here again, the command can be very simple. Always look to the man page for more options. The basic usage of the gunzip command is to reverse the operation of the gzip command.

65 Uncompressing Practice Type: $ gunzip dir2.tar.gz Let s take a look at what we did.

66 Uncompressing Practice $ gunzip dir2.tar.gz $ ls l drwxrwxr-x 2 userid userid 512 Jun 28 17:52 Animal drwxrwxr-x 2 userid userid 512 Jun 18 21:31 Shakespeare drwxrwxr-x 2 userid userid 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 userid userid 512 Jun 24 15:38 dir1 drwxrwxr-x 4 userid userid 512 Jun 24 13:55 dir2 -rw-rw-r-- 1 userid userid Ju1 8 16:28 dir2.tar drwxrwxr-x 4 userid userid 512 Jun 28 15:19 dir3

67 Uncompressing Practice Now we are back to our original file size and gunzip removed the extension.gz for us. Simple!

68 Permissions

69 Permissions In Unix there are many attributes associated with every file or directory. Permission settings are another attribute associated with each file and directory. These permissions determine who is allowed to see the file, search through the directory, modify the file, delete the directory, etc.

70 Permissions Each file has three different sets of permissions: One for the Owner or User - this is usually the person who created the file or directory One for the Group - a file can be assigned to a group if a team of people need access to the same set of files or directories One for Everyone else or Others

71 Permissions Each set of permissions has three choices: 1) Read permissions: (r) For files: read permissions allow one to read or copy files. For directories: read permissions allow one to use ls to list the contents of a directory. Example: if a group has read permissions for a file, then any member of that group can copy that file.

72 Permissions Each set of permissions has three choices: 2) Write permissions: (w) For files: write permissions allow one to modify or delete files. For directories: write permissions allow one to modify or delete directories. This includes files within that directory. Example: if 'others' do not have write permissions for a file, then they cannot make any changes to that file.

73 Permissions Each set of permissions has three choices: 3) Execute permissions: (x) For files: execute permissions allow one to run the file as a program (if it is a program). For directories: execute permissions allow one to cd to move through a directory. Example: if the group does not have execute permissions for a directory, then members of that group cannot cd to a subdirectory under that directory.

74 Permissions You can find out what permissions are assigned to a file by typing ls -l in the parent directory. Using ls -l is called 'Long Format Listing'

75 Long Format Listing

76 Long Form Listing If you type ls -l at the prompt (in Unix_class), you will see something similar to the following: $ ls -l drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:53 Animal drwxrwxr-x 2 jsmith jsmith 512 Jun 18 21:31 Shakesp.. drwxrwxr-x 2 jsmith jsmith 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 jsmith jsmith 512 Jun 24 15:38 dir1 drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:19 dir2 drwxrwxr-x 3 jsmith jsmith 512 Oct 1 19:18 dir3 drwxrwxr-x 4 jsmith jsmith 512 Oct 1 11:34 house

77 Long Form Listing $ ls -l Each one of these lines gives a variety of information about a file or subdirectory within the directory you listed. drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:53 Animal drwxrwxr-x 2 jsmith jsmith 512 Jun 18 21:31 Shakesp.. drwxrwxr-x 2 jsmith jsmith 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 jsmith jsmith 512 Jun 24 15:38 dir1 drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:19 dir2 drwxrwxr-x 3 jsmith jsmith 512 Oct 1 19:18 dir3 drwxrwxr-x 4 jsmith jsmith 512 Oct 1 11:34 house

78 Long Form Listing Each line is actually made of 16 fields of information that tells you something about that file or directory. $ ls -l drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:53 Animal drwxrwxr-x 2 jsmith jsmith 512 Jun 18 21:31 Shakesp.. drwxrwxr-x 2 jsmith jsmith 512 Jun 18 20:10 Wildcards drwxrwxr-x 2 jsmith jsmith 512 Jun 24 15:38 dir1 drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:19 dir2 drwxrwxr-x 3 jsmith jsmith 512 Oct 1 19:18 dir3 drwxrwxr-x 4 jsmith jsmith 512 Oct 1 11:34 house

79 Long Form Listing The Sixteen Fields drwxrwxr-x 4 jsmith jsmith 512 Sep 24 19:53 Animal

80 - 1 st field in the line: (-) hyphen: it is a file (d) letter d: it is a directory

81 -rw- The next three fields (2, 3, and 4) refer to the owner s permissions (usually the person who created the file).

82 -r 2 nd field in the line: (r) letter r: the owner has read permission (can read or copy the file or list the files in the directory) (-) hyphen: the owner does not have read permission

83 -rw 3 rd field in the line: (w) letter w: the owner has write permission (can modify or delete the file or directory) (-) hyphen: the owner does not have write permission

84 -rw- 4 th field in the line: (x) letter x: the owner has execute permission (can run the file as a program or can cd to search through the directory structure below) (-) hyphen: the owner does not have execute permission NOTE: All instances of the execute permission (x) will mean something different if this is referring to a file or a directory.

85 -rw- For example, $ ls -l -rw-r--r-- 1 rneil rneil 2151 Jun This is a file, and the owner has read permission and write permission, but does not have execute permission.

86 -rw-r-- The next three fields (5, 6, and 7) refer to the group s permissions (the members of a group who need to have access to the same files).

87 -rw-r 5 th field in the line: (r) letter r: the group has read permission (-) hyphen: the group does not have read permission

88 -rw-r- 6 th field in the line (w) letter w: the group has write permission (-) hyphen: the group does not have write permission

89 -rw-r-- 7 th field in the line (x) letter x: the group has execute permission (-) hyphen: the group does not have execute permission

90 -rw-r-- Example: drwxrwxr-x 2 syin syin 512 Dec This is a directory, and the group has read, write and execute permission

91 -rw-r--r-- The next three fields (8, 9, and 10) refer to the permissions given to everyone else.

92 -rw-r--r 8 th field in the line (r) letter r: everyone has read permission (-) hyphen: everyone does not have read permission

93 -rw-r--r- 9 th field in the line (w) letter w: everyone has write permission (-) hyphen: everyone does not have write permission

94 -rw-r--r-- 10 th field in the line (x) letter x: everyone has execute permission (-) hyphen: everyone does not have execute permission

95 -rw-r--r-- Example: -rw-rw-r-- 1 cderi cderi 1475 Jun This is a file and everyone may read it, but they cannot write or execute the file.

96 -rw-r--r th field in the line Link Count for files: how many links or names this file has. for directories: this has information on the file and directory counts recursively.

97 -rw-r--r-- 1 Example: -rw-rw-r-- 1 jsmith jsmith 4567 Jun This file has no other names associated with it.

98 -rw-r--r-- 1 jsmith 12 th field in the line The owner of the file or directory

99 -rw-r--r-- 1 jsmith jsmith 13 th field in the line The group to which the file or directory belongs (the permissions given in fields 5, 6, and 7 only refer to the group mentioned here)

100 -rw-r--r-- 1 jsmith jsmith Example: -rw-rw-r-- 1 sjones acctng 1475 Feb The owner is sjones and the group is acctng. Other members of the acctng group have read and write permission, but do not have execute permission.

101 -rw-r--r-- 1 jsmith jsmith At ILS, the default group that your files belong to is the same as your userid (you belong to your own group). This is called your primary group. At some point in time you will most likely belong to similar groups that need to share information (staff, sales, designers, etc.) These will be secondary groups

102 -rw-r--r-- 1 jsmith jsmith th field in the line The size of the file in bytes

103 -rw-r--r-- 1 jsmith jsmith 752 Jul 3 7:11 15 th field in the line The date and time the file was last modified

104 -rw-r--r-- 1 jsmith jsmith 752 Jul 3 7:11 Example: x 2 lbrin lbrin 1024 Jun 29 13:06 other This file contains 1024 bytes (1k), and was last modified on June 29 th at 13:06 hours (1:06 p.m.)

105 -rw-r--r-- 1 jsmith jsmith 752 Jul 3 7:11 list 16 th field in the line The name of the file

106 -rw-r--r-- 1 jsmith jsmith 752 Jul 3 7:11 list Example:... 1 rvelaz rvelaz 2151 Oct 14 12:26 ideas This file is named ideas

107 Long Form Listing - Practice Go to directory dir2 and type ls How many regular files are in this directory? 3 How many subdirectories? 2

108 Long Form Listing - Practice What group does the file history.txt belong to? your primary group What permissions does that group have? read only

109 Long Form Listing - Practice When was the subdirectory picts last modified? Feb How large is address_list? 455 bytes

110 Long Form Listing Other Options: $ ls -al to list all files in a directory, in long format

111 Numeric Permissions (absolute permissions) see handout

112 Numeric Permissions The text permissions, rwx rwx rwx, can also be written as a three-digit number.

113 Numeric Permissions The important numbers to remember are: 4 = Read 2 = Write 1 = Execute

114 Numeric Permissions All other numbers are simply an addition of permissions: Number Permissions Allowed 0 (---) None 1 (--x) Execute only 2 (-w-) Write only 3 (-wx) Write and Execute (1+2)

115 Numeric Permissions All other numbers are simply an addition of permissions: Number Permissions Allowed 4 (r--) Read only 5 (r-x) Read and Execute (1+4) 6 (rw-) Read and Write (2+4) 7 (rwx) Read, Write, and Execute (1+2+4)

116 Numeric Permissions 740 The permissions are written as a 3-digit number.

117 Numeric Permissions 7 The permissions are written as a 3-digit number. 1st digit - owner s permissions (rwx)

118 Numeric Permissions 74_ The permissions are written as a 3-digit number. 1st digit - owner s permissions (rwx) 2nd digit - group s permissions (r--)

119 Numeric Permissions 740 The permissions are written as a 3-digit number. 1st digit - owner s permissions (rwx) 2nd digit - group s permissions (r--) 3rd digit - everyone s permissions (---)

120 Numeric Permissions - Practice What would the Numeric Permission be for: Owner: Read & Write (rw-) Group: Read (r--) 640 Others: None (---) What do these permissions allow? Owner & Group: read & write / Others: none Owner: read, write & execute / Group & Others: read

121 Numeric Permissions - Practice What would the Numeric Permission be for: Owner: Read, Write, & Execute (rwx) Group: Read & Execute (r-x) Others: Execute (--x) 751 What do these permissions allow? Owner & Group: read, write & execute / Others: none Owner: read & write / Group & Others: none

122 Numeric Permissions - Practice What would the Numeric Permission be for the following files and directories: Shakespeare 775 shrodinger 644 picts 775

123 Changing Permissions Changing rwxr----- or 740 see handout

124 Changing Permissions Now that you can use ls -l to identify what permissions are allowed for a given file, you can also change those permissions. ONLY the OWNER can change permissions for a file or directory.

125 $ chmod change mode - the command to change permissions. You supply: The numeric permission you want to change to The name of the file or directory

126 Changing Permissions Examples: $ chmod 644 finances Don t let anyone but the user change the file, others can only read. $ chmod 750 add_hours.sh (program) Owner has full access, group can read and execute, everyone else has no access.

127 Changing Permissions - Practice Change the permissions for the file grp.txt (in dir1) to allow the group to write and read, but not give others any permissions at all. $ chmod 660 grp.txt

128 Changing Permission You can also use chmod with mnemonic (rwx) permissions.

129 Changing Permissions Suppose you have a file called test, but now you do not want your group to be able to modify or delete this file (you don t want them to have write permission).

130 $ chmod change mode - the command to change permissions. Follow this with: whose permission u - for user (file s owner) g - for group o - for other (everyone else) a - for all three

131 $ chmod g You are going to change the permissions assigned to the group for this file. Follow this with: what to do to the permission + - add, or allow this permission - - subtract or don t let them = - to explicitly state what permissions you are allowing

132 $ chmod g- You are going to remove a permission that was previously given to that group. Follow this with: what permission to change r - read permissions w - write permissions x - execute permissions

133 $ chmod g-w You are no longer allowing the group to modify or delete this file or directory. Follow this with: filename - the name of the file or directory you are changing the permissions of.

134 $ chmod g-w test You are no longer allowing the group to modify or delete the file test. EXCEPTION: If your file s parent directory is group writable, regardless of permissions on the file, your file could still be deleted by members of that group. This will only happen to group directories, not your home directories. This is because you are your own group.

135 Changing Permissions Examples $ chmod g+r finances Allows the group to read the finances file $ chmod go-w finances Doesn t let anyone but the user change the file $ chmod g=rwx finances The group can read, write, and execute

136 Changing Permissions - Practice What do the following examples change? $ chmod o-w finances No longer allows others to modify or delete. $ chmod a=rwx finances States that everyone can read, write & execute $ chmod g=rw finances The group can read & write

137 Changing Permissions - Practice Change the permissions for the Wildcards directory to not allow others any access at all (so only the owner and group members can cd into the directory). $ chmod o-rx Wildcards

138 Changing Access Changing the owner Changing groups

139 Changing the owner The owner of a file is listed in field 12 in the long format listing. drwxr--r-- 5 jsmith staff 927

140 Changing the owner At ILS you will not be permitted to change the ownership of your files. If you wanted someone else to have a file of yours but want them to own that file what could you do?

141 Changing the owner You could make sure the other group has read permissions and then tell them to copy it to their home directory. The copied file will be owned by the person who initiated the cp command.

142 Groups Groups give a team of people the same permissions to use a set of files. The group which a file or directory is assigned to, is listed in field 13 in the long format listing.

143 Groups Using groups are a handy feature if you are working with other students in a class on a group project and you want them to have access to certain files in your directory, but you do not want to allow everyone access.

144 Groups However, you cannot change the group that a file belongs to if the group does not already exist. You cannot create a new group. Only your system administrators can create accounts and groups.

145 Changing the group The command for changing the group is: $ chgrp newgroup filename or $ chgrp newgroup directoryname Remember: ONLY the OWNER can change group ownership of a file or directory. At ILS you are permitted to change the group ownership of your files assuming you have membership.

146 Changing the group Suppose the file called store_plan, belongs to the group architects, but now you want this file to belong to the builders group. $ chgrp builders store_plan

147 Changing the group Suppose the following is the long form listing for a file called notes: -rw-r--r-- 1 jsmith jsmith 475 Jun 29 7:58 notes If you are jsmith, how could you assign this file to the group called S401 and also give the group read and write access to the file? (Note: the group S401 must already exist)

148 Changing the group -rw-r--r-- 1 jsmith jsmith 475 Jun 29 7:58 notes $ chgrp S401 notes $ chmod g+w notes or $ chmod 664 notes

149 Changing the group Now the long form listing for notes would resemble the following: -rw-rw-r-- 1 jsmith S Jun 29 7:58 notes Notice the group is now S401 and the group now has write permissions to the file.

150 Groups To see what groups you belong to, type: $ groups

151 Pipes and Redirects

152 stdin, stdout, stderror Before we can talk about pipes and redirects we need to look briefly into where Unix expects to see input and where it sends the output. Each command (program) requires input and then produces output.

153 stdin stdin Standard Input By default Unix looks to your keyboard for input (the commands that you type in). Alternately, it can look for input via a pipe. We will talk about this more soon.

154 stdout stdout Standard Output By default, Unix sends the output (the results) of your command to your terminal screen. Alternately, you can make this information go elsewhere, i.e. to a file or to another program.

155 stderr Stderr Standard Error By default, Unix also sends error information to the screen. But just like everything else you can have some control over where this information is sent. You might want all of your error messages to go to file. You will learn this more later if you ever get involved in the shell as a scripting language.

156 Pipes Combining Commands

157 Pipes Pipes are used to join commands. This is accomplished by sending the output of one command directly to the input of the next command.

158 Pipes This is one way to redirect the output of your program. Instead of sending the results to your terminal screen, you can send the output directly to another command for processing.

159 Pipes A chain of pipes is called a pipeline.

160 Pipes A pipe symbol looks like this: a vertical bar (shift+backslash) It is one of the metacharacters we mentioned earlier as having a special meaning to the operating system.

161 Pipes A simple but useful example of a pipe: Let s say that you want to list all of the contents in your directory in long format.

162 Pipes However, when you type $ ls -l your contents scroll off of your screen too fast for you to read them.

163 Pipes In this case, try: $ l s l m o r e This will display a page at a time and pause so you are able to view your files.

164 Pipes $ ls l more This is a simple pipe you will probably use often.

165 Pipes You can combine many commands together with pipes.

166 Pipes Practice You want to see who is logged in to the system. $ who

167 Pipes Practice This might output a lot of lines for a large multiuser system, so again we pipe it through more. $ who more

168 Pipes Practice Maybe we don t care about the usernames of who is logged in, but just how many people are logged in. $ who wc l This counts all of the lines outputted by the who command.

169 Pipes Practice This is nice but maybe you d rather see all of the names, but in some kind of order. How about alphabetically? $ who sort more The Unix command sort, in its simplest form, just rearranges the output in alphabetical order.

170 Pipes $ who sort more Here we have created a pipeline with three commands: The output of the who command is sent directly to the input for the sort command for processing without displaying it to the screen first.

171 Pipes $ who sort more Here we have created a pipeline with three commands: Then the output of the sort command is sent directly to the input of the more command, which then prints your sorted who output to your terminal screen one screen at a time.

172 Pipes So why is piping very useful to us? Take the previous example. The who command has no flags/options for sorting alphabetically and displaying your output one screenful at a time. You can combine the power of many simple Unix commands by creating pipelines to do almost anything you want.

173 Pipes Practice How many people are logged into ella right now? $ who wc -l List the contents of dir2 in long format, sorted into files and directories. $ cd dir2 $ ls -l sort

174 Pipes Practice How could you count the number of files and subdirectories you have in a directory? (hint - think in terms of lines instead of files) $ ls wc -l

175 Pipes Practice Search the file address.list (in dir1) for phone numbers that end in an 8. Sort that list alphabetically. $ grep '8$' address.list sort

176 Pipes Practice Search the file address.list (in dir1) for phone numbers that end in an 8. Sort that list alphabetically. $ grep '8$' address.list sort Ashley McNara 608 Redbud Ave Jean Bordeaux 91 Willow Rd Jennifer Rose 143 Willow Rd Mike Noon 113 Pine Blvd Sam Jackson 76 Birch St

177 Pipes Pipes are one thing that make Unix much more flexible and powerful. You can join commands and run them in sequence so you aren t relying on one single command to complete your task.

178 Pipes You can join as many commands as you like in order to get your desired results - with the output of each acting as the input to the next.

179 Redirects Where to send the output?

180 Redirects By default, Unix directs the output of your command to your terminal screen. As you can see, you can make this information go elsewhere; you can redirect it to another program.

181 Redirects In the example below, we were essentially redirecting the stdout (standard output) of the who command by sending the output to the input of the sort command. $ who sort

182 Redirects Another way to redirect the output is to use another metacharacter, >, the greaterthan symbol. Using this device for redirecting you can send the output directly to a filename.

183 Redirects Suppose you wanted see who was logged into iris at a certain time, but wanted to share this information with others later. You could save that information into a text file and then send it via or post it to an html page.

184 Redirects $ who > iris_users.txt This command would save the output of the who command to a file called iris_users.txt.

185 Redirects Another example: $ history > hist_friday.txt This would save your session history into a file for future review.

186 Redirects When you use a redirect, you do not need to already have the file, the program will create it for you (in your current directory).

187 Redirects So, if you are in dir2 and you use the command: $ ls -a > all_files.txt This will create a file called all_files.txt in the dir2 directory.

188 Redirects Practice View who is logged on to iris now and save the information to a file called iris_who.txt in dir1. Make dir1 your current directory. Then type: $ who > iris_who.txt

189 Redirects $ who > iris_who.txt We have successfully redirected standard output to a file. What if you wanted to send the contents of a file to the stdin (Standard Input) of a program?

190 Redirects $ who > iris_who.txt For example, you wanted to view the contents of iris_who.txt, sorted alphabetically.

191 Redirects Here we use the metacharacter, <, the less-than symbol: $ sort < iris_who.txt Try this with your file.

192 Redirects Here we use the metacharacter, <, the less-than symbol: $ sort < iris_who.txt Basically the output goes the way the arrow points. This type of redirecting is commonly referred to as the here document.

193 Redirects $ sort < iris_who.txt We could get the same results by using this command line: $ cat iris_who.txt sort There are many ways to get the same results in Unix.

194 Redirects Practice Send the contents of the file address.list to the program sort using the less-than symbol. address.list is in dir1 Type: $ sort < address.list

195 Redirects and Appends You can also redirect the output of a program to the end of a file that already exists (append it to the file).

196 Redirects and Appends Here we will use the double greater-than signs (>>). Instead of creating a file, it will add to the end of a file you already have.

197 Redirects and Appends Suppose you are logged into iris every evening at midnight and want to know how many other people are logged in at the same time every night (only the number of people). $ who wc l >> nightowls.txt

198 Redirects and Appends $ who wc l >> nightowls.txt This would append to the file with a number on each line indicating how many people are logged into iris. If you execute this line every evening at midnight you could see a trend of how many late night users there are over a course of time.

199 Redirects Practice Make a file in the Shakespeare directory called sweet.txt which contains all the lines that use the word sweet. $ cd../shakespeare $ grep sweet * > sweet.txt

200 Redirects Practice Add the contents of Sonnet8 to the end of sonnet3. $ cat Sonnet8 >> sonnet3

201 Redirects Practice Sort the contents of address.list (in dir1) by the first name at the beginning of each line. $ sort < address.list Or, using pipes instead of redirects: $ cat address.list sort

202 Redirects Practice Make a file called directory_list which contains a list of the contents of Wildcards in long format, sorted alphabetically. In the Wildcards directory: $ ls -l sort > directory_list

203 Common Mistakes in Unix

204 Caps Lock Key When you attempt to log in at a terminal make sure the caps lock key is not turned on or the terminal will not recognize your login.

205 Type Commands Correctly Check the spelling of every command, filename and directory name. Make sure you have spaces between the command name, options and operands. command_name [option] [operand]

206 Type Commands Correctly Make sure all capitalization is correct. Always remember that command line syntax is unforgiving. When using cp and mv make sure you always type the source first and the destination second.

207 Work in the Correct Directory Every so often, type pwd to make sure you are in the right place. We include the path in your prompt but do not rely on it being there for every Unix server. Remember to use cd to return to your home directory if you get lost.

208 Always Keep Backup Copies At ILS we perform an incremental backup of your home directories. However, if you are modifying a file or files often, then it is recommended that you have another copy of your data. This could be backed up via a flash drive or storing nonsensitive data in a cloud.

209 Use the Correct Commands or Options Always check the man pages to verify that the option or command you want to use is supported by the system.

210 Keep Your Files Organized Make directories often Use directory names and file names that make sense so be descriptive. Use tar and gzip to organize and clean up old directories.

211 Remember to Logout Do not forget to logout of your terminal window. Do not forget to logout of your workstation.

212 Your Future with Unix If you find that learning about the Unix operating system would be beneficial to you, there are some intermediate and advanced books available and I also teach a summer Unix workshop (S603-Unix Intermediate) here at ILS.

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window. Unix background COMP9021, Session 2, 2016 1 Introduction Using the Terminal application, open an x-term window. You type your commands in an x-term window. Many commands take one or more arguments. Many

More information

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

Unix Introduction. Part 2

Unix Introduction. Part 2 Unix Introduction Part 2 More Unix Commands wc touch cp - copy review Let's copy a directory tree with recursion. Remember that in order to use the -r option when copying directory hierarchies. Make sure

More information

commandname flags arguments

commandname flags arguments Unix Review, additional Unix commands CS101, Mock Introduction This handout/lecture reviews some basic UNIX commands that you should know how to use. A more detailed description of this and other commands

More information

Files

Files http://www.cs.fsu.edu/~langley/cop3353-2013-1/reveal.js-2013-02-11/02.html?print-pdf 02/11/2013 10:55 AM Files A normal "flat" file is a collection of information. It's usually stored somewhere reasonably

More information

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois Unix/Linux Primer Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois August 25, 2017 This primer is designed to introduce basic UNIX/Linux concepts and commands. No

More information

Files and Directories

Files and Directories CSCI 2132: Software Development Files and Directories Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Files and Directories Much of the operation of Unix and programs running on

More information

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak CSN08101 Digital Forensics Lecture 2: Essential Linux for Forensics Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak Essential Linux for Forensics You will learn in this lecture: Essential

More information

Introduction to Linux Organizing Files

Introduction to Linux Organizing Files Introduction to Linux Organizing Files Computational Science and Engineering North Carolina A&T State University Instructor: Dr. K. M. Flurchick Email: kmflurch@ncat.edu Arranging, Organizing, Packing

More information

UNIX File Hierarchy: Structure and Commands

UNIX File Hierarchy: Structure and Commands UNIX File Hierarchy: Structure and Commands The UNIX operating system organizes files into a tree structure with a root named by the character /. An example of the directory tree is shown below. / bin

More information

Introduction to Linux

Introduction to Linux Introduction to Linux M Tech CS I 2015-16 Arijit Bishnu Debapriyo Majumdar Sourav Sengupta Mandar Mitra Login, Logout, Change password $ ssh, ssh X secure shell $ ssh www.isical.ac.in $ ssh 192.168 $ logout,

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

Basic Survival UNIX.

Basic Survival UNIX. Basic Survival UNIX Many Unix based operating systems make available a Graphical User Interface for the sake of providing an easy way for less experienced users to work with the system. Some examples are

More information

CSCI 2132 Software Development. Lecture 5: File Permissions

CSCI 2132 Software Development. Lecture 5: File Permissions CSCI 2132 Software Development Lecture 5: File Permissions Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 14-Sep-2018 (5) CSCI 2132 1 Files and Directories Pathnames Previous

More information

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System Class Meeting 2 * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System The file system is your interface to: physical

More information

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt

More information

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Filesystem. January 26 th, 2004 Class Meeting 2 Unix Filesystem January 26 th, 2004 Class Meeting 2 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty at Virginia Tech Unix Filesystem! The filesystem is your interface

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

Introduction. File System. Note. Achtung!

Introduction. File System. Note. Achtung! 3 Unix Shell 1: Introduction Lab Objective: Explore the basics of the Unix Shell. Understand how to navigate and manipulate file directories. Introduce the Vim text editor for easy writing and editing

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program Using UNIX. UNIX is mainly a command line interface. This means that you write the commands you want executed. In the beginning that will seem inferior to windows point-and-click, but in the long run the

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Introduction to UNIX Stephen Pauwels University of Antwerp October 2, 2015 Outline What is Unix? Getting started Streams Exercises UNIX Operating system Servers, desktops,

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

Introduction to the Linux Command Line

Introduction to the Linux Command Line Introduction to the Linux Command Line May, 2015 How to Connect (securely) ssh sftp scp Basic Unix or Linux Commands Files & directories Environment variables Not necessarily in this order.? Getting Connected

More information

Basic Linux Commands. Srihari Kalgi M.Tech, CSE (KReSIT), IIT Bombay. May 5, 2009

Basic Linux Commands. Srihari Kalgi M.Tech, CSE (KReSIT), IIT Bombay. May 5, 2009 Basic Linux Commands Srihari Kalgi M.Tech, CSE (KReSIT), IIT Bombay May 5, 2009 General Purpose utilities Linux File System File Handling Commands Compressing and Archiving Files Simple Filters General

More information

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12) Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12) Objective: Learn some basic aspects of the UNIX operating system and how to use it. What is UNIX? UNIX is the operating system used by most computers

More information

7. Archiving and compressing 7.1 Introduction

7. Archiving and compressing 7.1 Introduction 7. Archiving and compressing 7.1 Introduction In this chapter, we discuss how to manage archive files at the command line. File archiving is used when one or more files need to be transmitted or stored

More information

Operating Systems, Unix Files and Commands SEEM

Operating Systems, Unix Files and Commands SEEM Operating Systems, Unix Files and Commands SEEM 3460 1 Major Components of Operating Systems (OS) Process management Resource management CPU Memory Device File system Bootstrapping SEEM 3460 2 Programs

More information

CSCI 2132 Software Development. Lecture 4: Files and Directories

CSCI 2132 Software Development. Lecture 4: Files and Directories CSCI 2132 Software Development Lecture 4: Files and Directories Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 12-Sep-2018 (4) CSCI 2132 1 Previous Lecture Some hardware concepts

More information

Scripting Languages Course 1. Diana Trandabăț

Scripting Languages Course 1. Diana Trandabăț Scripting Languages Course 1 Diana Trandabăț Master in Computational Linguistics - 1 st year 2017-2018 Today s lecture Introduction to scripting languages What is a script? What is a scripting language

More information

Introduction to UNIX command-line

Introduction to UNIX command-line Introduction to UNIX command-line Boyce Thompson Institute March 17, 2015 Lukas Mueller & Noe Fernandez Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions

More information

Week 2 Lecture 3. Unix

Week 2 Lecture 3. Unix Lecture 3 Unix Terminal and Shell 2 Terminal Prompt Command Argument Result 3 Shell Intro A system program that allows a user to execute: shell functions (e.g., ls -la) other programs (e.g., eclipse) shell

More information

IMPORTANT: Logging Off LOGGING IN

IMPORTANT: Logging Off LOGGING IN These are a few basic Unix commands compiled from Unix web sites, and printed materials. The main purpose is to help a beginner to go around with fewer difficulties. Therefore, I will be adding to this

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

Introduction to Unix CHAPTER 6. File Systems. Permissions

Introduction to Unix CHAPTER 6. File Systems. Permissions CHAPTER 6 Introduction to Unix The Unix operating system is an incredibly powerful and complex system that is ideal for running a distributed system such as ours, particularly since we use computers primarily

More information

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface FREEENGINEER.ORG Learn UNIX in 10 minutes. Version 1.3 Preface This is something that I had given out to students (CAD user training) in years past. The purpose was to have on one page the basics commands

More information

Working with Basic Linux. Daniel Balagué

Working with Basic Linux. Daniel Balagué Working with Basic Linux Daniel Balagué How Linux Works? Everything in Linux is either a file or a process. A process is an executing program identified with a PID number. It runs in short or long duration

More information

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen Introduction to Unix The Windows User perspective Wes Frisby Kyle Horne Todd Johansen What is Unix? Portable, multi-tasking, and multi-user operating system Software development environment Hardware independent

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Stephen Pauwels Computer Systems Academic Year 2018-2019 Overview of the Semester UNIX Introductie Regular Expressions Scripting Data Representation Integers, Fixed point,

More information

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010 Lecture 2 Fall 2010 Hussam Abu-Libdeh based on slides by David Slater September 10, 2010 Last Time We had a brief discussion On The Origin of Species *nix systems Today We roll our sleeves and get our

More information

CS246 Spring14 Programming Paradigm Notes on Linux

CS246 Spring14 Programming Paradigm Notes on Linux 1 Unix History 1965: Researchers from Bell Labs and other organizations begin work on Multics, a state-of-the-art interactive, multi-user operating system. 1969: Bell Labs researchers, losing hope for

More information

Some Linux (Unix) Commands that might help you in ENSC351

Some Linux (Unix) Commands that might help you in ENSC351 Some Linux (Unix) Commands that might help you in ENSC351 First, like Windows, Linux and Unix (for our purposes, they are the basically the same) use a hierarchical directory structure. What would be called

More information

CSC UNIX System, Spring 2015

CSC UNIX System, Spring 2015 CSC 352 - UNIX System, Spring 2015 Study guide for the CSC352 midterm exam (20% of grade). Dr. Dale E. Parson, http://faculty.kutztown.edu/parson We will have a midterm on March 19 on material we have

More information

find starting-directory -name filename -user username

find starting-directory -name filename -user username Lab 7: Input and Output The goal of this lab is to gain proficiency in using I/O redirection to perform tasks on the system. You will combine commands you have learned in this course using shell redirection,

More information

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs; Note: you can find this file under: http://www.cs.queensu.ca/ acmteam/unix.pdf Introduction to Unix Tutorial In this tutorial, you will learn: How to manage your account (user ID, password, shell); Navigating

More information

genome[phd14]:/home/people/phd14/alignment >

genome[phd14]:/home/people/phd14/alignment > Unix Introduction to Unix Shell There is a special type of window called shell or terminalwindow. Terminal windows are the principal vehicle of interaction with a UNIX machine. Their function is to perform

More information

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version... Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing

More information

Introduction to UNIX command-line II

Introduction to UNIX command-line II Introduction to UNIX command-line II Boyce Thompson Institute 2017 Prashant Hosmani Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions Compression

More information

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p.

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p. Lecture 6 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 6: Links and s 18-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor: Vlado Keselj Previous

More information

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book).

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book). Crash Course in Unix For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix -or- Unix in a Nutshell (an O Reilly book). 1 Unix Accounts To access a Unix system you need to have

More information

Unix basics exercise MBV-INFX410

Unix basics exercise MBV-INFX410 Unix basics exercise MBV-INFX410 In order to start this exercise, you need to be logged in on a UNIX computer with a terminal window open on your computer. It is best if you are logged in on freebee.abel.uio.no.

More information

CS 460 Linux Tutorial

CS 460 Linux Tutorial CS 460 Linux Tutorial http://ryanstutorials.net/linuxtutorial/cheatsheet.php # Change directory to your home directory. # Remember, ~ means your home directory cd ~ # Check to see your current working

More information

UTA Tech Orientation Spring 2019

UTA Tech Orientation Spring 2019 UTA Tech Orientation Spring 2019 Overview Why is Tech Stuff Important? The Filesystem Shell Commands File Permissions Miscellaneous Why is Tech Stuff Important? Why is TA Tech Stuff Important? Different

More information

Exercise Sheet 2. (Classifications of Operating Systems)

Exercise Sheet 2. (Classifications of Operating Systems) Exercise Sheet 2 Exercise 1 (Classifications of Operating Systems) 1. At any given moment, only a single program can be executed. What is the technical term for this operation mode? 2. What are half multi-user

More information

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1 Student Name: Lab Section: Linux File System Permissions (modes) - Part 1 Due Date - Upload to Blackboard by 8:30am Monday March 12, 2012 Submit the completed lab to Blackboard following the Rules for

More information

Introduction to UNIX Command Line

Introduction to UNIX Command Line Introduction to UNIX Command Line Files and directories Some useful commands (echo, cat, grep, find, diff, tar) Redirection Pipes Variables Background processes Remote connections (e.g. ssh, curl) Scripts

More information

The Linux Command Line & Shell Scripting

The Linux Command Line & Shell Scripting The Linux Command Line & Shell Scripting [web] [email] portal.biohpc.swmed.edu biohpc-help@utsouthwestern.edu 1 Updated for 2017-11-18 Study Resources : A Free Book 500+ pages * Some of the materials covered

More information

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing Quick Start Guide by Burak Himmetoglu Supercomputing Consultant Enterprise Technology Services & Center for Scientific Computing E-mail: bhimmetoglu@ucsb.edu Linux/Unix basic commands Basic command structure:

More information

Permission and Ownership

Permission and Ownership Permission and Ownership 1. Understanding file and directory ownership Every file on your Linux system, including directories, is owned by a specific user and group. Therefore, file permissions are defined

More information

LAB 8 (Aug 4/5) Unix Utilities

LAB 8 (Aug 4/5) Unix Utilities Aug 4/5 Due: Aug 11 in class Name: CSE number: LAB 8 (Aug 4/5) Unix Utilities The purpose of this lab exercise is for you to get some hands-on experience on using some fundamental Unix utilities (commands).

More information

Unix Introduction. Getting started with the Unix Operating System

Unix Introduction. Getting started with the Unix Operating System Unix Introduction Getting started with the Unix Operating System What is an Operating System? A computer Operating System, or OS What is a computer operating system? Where? What does an OS provide? Insulation

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

CHAPTER 1 UNIX FOR NONPROGRAMMERS

CHAPTER 1 UNIX FOR NONPROGRAMMERS CHAPTER 1 UNIX FOR NONPROGRAMMERS The man command is used to display the manual entry associated with word entered as argument. The -k option is used displays a list of manual entries that contain entered

More information

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview

More information

Utilities. September 8, 2015

Utilities. September 8, 2015 Utilities September 8, 2015 Useful ideas Listing files and display text and binary files Copy, move, and remove files Search, sort, print, compare files Using pipes Compression and archiving Your fellow

More information

Lecture # 2 Introduction to UNIX (Part 2)

Lecture # 2 Introduction to UNIX (Part 2) CS390 UNIX Programming Spring 2009 Page 1 Lecture # 2 Introduction to UNIX (Part 2) UNIX is case sensitive (lowercase, lowercase, lowercase) Logging in (Terminal Method) Two basic techniques: 1. Network

More information

Introduction to Linux

Introduction to Linux Introduction to Linux January 2011 Don Bahls User Consultant (Group Leader) bahls@arsc.edu (907) 450-8674 Overview The shell Common Commands File System Organization Permissions Environment Variables I/O

More information

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group. CMPS 12L Introduction to Programming Lab Assignment 2 We have three goals in this assignment: to learn about file permissions in Unix, to get a basic introduction to the Andrew File System and it s directory

More information

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage ULI101 Week 02 Week Overview Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages Text editing Common file utilities: cat,more,less,touch,file,find

More information

Practical Unix exercise MBV INFX410

Practical Unix exercise MBV INFX410 Practical Unix exercise MBV INFX410 We will in this exercise work with a practical task that, it turns out, can easily be solved by using basic Unix. Let us pretend that an engineer in your group has spent

More information

Introduction to Linux

Introduction to Linux Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 47 Operating Systems Program running all the time Interfaces between other programs and hardware Provides abstractions

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Linux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006)

Linux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) 310/1779-4 Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) Linux Refresher (1) Razaq Babalola IJADUOLA These lecture notes are intended only for distribution

More information

Chapter 1 - Introduction. September 8, 2016

Chapter 1 - Introduction. September 8, 2016 Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help

More information

Fall Lecture 5. Operating Systems: Configuration & Use CIS345. The Linux Utilities. Mostafa Z. Ali.

Fall Lecture 5. Operating Systems: Configuration & Use CIS345. The Linux Utilities. Mostafa Z. Ali. Fall 2009 Lecture 5 Operating Systems: Configuration & Use CIS345 The Linux Utilities Mostafa Z. Ali mzali@just.edu.jo 1 1 The Linux Utilities Linux did not have a GUI. It ran on character based terminals

More information

System Administration

System Administration Süsteemihaldus MTAT.08.021 System Administration UNIX shell basics Name service DNS 1/69 Command Line Read detailed manual for specific command using UNIX online documentation or so called manual (man)

More information

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one] Data and Computer Security (CMPD414) Lab II Topics: secure login, moving into HOME-directory, navigation on Unix, basic commands for vi, Message Digest This lab exercise is to be submitted at the end of

More information

Filesystem and common commands

Filesystem and common commands Filesystem and common commands Unix computing basics Campus-Booster ID : **XXXXX www.supinfo.com Copyright SUPINFO. All rights reserved Filesystem and common commands Your trainer Presenter s Name Title:

More information

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

INSE Lab 1 Introduction to UNIX Fall 2017

INSE Lab 1 Introduction to UNIX Fall 2017 INSE 6130 - Lab 1 Introduction to UNIX Fall 2017 Updated by: Paria Shirani Overview In this lab session, students will learn the basics of UNIX /Linux commands. They will be able to perform the basic operations:

More information

Unix Tools / Command Line

Unix Tools / Command Line Unix Tools / Command Line An Intro 1 Basic Commands / Utilities I expect you already know most of these: ls list directories common options: -l, -F, -a mkdir, rmdir make or remove a directory mv move/rename

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

Essentials for Scientific Computing: Bash Shell Scripting Day 3

Essentials for Scientific Computing: Bash Shell Scripting Day 3 Essentials for Scientific Computing: Bash Shell Scripting Day 3 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Introduction In the previous sessions, you have been using basic commands in the shell. The bash

More information

Introduction to Linux

Introduction to Linux Introduction to Linux The command-line interface A command-line interface (CLI) is a type of interface, that is, a way to interact with a computer. Window systems, punched cards or a bunch of dials, buttons

More information

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 3: UNIX Operating System Organization Tian Guo CICS, Umass Amherst 1 Reminders Assignment 2 is due THURSDAY 09/24 at 3:45 pm Directions are on the website

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

Cloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK

Cloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK Cloud Computing and Unix: An Introduction Dr. Sophie Shaw University of Aberdeen, UK s.shaw@abdn.ac.uk Aberdeen London Exeter What We re Going To Do Why Unix? Cloud Computing Connecting to AWS Introduction

More information

Cloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK

Cloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK Cloud Computing and Unix: An Introduction Dr. Sophie Shaw University of Aberdeen, UK s.shaw@abdn.ac.uk Aberdeen London Exeter What We re Going To Do Why Unix? Cloud Computing Connecting to AWS Introduction

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

UNIX Basics. UNIX Basics CIS 218 Oakton Community College

UNIX Basics. UNIX Basics CIS 218 Oakton Community College UNIX Basics UNIX Basics CIS 218 Oakton Community College History UNIX was invented in 1969 at AT&T Bell Labs Ken Thompson and Dennis Ritchie are credited as the original architects and developers of C.

More information

Oxford University Computing Services. Getting Started with Unix

Oxford University Computing Services. Getting Started with Unix Oxford University Computing Services Getting Started with Unix Unix c3.1/2 Typographical Conventions Listed below are the typographical conventions used in this guide. Names of keys on the keyboard are

More information

Exploring UNIX: Session 3

Exploring UNIX: Session 3 Exploring UNIX: Session 3 UNIX file system permissions UNIX is a multi user operating system. This means several users can be logged in simultaneously. For obvious reasons UNIX makes sure users cannot

More information

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. NOTE: Text

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings Linux Commands 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material

More information

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala Linux Training for New Users of Cluster Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala pakala@uga.edu 1 Overview GACRC Linux Operating System Shell, Filesystem, and Common

More information

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2 Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades 2017-2018 Q2 Facultat d Informàtica de Barcelona This first lab session is focused on getting experience in working

More information

Outline. Structure of a UNIX command

Outline. Structure of a UNIX command Outline Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission (owner, group, rwx) File and directory

More information

Command-line interpreters

Command-line interpreters Command-line interpreters shell Wiki: A command-line interface (CLI) is a means of interaction with a computer program where the user (or client) issues commands to the program in the form of successive

More information