Unix on the Command Line: A Bag of Tricks. Draft Version: Written by Prof. Leon King. (not to be copied or distributed except by the author)

Size: px
Start display at page:

Download "Unix on the Command Line: A Bag of Tricks. Draft Version: Written by Prof. Leon King. (not to be copied or distributed except by the author)"

Transcription

1 Unix on the Command Line: A Bag of Tricks Draft Version: Written by Prof. Leon King (not to be copied or distributed except by the author)

2 Conventions This is a draft text any corrections or suggestion please forward to me at: leon.king@humber.ca When I use bolded text, this indicates something that should be literally typed in. When italics are used, substitute an appropriate value, ie: ssh yourid@munro.humber.ca #This is a comment Instead of yourid, type in your own userid Everything appearing in the same line after a hash symbol (#) is a comment, which will have no effect. You don t have to type in comments when trying something out but they are useful for documenting your assignments use them to indicate what you are trying to accomplish, especially if the result is not what your expect. If text appears in brown it s produced by the system no need to type it in. If you see 3 dots (ellipses) you don t type it in. It means more of the same touch file1 file2 file3... #create multiple files as many as you d like to

3 Logging On to Unix Your first priority is to make sure you can login. To login to the munro Unix server at Humber College we use the free ssh (secure shell) communications program PuTTY which is selected from the Windows start menu. PuTTy for Windows or Mac 1 can be downloaded from You may also wish to try the program Bitvise which is free for personal but not institutional use. Type in your userid followed and then click Open. You will then be prompted for your password. When you type in a password Unix will not echo anything back at you. This is to conceal the length of your password which could be used as a clue to break into your account. 1 If your personal computer is a Mac, underneath the Graphic User Interface (GUI) you are already running a version of Unix based on the BSD Mach Kernel. With few exceptions, every command we learn will work more or same on the Mac you can simply open a Terminal window. The organization of directories on a Mac is significantly but not radically different. To connect to the Unix server, type in the command: ssh yourid@humber.ca

4 If you were able to successfully login you will be presented with the command prompt: bash-3.2% your command will be entered here Do You Want to be a WIMP or a Technician? Common end user graphic user interfaces (GUIs) use what is known as a WIMP interface: Windows, Icons, Menus and Pointers though both have a command line similar to Unix. Unix also has a GUI known as XWindows, with two main variants, Gnome and KDE, however these will not be part of this course. The advantage of a GUI is that everything you think you need to do as an end user is right there in front of you. Usability guru Donald Norman calls this knowledge in the world. There is very little that you have to remember, you click on a menu or right click on an object and a well designed GUI tells in a word or two or by popping up a dialog what you can do. In a command line you have to remember all the commands and options. Norman calls this knowledge in your head. One advantage of the command line is that you can often accomplish more in less time. Commands can also be grouped together in a script file. A script file then becomes just another command. The ability to glue commands together like this is another major advantage of the command line. If you are an end user a GUI is probably sufficient. It you are doing technical support and administration it isn t. The original developers of Unix apparently weren`t very good at typing didn t like typing, so Unix commands are often very short cp instead of copy, rm instead of remove. By the end of this course you will have learned approximately 80 different commands and professionally you won t be just a WIMP. Introducing the Command line Commands usually have the following syntax: bash-3.2% cmd -a arg1 -bc -d arg2 arg3 arg4 arg5 -e --longflag arg6 arg7... The command itself is a single word, no spaces, case sensitive and usually in lower case letters. Flags, options and arguments are all optional. The letters preceded by a dash are known as short flags. Some of these take an argument, others do not which ones do and what they mean has to be learned. The order of flags is irrelevant and a flag can appear anywhere in the command line. This is useful in case you forget a flag as you can always type it in at the end of the line. Short flags can be grouped together as long as only the last flag takes an argument. In the above example, -bc -d -e could have been expressed as -c -b -ed or dbec. Long flags are usually preceded by a double dash. Optionally they can take arguments as well.

5 Some of Unix s older commands don t follow these rules. We ll note the exceptions as we go along. Your First Commands Try out the following commands and write a summary next to each one what they show: # This is a comment (nothing should happen) date uptime uname -a echo Is anybody there who who -b #note the effect of the short flag -b which takes no argument id id king who am I tty last last $USER last ps ps -aux All of the above were simple commands that told you something about the system and about you as a user and other users on the system. Now consider how these commands would be useful to you as a Systems Administrator.

6 Working With Files and Directories Creating files is pretty easy: bash-3.2% touch myfile otherfile afile Now lets look at them in the file system using the followling 3 commands: ls, ls -li, stat bash-3.2% ls #ls stands for list subdirectory and shows (almost) all files in the current directory. afile myfile otherfile Notice that the file names are automatically placed in alphabetic order. bash-3.2% ls -li #The -l flag means long - you get more information about the file #The i flag asks the system to display the file s inode # - a unique id for each file #on the same hard drive total rw-r--r-- 1 king staff 0 Jan 10 14:13 afile rw-r--r-- 1 king staff 0 Jan 10 14:13 myfile rw-r--r-- 1 king staff 0 Jan 10 14:13 otherfile The output is read as follows: The first number is the inode #. They re generated in sequence but they don t have to be. The total size in bytes of all files is 0 bytes. The initial dash at the start of the line indicates the file type. The next 9 characters indicate the file permissions. All three files are readable and writeable by the owner and readable by other members of the owner s group. More on file permissions in the next section. after the permissions is the hard link count. More on that coming up. king is the owner of the file in each case the files can be shared with the group staff who are only allowed to read the file The file sizes are all zero The files were last modified on Jan 10 th at 2:13 pm the final item on each line is the name of the file

7 bash-3.2% stat myfile File: `myfile' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 821h/2081d Inode: Links: 1 Access: (0644/-rw-r--r--) Uid: ( 551/ king) Gid: ( 504/ staff) Access: :13: Modify: :13: Change: :40: The stat (file status) command reveals everything about a file other its content. It goes beyond ls -li in that it tells us that the file occupies 0 blocks of storage, and that each block would take a minimum of 4K. The file permissions are shown both as symbols and as an octal number, and both the user name and the group name have equivalent and unique numbers. But what is especially interesting is that each file has 3 times assocated with it, which can be used to track usage. The Access time shows when the file was last used. The Modify time indicates when the content of the file was last changed. The Change time reflects when any of the above properties of the file were last changed. This name Change time was probably a bad idea as its easy to confuse it with the Modify time,, but the decision was made 45 years ago and we re stuck with it. The vim Editor Background vi (short for visual) was an early screen editor for Unix developed by Bill Joy in Back in the old days there were no screen based terminals. People intereracted with computers either using punch cards or typewriter style devices known as teletypes. The standard editor for Unix was called ed 2i. vi was built on top of ed and added many commands so that one could edit using a full screen, however the terminals back then had very little memory could only display ascii characters. In 1988 a developer created a clone of vi which he called vim (vi imitation or vi improved) and by 1992 he ported it to Unix 3ii. There is also a GUI based version of vim that runs on both Unix and Windows called gvim. vim is an editor specifically developed for software developers and technicians. The initial learning curve is rather steep but at the end of the road you will be able to do far more than with a regular text based editor including directly viewing and editing binary files. Another popular editor of this kind is called emacs, which won t be covered. 2 The Kochan text covers ed, not vim 3 A complete history of vim can be found on Bram s website: If you like vim and find it useful, send him a couple of dollars. Moolenar doesn t make money from the sale of vim, but he does take donations which he forwards to help orphans in Uganda

8 Using vim vim has four modes of operation. When you start vim you are in command mode. You press the a key or a set of keys which allow you to move around, insert, delete, undo your changes, save your changes and quit the editor. Typing in the letter i moves you to insertion mode. (The word INSERT -- appears at the bottom left the screen.) Insertion mode allows you to type information into your file. The up, down, right and left arrows work in insertion mode, but you can only move over to letters in your file. You can't move past the end of a line. To go back to command mode you press the <ESC> key. (There is no harm in hitting it twice if you are already in command mode the <ESC> key does nothing.) i Command Mode: h, l, j, k dd, dw, d$, db, x Insertion Mode: What you type appears i is the command in command mode that puts you into insert mode. <ESC> takes you back to command mode. The 3 rd mode of operation is called command line mode. Remember that vim is built on top of ed? By entering a colon in command mode you can enter the older commands. An especially useful one is :wq saves the file and exits back to Unix The 4h mode is called visual mode. It allows you to treat text as a 2 dimensional block. More on that later. If you are not sure which mode you are in, the <esc> key will get you into command mode, and from there you can get to any of the other 3 modes. Hitting <esc> more than once is not a problem you ll still be in command mode anyway.

9 The command vimtutor takes you into vim and runs you through a tutorial. Enter the command and try it out. Then try editing a file. Use ls and stat to look at the files when you are done. bash-3.2% vimtutor #This takes you into the tutorial Directories Directories are the same idea as folders. To find out what directory you are in, type in the command: bash-3.2% pwd /home/staff/king All user accounts are by default stored under the /home directory. /home has 2 main subdirectories, staff and students. Your files would be stored in the directory /home/students/yourid To create a directory the command is mkdir mkdir alpha beta gamma yourdir To delete a directory the command is rmdir rmdir beta #This only works if the directory is empty Using ls -li you get listings that look like this: drwxr-xr-x 2 king staff 4096 Jan 10 19:26 alpha What`s different is as follows: The letter d before the permissions means the file type is a directory, not a regular file The size of the file is 4K or 1 block. The hard link count is 2, not 1 To create a subdirectory at the same time as a directory, mkdir has the p flag which creates any parent directories if they don t already exist. bash-3.2% mkdir -p delta/force/one gamma/radiation/hulk Finally to see the directories you ve created, execute the following:

10 bash-3.2% tree. -- afile -- alpha -- delta `-- force `-- one -- gamma `-- radiation `-- hulk -- myfile `-- otherfile Navigating the File System This section is not yet written. It covers the cd command and describes important directories. See Kochan Chapter 2 and your own in-class notes. File Permissions Basic Unix security is based on the idea of 3 categories of people: users, groups and everyone else (others), and 3 types of permissions : read, write and execute. Probably 20% of the technical problems you will have relating to files will have something to do with improperly set permissions so its an important topic to master. Lets say you wander by someone s terminal and want to find out who left themselves logged in. Simply type in the command: bash-3.2% id uid=551(king) gid=504(staff) groups=504(staff),2331(sharks),2332(minnows),2333(dolphins) In the above case my userid is king, my primary group is staff and I belong to 3 other groups: sharks, minnows and dolphins. There are also unique numbers associated with each user and a unique number associated with each group, but these aren t significant at this point in time.

11 You can also find out which groups someone else belongs to by typing in: id userid Every file belongs to a user and group: bash-3.2% ls -l file1 file2 file3 -rw-r--r-- 1 king staff 0 Jan 11 20:37 file1 -rw-rw king staff 3195 Jan 11 20:38 file2 -rwxr--r-x 1 king staff 154 Jan 11 20:38 file3 Recall that the leading dash refers to the file type all 3 files are regular files. The next 9 characters are read in groups of 3. The first set of three are permissions related to the user, the person who owns the file. As king, the owner, has read and write permissions for all 3. file3 has the execute permission set, meaning its (probably) a program of some kind and, as the owner of the file, king is allowed to run the program. The files also belong to the group staff which refers to other employees of the college. All members of staff are allowed to read each of the files, however no member of staff can write or execute any file, including file3 as these permissions are turned off. The last 3 permissions refer to anyone who is not the file s owner or the file s group. So members of another group sharks or accounting can read and edit file3, however they can t do anything with file2, not even read it. If they try they will get and error message. The idea of groups is that files are associated with either a project or a department. People will have personal files that they want no-one else to see or use. They ll also be working in groups on various projects where files are shared. In some cases they ll want to share the files with everyone, but perhaps only give read or execute privilge you may not want other people to modify your file, but you d like them to see the content. Or, in a data entry situation, you may want others to add data to the file, but not see what others have written so you take away their read privilege. (In such cases they won t be able to review what they added either.) There is a special individual (or group of individuals) who are members of group #0 the root user, who is the systems administrator who is not affected by any of these privileges. Root privilege is very dangerous, even for the sysadmin. If this is your job you are advised to use a regular account and only briefly switch over to your root account on an as needed basis. What if you have a project that needs file access to more than one group? The short answer is to ask the sysadmin to create an new group and add everyone who needs it to that group. 4 4 A better answer is to use a more advanced form of Unix security called ACL (access control lists), which is also available on routers and other types of systems.

12 Changing the group of a file The chgrp command is used to alter the group ownership of a file bash-3.2% chgrp sharks file1 file3... #any number of files can follow bash-3.2% ls -l file1 file2 file3 -rw-r--r-- 1 king sharks 0 Jan 11 20:37 file1 -rw-rw king staff 3195 Jan 11 20:38 file2 -rwxr--r-x 1 king sharks 154 Jan 11 20:38 file3 Note the change in group ownship. The only other difference would show up if you used stat to look at the change time - group ownership is a property of a file and change time reflects the change of any property. By default all files that you create belong to your login group. You can only change the group ownership of a file to a group you you belong to. You can t give your file away to another user only root can do this using the chown (change owner) command. However if they can read the file they could make a copy of it and the new file would belong to them. They could then change the permissions on the copy, not the original which they could then write to or execute. The newgrp command allows you to change your current group to any of the groups you are a member of. Any files you now create will belong to the new group and the id command will now show that group as your primary group. bash-3.2% newgrp minnows bash-3.2% touch file4 bash-3.2% ls -l file4 -rw-r--r-- 1 king minnows 0 Jan 11 21:32 file4 It s also possible to set up passwords for groups, in which case you would be prompted for a secondary password, which is a good security practices, however we haven t set this up in the college. Sometimes people will have more than one account, or you want to loan your terminal to someone for a couple of minutes. The su (substitute user) command allows you to do this: bash-3.2% su bakerk Password: To return to your account type in the command: exit which logs the other user off.

13 chmod: Changing Permissions symbolically chmod uses the following symbols: ls l file1 is run: ugoa+-=rwx and, (comma) After each command assume that To set permissions for members of your group : chmod g=rw file1... -rw-rw king sharks 0 Jan 11 20:37 file1 To set permissions for the user: chmod u=rx file1 file2 file3... -rwxrw king sharks 0 Jan 11 20:37 file1 To set permissions for the user and others: chmod ou=x file xrw---x 1 king sharks 0 Jan 11 20:37 file1 To set permissions for all: chmod a=r file1... -r- - r-- r king sharks 0 Jan 11 20:37 file1 You can mix and match ugoa in any order. After the equal sign you can mix rwx in any order. To set different permissions for each: chmod u=r,g=x,o=w file1... -r x - w - 1 king sharks 0 Jan 11 20:37 file1 To turn off all permissions: chmod ug= file king sharks 0 Jan 11 20:37 file1 Note that the command will reset all the permissions for the specified category of user, but leave the other categories intact. You can also turn selected privileges on or off, which doesn t affect other privileges. Turn on read and execute for file1: chmod ug+rx file1 -r- x r-x king sharks 0 Jan 11 20:37 file1 Turn off read for user and group: chmod ug-r file x - -- r king sharks 0 Jan 11 20:37 file1 Turn on read for everyone, execute for others and turn off write for the users: chmod a+r,o+x,u-w file x x 1 king sharks 0 Jan 11 20:37 file1

14 chmod: Changing Permissions Using Octal Notation Internally permissions are represented by 9 bits 5. To explain it, lets create a lookup table: We can reset a file s permission using 3 octal digits: Binary Octal Privilege none x w w x r r - x r w r w x bash-3.2% chmod 711 file1 -rwx--x--x 1 king sharks 0 Jan 11 20:37 file1 The first digit represents the user. Looking up octal 7 we see that all 3 permissions are turned on. The user can read, write and execute the file. bash-3.2% chmod 213 file1 --w- --x-wx 1 king sharks 0 Jan 11 20:37 file1 Again we look up the codes 2, 1 and 3 (or translate it to binary) to see which bits are on or off. A bit of practice an it becomes 2 nd nature, or if you understand the principle, you can easily recreate the table and look it up. You might also remember that the stat command shows both the octal and the symbolic version of permissions. Finally, sometimes you don t care what permissions are set for a file you just want to copy the permissions of an existing file. This is your first example of a long flag it s preceded by 2 dashes, not once. In this case, whatever privilege file1 has, it s assigned to file2 and all the files that follow. chmod --reference=file1 file To be honest, it s 12 bits, but the extra 3 bits is an advanced topic that won t be covered at this time.

15 Permissions and Directories Some explanation is necessary to explain how permissions work with directories. A directory is a just like a file. When you create a directory, you the user will have read, write and execute priviliges, and everyone else s privileges will be turned off. Try turning off read privilege for yourself on the home directory: bash-3.2% chmod u-r. bash-3.2% ls -l ls:.: Permission denied The conclusion is that you need read permission to see the files names in your directory. However you can still look at, create or edit any file, even use ls on it...as long as you remember what it is called. bash-3.2% touch abc.dat bash-3.2% ls -l abc.dat bash-3.2% stat abc.dat bash-3.2% vim abc.dat Note of these will give you any problem. Now turn off write privilege for yourself on your home directory. You can work with files, but you won t be able to create or delete a file as this changes the contents of the directory. But what about the execute privilege? Directories can t be programs so execute means navigable. Turn off execute privilege for your home directory: bash-3.2% chmod u=rw. Even though read and write are turned on you can t do anything that involves using the directory in each case you will get the message: Permission denied. You can t create, edit, delete or rename a file, change to a subdirectory or refer to it. You can t use cd to navigate to the directory or a subdirectory of your home directory because all of these implicitly require the system to use the directory to find the file. Now turn the navigate privilege back on: bash-3.2% chmod u=rx $HOME #we use $HOME in case you navigated away from the directory. #If you log off with navigate turned of on your home directory, you # you will get the message: Access denied. You need to ask ITS to #turn the privilege back on for you.

16 Copying, Renaming and Deleting Files The cp command is used to copy files: cp myletter.txt newcopyofmyletter.txt -pvi #Note that the flags can go anywhere The -p flag tells Unix to copy the permissions of the file as well. Otherwise the new file will have the default permissions of your session. The -i flag tells Unix to prompt and give a warning if the destination file already exists. Normally the command will fail with an error message if this is the case. The -f flag means force the copy copy over a file if it already exists. The -v flag means verbose. When the copy takes place it gives the full directory path of the source and target files. You can also copy multiple files at once into a directory: cp -v file1 file2 file3... gamma To rename a file: mv file1 anothername #rename is a similar command Like the cp command, mv has the flags -i -v and f which have the same effect. To delete a file: rm file1 file2 file3... #rm means remove Again the same flags -i -v and f apply, but -f means not to display an error message if the file doesn t exists. the command rm -r mydirectory will remove not only the directory, but its contents and ll subdirectorys - it s rather powerful and dangerous and there is no undo command available that can recover any lost files. Use it with extreme caution!!!! Use rm -ri instead as it will prompt you each time to make sure you know what your are doing.

17 Creating File Aliases Hard Links An alias is NOT a copy of a file, it is a secondary reference to it either in the same directory or another directory. That way different users can access the same document or program using different names without the storage overhead of a copy. A 1 megabyte file distributed to 1000 people would take up a gigabyte of storage, which doesn t happen with an alias. Another advantage is that if a change is made to the file all users will see the changes. If you distributed copies of the file then you would have to send everyone a new copy. With an alias you are always up to date. There are two kinds of alias. The first is called a hard link. Hard links all have the same inode #. the syntax is as follows: bash-3.2% ln afile newfile bash-3.2% ls -i l #verify results rw-r--r 2 king staff 0 Jan 10 14:13 afile rw-r--r 2 king staff 0 Jan 10 14:13 newfile If you use vim to edit one file, then look into the other you will find that the contents are identical. Not only is the inode # and all other properties of the file the same, the link count (following the permissions) has been increased to 2. bash-3.2% ln ~king/.vimrc ~/.vimrc #Create a link to a resource control file in king s directory bash-3.2% ls -li ~king/.vimrc ~/.vimrc #verify - both have the same inode #s and permissions When you execute the above (and you only have to do it once) you are linking to a file that contains several macros and function keys that I ve created for your use. For example if you use vim to create a C Program, a PHP program or an HTML file you wil find that strings, keywords and variables will now be colour codes which will help which will help detect their correct use and determine unterminated comments, tags and strings. The mechanism behind it is as follows. Unix directories simple files consisting of two pieces of information for other files the inode # and the file name. You can change the file name the only thing that happens is that you change the entry in the directory. What the inode# (information node) does is that it points into a block of memory on the disk known as the superblock where each entry contains the rest of the file information about the file its permissions, owership, link count and access, modification and change property times, but not the file name which is in the directory. The actual layout of this data store is not known to the end user and is largely irrelevant, and in fact there are several different types of file system where the layout is different.

18 Superblock DirectoryA File Property and Data Region inode# File Name myfile 1004 orders.txt 1007 January.report 1005 DirectoryB DirectoryB inode# File Name personnel.note 1006 anything.txt 1003 aliastomyfile In the above diagram both DirectoryA/myFile and DirectoryB/aliasToMyFile are both defined as inode# 1003, which in turn points to a block of memory on the disk. They are therefore the same file. Also note that in DirectoryB there is an entry. (dot) - all directories point to themselves. There s also an entry.. (dot dot) that refers to the parent directory. All directories, even the root directory, point to a parent directory. Note that the parent directory.. of DirectoryB is the same file as. DirectoryA Files that start with a dot are called hidden files because they are not normally shown when you run the ls command, however they are shown if you add the a (all) option. This is not a security measure 6. Files that start with a dot are usually support files created by the system or some utility. They are hidden as a convenience so that the user normally sees only the files that they have created. bash-3.2% ls -lai drwxr-xr-x 5 king staff 4096 Jan 12 08: drwxr-x--x 76 king staff Jan 12 08:50.. (more ordinary files follow) 6 Hiding information as opposed to encrypting it or denying access is called security by obscurity. Generally its a bad idea. Like hiding your door key behind the garage door, eventually someone will find it.

19 Files can be several gigabytes in size, but changing the name or creating a hardlink will be nearly instantaneous because only the directory entry is changed. A file may have any number of hard links. Any file, including the original name can be deleted but as long as one hard link to the file exists, the file remains on the system. When the link count goes to zero, the file is removed from the file system. A version of the rm command is unlink, however unlink will only remove one file and it takes no flags. Symbolic links In the following example we create 2 symbolic links. In the 2 nd case we use the full absolute path of the file, but the effect will be the same. bash-3.2% ln -s afile symboliclink #Note the flag -s bash-3.2% ln -s /home/staff/king/d1/afile other-slink #Note the flag -s bash-3.2% ls -li afile symboliclink other-slink rw-r--r-- 1 king staff 0 Jan 11 16:37 afile lrwxrwxrwx 1 king staff 5 Jan 11 16:39 symboliclink -> afile lrwxrwxrwx 1 king staff 22 Jan 11 16:49 symboliclink2 -> /home/staff/king/afile When you try this out you should take note of several differences. The first is that the inode numbers are different. The second is that the file type marker is l for symbolic link. Next, all the permissions are turned on - in fact what will apply are the permissions of the original file. Fourth, the link count for the new file is set to 1. Next the file size and the last accessed time is different. And finally after the file name is an arrow indicating the name of the file that the alias points to. The secret is the file sizes. What is stored in the file is the name of the file being pointed to. Inside symboliclink is 5 letters: afile, the file name in the current directory. symboliclink2 contains 22 characters, the same number of letters contained in /home/staff/king/afile. (Use a different path and you ll get a slightly different result. So why two mechanisms? Hard links have 2 restrictions. The first is that a hard link is unique, but only to the hard drive that it is on. Symbolic links can refer to other hard drives. When hard links were designed into Unix hard drives cost thousands of dollars - the expectation was that you could afford at most one. The 2 nd restriction is more recent as a user you are not allowed to create a hard link to a directory, however the system does this all the time with. (dot) and.. (dot dot). I ve never been satisfied with the reason given so I won t go into it. Symbolic links can point to directories.

20 Symbolic have one additonal advantage and disadvantage. An advantage symbolic link can point to a file that doesn t exist yet. You can create a link and then create the file later. If that s the case the link will be hilited in red when you run ls. A disadvantage is that if the original file is deleted, all the symbolic links will point into empty space if you attempt to use them you ll get a file not found error. With hard links, if you have any hard link reference to the file it s still around. Other Details The f flag is used to force the creation of a symbolic or hard link if the designated link file already exists, using -f will force it to be deleted and replaced. The -i flag makes this interactive. If the new link file doesn t exist, there s no different. If it does, it prompts: ln -i afile cfile ln: replace `cfile'? y The v flag means verbose. ln -i afile cfile -v ln: replace `cfile'? y create hard link `cfile' to `afile' An interesting aspect of this is that all directories have a minimum hard link count of 2. This is because every single directy has 2 references to it. The first is its entry in its parent directory. For example, for a home directory /home/students/abramsj, the directory abramsj is an entry in the students directory. The 2 nd hard link is because every directory has an entry. (dot) - which also refers to the directory. Similarly, every directory including the root directory has a reference.. (dot dot), which is a reference to it s parent directory. So when you add a subdirectory the link count of the direct parent will increase by 1.

21

22 Appendix: How to Use Humber s vim Macros Macros allow you to translate a few keystrokes into several commands. The following were developed by Prof. Leon King a couple of aeons ago. Some are useful, others are just cute. The following functions are mapped onto function keys: F1 - Brings up the main vim help screen. This is standard for vim. F2 Saves the current file. Identical to :w F3 Compiles the current file as a C file w/o leaving the editor. F4 Runs the executable of the current C file w/o leaving the editor F7 - Starts a bash subshell when you are in vim. To show that you are in a subshell, type in the ps command. To exit the subshell and return to vim, type in exit F9 turn off hilighting in search The following abbreviations expand to larger strings DATE inserts the current date in the file fori for(i=0;i<10;i++) { } HC Humber College IBM International Business Machines INTER CENG 411 Unix Internals MYSUB void sub1{} PR fprintf(stdout, Hello World\n ); psvm Generates a simple Java Hello World program. T154 Intro to Unix and the Internet The following abbreviations expand to multiple lines of text: BHEAD FHEAD HTML Generates a set of comments showing the current date, the user name and the course. To detect the course you need to be in a directory with any of NEST, TECH or CENG in the name. Does the same as BHEAD only in a format suitable for C Programming generates a standard HTML web page framework

23 SW TAB WEBRW WHO generates a C language switch statement block generates an HTML table generates a row in an HTML table runs the who command and inserts the output in the file Any of the above can be undone by typing in the vim undo command u A minor annoyance is that you cannot directly type in any of the above strings without it being replaced. However you can either type it the last character with a 4 second delay, or indirectly type it in, ie: type in IB M and then go back and delete the space between the B and the M. The following additional capabilities are enabled as well: Automatic file backup. Every time you edit a file a version with.bak is saved containing the previous contents. Keywords in different programming languages are hilited in different colours. When you do a search using / or?, the text is immediately hilighted Line numbers are automatically shown - useful for debugging or documenting errors. Tabs are set to 4 character inserts. How to set this up: The secret is in a special resource controll file called.vimrc in your home directory which is loaded every time you start the vim editor. To make these macros and capabilities available you need to issue this command once and once only: ln ~/.vimrc ~king/.vimrc If you need to establish this file on a separate install such as a virtual linux machine, copy the file over. Most students will simply use these macros as given. If you are interested in writing your own you should consult the vim manual.

24

CS Fundamentals of Programming II Fall Very Basic UNIX

CS Fundamentals of Programming II Fall Very Basic UNIX CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)

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

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

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot

More information

Mills HPC Tutorial Series. Linux Basics I

Mills HPC Tutorial Series. Linux Basics I Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create

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

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

Using the Zoo Workstations

Using the Zoo Workstations Using the Zoo Workstations Version 1.86: January 16, 2014 If you ve used Linux before, you can probably skip many of these instructions, but skim just in case. Please direct corrections and suggestions

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

Linux File System and Basic Commands

Linux File System and Basic Commands Linux File System and Basic Commands 0.1 Files, directories, and pwd The GNU/Linux operating system is much different from your typical Microsoft Windows PC, and probably looks different from Apple OS

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

Basic File Attributes

Basic File Attributes Basic File Attributes The UNIX file system allows the user to access other files not belonging to them and without infringing on security. A file has a number of attributes (properties) that are stored

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

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

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical

More information

CS/CIS 249 SP18 - Intro to Information Security

CS/CIS 249 SP18 - Intro to Information Security Lab assignment CS/CIS 249 SP18 - Intro to Information Security Lab #2 - UNIX/Linux Access Controls, version 1.2 A typed document is required for this assignment. You must type the questions and your responses

More information

Getting Started. Running Utilities. Shells. Special Characters. Special Characters. Chapter 2 Unix Utilities for non-programmers

Getting Started. Running Utilities. Shells. Special Characters. Special Characters. Chapter 2 Unix Utilities for non-programmers Chapter 2 Unix Utilities for non-programmers Graham Glass and King Ables, UNIX for Programmers and Users, Third Edition, Pearson Prentice Hall, 2003. Original Notes by Raj Sunderraman Converted to presentation

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

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

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

15-122: Principles of Imperative Computation

15-122: Principles of Imperative Computation 15-122: Principles of Imperative Computation Lab 0 Navigating your account in Linux Tom Cortina, Rob Simmons Unlike typical graphical interfaces for operating systems, here you are entering commands directly

More information

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands Table Of Contents 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands Getting onto the Zoo Type ssh @node.zoo.cs.yale.edu, and enter your netid pass when prompted.

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

CSE II-Sem)

CSE II-Sem) a) Write a shell script that displays a list of all the files in the current directory to which the user has read, write and execute permissions. b) Develop an interactive script that asks for a word and

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

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Review of the Linux File System and Linux Commands 1. Introduction Becoming adept at using the Linux OS requires gaining familiarity

More information

Getting started with Hugs on Linux

Getting started with Hugs on Linux Getting started with Hugs on Linux CS190 Functional Programming Techniques Dr Hans Georg Schaathun University of Surrey Autumn 2008 Week 1 Dr Hans Georg Schaathun Getting started with Hugs on Linux Autumn

More information

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys Hitchhiker s Guide to VLSI Design with Cadence & Synopsys David Money Harris 17 January 2009 The VLSI design tools at Harvey Mudd College are hosted on a Linux server named chips. This document introduces

More information

Unix Tutorial Haverford Astronomy 2014/2015

Unix Tutorial Haverford Astronomy 2014/2015 Unix Tutorial Haverford Astronomy 2014/2015 Overview of Haverford astronomy computing resources This tutorial is intended for use on computers running the Linux operating system, including those in the

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

CISC 220 fall 2011, set 1: Linux basics

CISC 220 fall 2011, set 1: Linux basics CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week

More information

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Scripting Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss What a shell

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

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers A Big Step Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Copyright 2006 2009 Stewart Weiss What a shell really does Here is the scoop on shells. A shell is a program

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

Introduction. SSH Secure Shell Client 1

Introduction. SSH Secure Shell Client 1 SSH Secure Shell Client 1 Introduction An SSH Secure Shell Client is a piece of software that allows a user to do a number of functions. Some of these functions are: file transferring, setting permissions,

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

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

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

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

CENG200 - Lab 2: Security, Simple Web Pages

CENG200 - Lab 2: Security, Simple Web Pages Out: Sept 12, 2016 Due: Sept 26, 2016 (start of lecture) Preliminary Steps CENG200 - Lab 2: Security, Simple Web Pages A. When you log in for this lab, perform the following actions (one time only) chmod

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

Links, basic file manipulation, environmental variables, executing programs out of $PATH

Links, basic file manipulation, environmental variables, executing programs out of $PATH Links, basic file manipulation, environmental variables, executing programs out of $PATH Laboratory of Genomics & Bioinformatics in Parasitology Department of Parasitology, ICB, USP The $PATH PATH (which

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

The Unix Shell & Shell Scripts

The Unix Shell & Shell Scripts The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises

More information

Introduction to Linux Workshop 1

Introduction to Linux Workshop 1 Introduction to Linux Workshop 1 The George Washington University SEAS Computing Facility Created by Jason Hurlburt, Hadi Mohammadi, Marco Suarez hurlburj@gwu.edu Logging In The lab computers will authenticate

More information

Getting started with Hugs on Linux

Getting started with Hugs on Linux Getting started with Hugs on Linux COM1022 Functional Programming Techniques Dr Hans Georg Schaathun University of Surrey Autumn 2009 Week 7 Dr Hans Georg Schaathun Getting started with Hugs on Linux Autumn

More information

Physics REU Unix Tutorial

Physics REU Unix Tutorial Physics REU Unix Tutorial What is unix? Unix is an operating system. In simple terms, its the set of programs that makes a computer work. It can be broken down into three parts. (1) kernel: The component

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

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

CS4350 Unix Programming. Outline

CS4350 Unix Programming. Outline Outline Unix Management Files and file systems Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission

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

Getting Started with UNIX

Getting Started with UNIX Getting Started with UNIX What is UNIX? Boston University Information Services & Technology Course Number: 4000 Course Instructor: Kenny Burns Operating System Interface between a user and the computer

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

When you first log in, you will be placed in your home directory. To see what this directory is named, type:

When you first log in, you will be placed in your home directory. To see what this directory is named, type: Chem 7520 Unix Crash Course Throughout this page, the command prompt will be signified by > at the beginning of a line (you do not type this symbol, just everything after it). Navigation When you first

More information

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C Welcome! Welcome to your CpSc 111 lab! For each lab this semester, you will be provided a document like this to guide you. This material, as

More information

Introduction to Linux. Fundamentals of Computer Science

Introduction to Linux. Fundamentals of Computer Science Introduction to Linux Fundamentals of Computer Science Outline Operating Systems Linux History Linux Architecture Logging in to Linux Command Format Linux Filesystem Directory and File Commands Wildcard

More information

Linux Command Line Primer. By: Scott Marshall

Linux Command Line Primer. By: Scott Marshall Linux Command Line Primer By: Scott Marshall Draft: 10/21/2007 Table of Contents Topic Page(s) Preface 1 General Filesystem Background Information 2 General Filesystem Commands 2 Working with Files and

More information

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi Lezione 8 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza Sommario Shell command language Introduction A

More information

Practical 4. Linux Commands: Working with Directories

Practical 4. Linux Commands: Working with Directories Practical 4 Linux Commands: Working with Directories 1. pwd: pwd stands for Print Working Directory. As the name states, command pwd prints the current working directory or simply the directory user is,

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

Chapter 8: Security under Linux

Chapter 8: Security under Linux Chapter 8: Security under Linux 8.1 File and Password security Linux security may be divided into two major parts: a) Password security b) File security 8.1.1 Password security To connect to a Linux system

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

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

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

More information

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages 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

Introduction to Linux

Introduction to Linux p. 1/40 Introduction to Linux Xiaoxu Guan High Performance Computing, LSU January 31, 2018 p. 2/40 Outline What is an OS or Linux OS? Basic commands for files/directories Basic commands for text processing

More information

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command.

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command. Unix Internal Assessment-2 solution 1 a.explain the mechanism of process creation. Ans: There are three distinct phases in the creation of a process and uses three important system calls viz., fork, exec,

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

AMS 200: Working on Linux/Unix Machines

AMS 200: Working on Linux/Unix Machines AMS 200, Oct 20, 2014 AMS 200: Working on Linux/Unix Machines Profs. Nic Brummell (brummell@soe.ucsc.edu) & Dongwook Lee (dlee79@ucsc.edu) Department of Applied Mathematics and Statistics University of

More information

The UNIX File System

The UNIX File System The UNIX File System Magnus Johansson (May 2007) 1 UNIX file system A file system is created with mkfs. It defines a number of parameters for the system as depicted in figure 1. These paremeters include

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

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based. Unix tutorial Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based. Terminal windows You will use terminal windows to enter and execute

More information

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell Lezione 8 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Esercitazione Introduzione al linguaggio di shell Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza

More information

Due: February 26, 2014, 7.30 PM

Due: February 26, 2014, 7.30 PM Jackson State University Department of Computer Science CSC 438-01/539-01 Systems and Software Security, Spring 2014 Instructor: Dr. Natarajan Meghanathan Project 1: Exploring UNIX Access Control in a

More information

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

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

Removing files and directories, finding files and directories, controlling programs

Removing files and directories, finding files and directories, controlling programs Removing files and directories, finding files and directories, controlling programs Laboratory of Genomics & Bioinformatics in Parasitology Department of Parasitology, ICB, USP Removing files Files can

More information

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions Lanka Education and Research Network Linux Architecture, Linux File System, Linux Basic Commands 28 th November 2016 Dilum Samarasinhe () Overview History of Linux Linux Architecture Linux File System

More information

Linux Systems Administration Getting Started with Linux

Linux Systems Administration Getting Started with Linux Linux Systems Administration Getting Started with Linux Network Startup Resource Center www.nsrc.org These materials are licensed under the Creative Commons Attribution-NonCommercial 4.0 International

More information

The UNIX File System

The UNIX File System The UNIX File System Magnus Johansson May 9, 2007 1 UNIX file system A file system is created with mkfs. It defines a number of parameters for the system, such as: bootblock - contains a primary boot program

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

Listing Directory Attributes. Bamuengine.com Page 1. BY Prof. P. Katkar, DIEMS, AURANGABAD

Listing Directory Attributes. Bamuengine.com Page 1. BY Prof. P. Katkar, DIEMS, AURANGABAD Unit II File Attributes and VI Editor of UNIX. --------------------------------------------------------------------------------------------------- The UNIX file system allows the user to access other files

More information

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial Lecture 1 p.1 Faculty of Computer Science, Dalhousie University CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial 9 and 11-Jan-2019 Lab Instructor: Dijana Kosmajac,

More information

CSC111 Computer Science II

CSC111 Computer Science II CSC111 Computer Science II Lab 1 Getting to know Linux Introduction The purpose of this lab is to introduce you to the command line interface in Linux. Getting started In our labs If you are in one of

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

Processes are subjects.

Processes are subjects. Identification and Authentication Access Control Other security related things: Devices, mounting filesystems Search path Race conditions NOTE: filenames may differ between OS/distributions Principals

More information

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~ Introduction to Open Source Software Development Spring semester, 2017 School of Computer Science and Engineering, Pusan National University Joon-Seok Kim LINUX: COMMANDS Review Lab #1 2 Create Directories

More information

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab Basic Terminal Intro to Linux ssh short for s ecure sh ell usage: ssh [host]@[computer].[otheripstuff] for lab computers: ssh [CSID]@[comp].cs.utexas.edu can get a list of active computers from the UTCS

More information

12/7/10 ATSC 212 UNIX ATSC 212 ATSC 212 UNIX

12/7/10 ATSC 212 UNIX ATSC 212 ATSC 212 UNIX ATSC 212 1 An operating system (OS) is a resource manager. It's task is to schedule resources and make available resources to system processes or programs. There have been hundreds of operating systems

More information

CMSC 201 Spring 2018 Lab 01 Hello World

CMSC 201 Spring 2018 Lab 01 Hello World CMSC 201 Spring 2018 Lab 01 Hello World Assignment: Lab 01 Hello World Due Date: Sunday, February 4th by 8:59:59 PM Value: 10 points At UMBC, the GL system is designed to grant students the privileges

More information

Introduction to Unix - Lab Exercise 0

Introduction to Unix - Lab Exercise 0 Introduction to Unix - Lab Exercise 0 Along with this document you should also receive a printout entitled First Year Survival Guide which is a (very) basic introduction to Unix and your life in the CSE

More information

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

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

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

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

Operating System Interaction via bash

Operating System Interaction via bash Operating System Interaction via bash bash, or the Bourne-Again Shell, is a popular operating system shell that is used by many platforms bash uses the command line interaction style generally accepted

More information

Essential Linux Shell Commands

Essential Linux Shell Commands Essential Linux Shell Commands Special Characters Quoting and Escaping Change Directory Show Current Directory List Directory Contents Working with Files Working with Directories Special Characters There

More information