CSE 220 - First Set of notes
CSE 220 - First Set of notes CSE 220
Popular in Programming for Computer Engr
Popular in Computer Science and Engineering
This 3 page Class Notes was uploaded by RianMartins on Monday September 21, 2015. The Class Notes belongs to CSE 220 at Arizona State University taught by Tadayon-Navabi in Fall 2015. Since its upload, it has received 26 views. For similar materials see Programming for Computer Engr in Computer Science and Engineering at Arizona State University.
Reviews for CSE 220 - First Set of notes
Report this Material
What is Karma?
Karma is the currency of StudySoup.
Date Created: 09/21/15
CSE 220 FIRST WEEK OF NOTES UNIX COMMANDS 0 You may be already a little familiar with the basic unix commands They are the same we use in the command prompt o If you are not familiar at all with them don t worry Let s work on that 0 Changing Directories To change directories we use the command cd We can use the command to enter directories by using the relative or absolute path we are going to get to that latter Keep in mind some useful trucks dot means your current directory and dot dot means the parent directory of your current directory Ex f am at homefredexam1 directory and type cd it will remain in the same directory that I am already in But if I type cd it will enter in the directory fred exam1 s parent 0 Relative vs Absolute Path Relative Path A relative path is defined as path related to the present working directory pwd 0 Ex Suppose I am located in varlog and I want to change directory to varlogkernel I can use relative path concept to change directory to kernel just type quotcd kernel Absolute Path An absolute path is defined as the specifying the location of a file or directory from the root directory In other words we can say absolute path is a complete path from start of actual filesystem from directory 0 Ex Using the same example above using absolute path I would type quotcd varlogkernel 0 List content of directory To list the content of your directory we use the Is command If we type just Is it will list only the name of the files and directories in your current directory Although there are some other options that we may use along the Is o ls I will list all the content and some more information about each file or directory like permissions date last modified file size and others o Is a will list all hidden files if any 0 You can also combine the options Typing ls al you list all the files and directories including the hidden elements and also be able to see their information 0 Change files permissions The permissions of the files are shown separated in three groups owner group owner and everybody Each group may have independent permissions 0 Ex When we see rwxrwr we should look at it like rwx rw r o The first will indicate when is a directory or not r wx are the permissions for the owner of the file that means that he can Read Write and eXecute the file r w are the permissions for the groupowner that means that they can Read and Write but cannot eXecute it And r are the permissions for everybody else That means that if you are not the owner or makes part of the groupowner you can only Read the file I To change the file permissions we use the chmod command I It is possible to use this command in two different ways chmod 775filename Changes the permission of file to be rwx for the owner and rx for the group and the world 7 rwx111 in binary 5r x101 chmod xfilename That will make the file executable for all the three groups 0 Globing Wild Cards I star Some cases you need to use globing patterns to remove more than one file for example The means anything Ex f have file01h file02h file11h file111h file3txt and templatec in my current working directory If I type rm f I will remove all the files starting with lowercase F Using rm fh I will remove all the files starting with lowercase F it could have anything after it in its name and have extension h I question mark The is used to replace only one character Ex Suppose I have the same files described above f type quotrm file1h I will remove the filesfile01h and file11h f use quotrm file1h I will remove the files file01hfile11h and file111h 0 Copying Moving Renaming files I Copying To copy files use quotcpquot command cp testtxt This command will copy the file testtxt present in the current working directory and paste in its parent directory cp testtxtusersfred This command will copy the file testtxt present in the current working directory and paste in usersfred directory cp usersbarneydocumentsfootxt This command will copy the file footxt present in under the folder documents of Barney and paste in your current working directory I Moving To move files use quotmvquot command mv testtxt This command will move the file testtxt present in the current working directory to its parent directory mv testtxtusersfred This command will move the file testtxt present in the current working directory to usersfred directory mv usersbarneydocumentsfootxt This command will mve the file footxt present in under the folder documents of Barney to your current working directory I Renaming files To rename a file use the quotmvquot command as well o mv testtxt testCompetetxt This command will rename the existing file test txt to testCompete txt